Re: [R] Inconsistent linear model calculations

From: Brian S Cade <cadeb_at_usgs.gov>
Date: Thu, 15 May 2008 15:48:51 -0600


Well at a minimum V4 and V6 (used in lm()) are not the same in these two data sets. Not sure why but there it is.

Brian

Brian S. Cade

U. S. Geological Survey
Fort Collins Science Center
2150 Centre Ave., Bldg. C
Fort Collins, CO 80526-8818

email: brian_cade_at_usgs.gov
tel: 970 226-9326

e-letter <inpost_at_gmail.com>
Sent by: r-help-bounces_at_r-project.org
05/15/2008 03:37 PM

To
r-help_at_r-project.org
cc

Subject
Re: [R] Inconsistent linear model calculations

Below is direct copy from command terminals of both pcs (mandrake 92 with r 171; mandriva 2008 with r 251, respectively).

R : Copyright 2003, The R Development Core Team Version 1.7.1 (2003-06-16)

R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type `license()' or `licence()' for distribution details.

R is a collaborative project with many contributors. Type `contributors()' for more information.

Type `demo()' for some demos, `help()' for on-line help, or `help.start()' for a HTML browser interface to help. Type `q()' to quit R.

> dubious<-read.table('/path/to/file/dodgy.csv')
> dubious

  V1 V2 V3 V4 V5 V6 V7

1  1 300 39.87 39.85 39.90 39.87333  90000
2  2 400 45.16 45.23 45.17 45.18667 160000
3  3 500 50.72 51.03 50.90 50.88333 250000
4  4 600 56.85 56.80 57.02 56.89000 360000
5  5 700 63.01 63.09 63.14 63.08000 490000
6  6 800 69.52 69.82 69.63 69.65667 640000

>
> lm(V6~V2+V7,data=dubious)

Call:
lm(formula = V6 ~ V2 + V7, data = dubious)

Coefficients:
(Intercept) V2 V7
  2.553e+01 4.332e-02 1.480e-05

>

R version 2.5.1 (2007-06-27)
Copyright (C) 2007 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R.

> dubious<-read.table('/path/to/file/dodgy.csv')
> dubious

  V1 V2 V3 V4 V5 V6 V7

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

> lm(V6~V2+V7,data=dubious)

Call:
lm(formula = V6 ~ V2 + V7, data = dubious)

Coefficients:
(Intercept) V2 V7
  1.937e+01 7.168e-02 -1.537e-05

>

Below is the csv file itself:

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

Enjoy! :)



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.

        [[alternative HTML version deleted]]



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 Fri 16 May 2008 - 06:42:47 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 Fri 16 May 2008 - 15:30:37 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