Re: [R] Inconsistent linear model calculations

From: Ben Bolker <bolker_at_ufl.edu>
Date: Thu, 15 May 2008 15:13:52 +0000 (UTC)

e-letter <inpost <at> gmail.com> writes:

>
> 2008/5/15 Douglas Bates <bates <at> stat.wisc.edu>:
> > Did you happen to notice the part at the bottom of every message about
> > "provide commented, minimal, self-contained, reproducible code"?
> >
> Sorry, don't understand what that statement means in my context.

  It means that we need to be able to see exactly what you're trying to do -- you haven't given us enough information.

>
> > Considering that the result you quote from "251" has 2 coefficients
> > and the result from "171" has 3 coefficients one might contemplate the
> > possibility that you are fitting different models or perhaps using
> > different data. However we can't verify anything about the causes
> > because we have no data regarding the problem.
>

in version 2.7.0 (both of the versions you are using are very old):

> data1 = read.table(textConnection("y a b c d e f\

+ 1  300 39.87 39.85 39.90 39.87333  90000\
+ 2  400 45.16 45.23 45.17 45.18667 160000\
+ 3  500 50.72 51.03 50.90 50.88333 250000\
+ 4  600 56.85 56.80 57.02 56.89000 360000\
+ 5  700 63.01 63.09 63.14 63.08000 490000\
+ 6  800 69.52 59.68 69.63 66.27667 640000"),
+            header=TRUE)

  I wasn't sure from your answers whether you really meant to use a and b or whether you meant to use e and f

> lm(y~e+f,data=data1)

Call:
lm(formula = y ~ e + f, data = data1)

Coefficients:
(Intercept) e f
 -4.097e+00 1.234e-01 2.929e-06

> lm(y~a+b,data=data1)

Call:
lm(formula = y ~ a + b, data = data1)

Coefficients:
(Intercept) a b
 -2.000e+00 1.000e-02 -1.294e-15

   Repeating what Doug Bates said above: the result that you quote for 2.5.1,
with only two estimates for a three-parameter model (intercept plus two covariates), is surprising indeed, and strongly suggests a user error. I would also be very surprised if anything had changed in the answers I quote above between 2.5.1 and the current version of R.

   Please remember how much you paid for R, and for this advice, and adjust your tone accordingly ...

  cheers
    Ben Bolker



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Thu 15 May 2008 - 16:32:56 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 15 May 2008 - 17:30:38 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive