4
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 place between the independent variables the term x squared. It simply ignores the term and regresses the model as the code below:
model2<-lm(y~x)
Yes! I remembered I had a function for it, but I couldn’t remember what it was :(
– Rcoster