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)
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...
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...
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...
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...
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...