Bug? (PR#1710)
This is NOT A BUG. If you want a squared term, you need to include I(carb^2). See ?formula or even `An Introduction to R'. Please 1) Use an informative subject line, as only the subject appears in the BUGS summary file. 2) Read the Bugs section in the FAQ, and only post to R-bugs if you are absolutely sure you understand.
On Wed, 26 Jun 2002 Lauri.Mehtatalo@metla.fi wrote:
Hi, I tried to do a multiple linear model from the example dataset Formaldehyde. However, the function lm() did not estimate the coefficient of the term carb^2. The same problem occurred with the (nlme)dataset Pixel with both function lme() and lm(). I am using the windows version of R 1.5.1 Lauri Mehtatalo The Formaldehyde example:
data(Formaldehyde) lm(optden~carb+carb^2,data=Formaldehyde)
Call: lm(formula = optden ~ carb + carb^2, data = Formaldehyde) Coefficients: (Intercept) carb 0.005086 0.876286 The Pixel example:
{pkg <- select.list(sort(.packages(all.available = TRUE)))
+ if(nchar(pkg)) library(pkg, character.only=TRUE)} Loading required package: nls Loading required package: lattice
data(Pixel) coef(lme(pixel~day+day^2,data=Pixel,random=list(Dog=
~day,Side=~1)))
(Intercept) day
1/L 1048.995 0.32564928
1/R 1043.659 0.32564928
10/L 1144.898 -0.63867455
10/R 1099.883 -0.63867455
2/L 1054.011 0.65786288
2/R 1048.726 0.65786288
3/L 1065.000 0.45552014
3/R 1075.759 0.45552014
4/L 1088.173 0.93300591
4/R 1088.854 0.93300591
5/L 1125.918 -0.91429707
5/R 1129.309 -0.91429707
6/L 1112.721 -0.72735611
6/R 1094.164 -0.72735611
7/L 1133.443 -1.69593549
7/R 1156.943 -1.69593549
8/L 1101.205 0.05435070
8/R 1087.689 0.05435070
9/L 1093.513 0.05987474
9/R 1071.482 0.05987474
coef(lm(pixel~day+day^2,data=Pixel))
(Intercept) day 1076.820678 1.341873 - - - - - - - - - - - - - Lauri Mehtätalo Metsäntutkimuslaitos Joensuun tutkimuskeskus PL 68 (Yliopistokatu 7) 80101 JOENSUU lauri.mehtatalo@metla.fi p. 013-251 4110 - - - - - - - - - - - - - -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Brian D. Ripley, ripley@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._