Ok then I have the following information:
A<-c(.04,.10,.16,.28,.04,.10,.16,.28,.04,.10,.16,.28)
Gain<-c(680.2,721.4,750.4,789.4,672.2,709.2,731.2,778.2,668.4,715.6,732.0,794.0)
So I want to predict a new observations that is .20 using a simple linear regression model, then I do:
new.dat<-data.frame(porcentaje=.20)
predict(lm(Gain~A), newdata=new.dat, interval="confidence")
But all I get are all the predictions of the observations and an error message:
fit lwr upr
1 680.4533 671.1511 689.7555
2 707.9181 701.1857 714.6505
3 735.3829 729.2931 741.4726
4 790.3124 779.3810 801.2437
5 680.4533 671.1511 689.7555
6 707.9181 701.1857 714.6505
7 735.3829 729.2931 741.4726
8 790.3124 779.3810 801.2437
9 680.4533 671.1511 689.7555
10 707.9181 701.1857 714.6505
11 735.3829 729.2931 741.4726
12 790.3124 779.3810 801.2437
Warning message:
'newdata' had 1 row but variables found have 12 rows
I do not understand what I'm doing wrong, please help!