Questions tagged as 'lm'

1
answer

How to put the regression equation on a graph?

In another question , and how to put the regression line on a graph. But how to put the regression equation on the graph? For example: Or     
asked by 22.02.2014 / 14:55
3
answers

How to put the regression line on a graph?

Suppose a linear regression model such as the following: set.seed(1) x <- rnorm(100) y <- rnorm(100) + 2*x +10 modelo <- lm(y~x) If I plot y against x, how do I include the regression line in the chart? plot(y~x)     
asked by 18.02.2014 / 14:50
3
answers

How to select all data.frame variables at once for a regression?

Suppose the following data.frame : set.seed(1) dados <- data.frame(y=rnorm(100), x1=rnorm(100), x2=rnorm(100), x3=rnorm(100), x4=rnorm(100)) If I want to run a regression of y against x1 ... xn , I can do it as fol...
asked by 19.02.2014 / 14:37
1
answer

Automatically identify points of influence in a regression

Whenever we do a linear regression, we need to check whether the assumed assumptions for the model are correct. One of the best ways to do this is through diagnostic charts. See the example below: ajuste <- lm(Petal.Width ~ Petal.Length, da...
asked by 27.10.2017 / 14:27
3
answers

How to include in the regression a variable raised to n

Suppose I have the following data x<-rnorm(100,1,10000) y<-rnorm(100,1,10000)+2*x+x^2 If I use the lm function as follows: model1<-lm(y~x+x^2) The R does not understand that it is to put between the independent variables the t...
asked by 18.02.2014 / 12:53
1
answer

What is rank-deficient and how to get around it?

I made a linear regression lm() , where I declared some variables as factor , and got some betas as NA as: citySão José NA When I made the prediction, the prediction occurred and I received the following warning: Warnin...
asked by 23.10.2018 / 20:30
1
answer

Using the function lm, from R, to solve the problem autocorrelation

I'm working with the function. lm (y ~ x) Simple regression, due to tests I checked autocorrelation, so the blibliography indicates a transformation. Something like: Y = B1 * (1-p) + B2 (X- (p * X [-1])) What would be the applicat...
asked by 28.04.2018 / 21:11