Re: [R] Inconsistent linear model calculations

2008-05-16 Thread e-letter
For the record, v6 represented the averages for columns v3-v5 because
I could not quickly find the r instruction to calculate the average.
Similiarly v7 represents  square power of v2. At the time it was
quicker than trawling through five or so user manuals for the formula
syntax.

__
R-help@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.


Re: [R] Inconsistent linear model calculations

2008-05-16 Thread Petr PIKAL
Hi

Maybe you shall reconsider your decision to avoid manuals especially 
R-intro.pdf, where you can learn basic operations and data structures. 

[EMAIL PROTECTED] napsal dne 16.05.2008 09:52:22:

 For the record, v6 represented the averages for columns v3-v5 because
 I could not quickly find the r instruction to calculate the average.

Did you try ?mean. You could get to it in seconds if you used

help.search(average)
and then from ave page there is direct link to mean.

 Similiarly v7 represents  square power of v2. At the time it was

In many programs n^m means to m'th power of n.

Least but not last the problem **was not** in R but in your data, as was 
suggested originally by D.Bates.

Regards
Petr

 quicker than trawling through five or so user manuals for the formula
 syntax.
 
 __
 R-help@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.

__
R-help@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.


Re: [R] Inconsistent linear model calculations

2008-05-16 Thread Gavin Simpson
On Thu, 2008-05-15 at 14:50 +0100, e-letter wrote:
 2008/5/15 Douglas Bates [EMAIL PROTECTED]:
  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.
 
  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.
 
 data below:
 
   yabcd   e f
 1  300 39.87 39.85 39.90 39.87333  9
 2  400 45.16 45.23 45.17 45.18667 16
 3  500 50.72 51.03 50.90 50.88333 25
 4  600 56.85 56.80 57.02 56.89000 36
 5  700 63.01 63.09 63.14 63.08000 49
 6  800 69.52 59.68 69.63 66.27667 64
 
 so substitute a in my generic equation below for data column e (e.g.
 39.87...) and b for f (e.g. 9e4).
 
 
  Perhaps you are Brian Ripley's evil twin trying to provoke him.  I
  would say that references to a nonexistent version 171 are
  deliberately provocative.
 
 No idea and couldn't care less who br is:
 
 R : Copyright 2003, The R Development Core Team
 Version 1.7.1  (2003-06-16)
 
 Get your facts correct before spouting further rubbish.

I'm sorry e-letter, but that is just not an acceptable attitude for
this list.

I could explain Doug's BR comment (it was just a little bit of fun), but
I guess from your answer you haven't been on the list for very long -
and you might come to regret caring less who BR is - the assistance he
has given me and countless other UseR's other the years has been
invaluable.

I'm amazed people still bothered to help you after this response - just
goes to show that most people on this list are incredibly helpful and
are doing their bit to help people use a wonderful piece of software;
furthering the cause.

There really isn't an R version 171 or even 251; the printed output from
the R session *you* quote shows that.

Glad you got your problem sorted in the end.

G

-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,  [f] +44 (0)20 7679 0565
 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London  [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

__
R-help@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.


Re: [R] Inconsistent linear model calculations

2008-05-15 Thread Douglas Bates
Did you happen to notice the part at the bottom of every message about
provide commented, minimal, self-contained, reproducible code?

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.

Perhaps you are Brian Ripley's evil twin trying to provoke him.  I
would say that references to a nonexistent version 171 are
deliberately provocative.  (251 could be considered a lazy person's
attempt at 2.5.1 but 171 which presumably came after 251 doesn't
make any sense to me.)

On Thu, May 15, 2008 at 7:05 AM, e-letter [EMAIL PROTECTED] wrote:
 Readers,

 Using version 251 I tried the following command:

 lm(y~a+b,data=datafile)

 Resulting in, inter alia:
 ...
 coefficients
 (intercept) a
 1.2 3.4

 Packages installed:
 acepack ace() and avas() for selecting regression
transformations
 adlift  An adaptive lifting scheme algorithm
 akima   Interpolation of irregularly spaced data
 alr3Methods and data to accompany Applied Linear
Regression 3rd edition
 car Companion to Applied Regression
 codaOutput analysis and diagnostics for MCMC
 drc Analysis of dose-response curves
 EbayesThreshEmpirical Bayes thresholding and related
methods
 emplik  Empirical likelihood ratio for
censored/truncated data
 gllmGeneralised log-linear model
 glmcFitting Generalized Linear Models Subject to
Constraints
 glmmML  Generalized linear models with clustering
 glmpath L1 Regularization Path for Generalized Linear
Models and Cox Proportional Hazards Model
 HydroMe Estimation of Soil Hydraulic Parameters from
Experimental Data
 JGR JGR - Java Gui for R
 lmtest  Testing Linear Regression Models
 locfit  Local Regression, Likelihood and Density
Estimation.
 mvtnorm Multivariate Normal and t Distributions
 NISTnls Nonlinear least squares examples from NIST
 nlmeLinear and Nonlinear Mixed Effects Models
 nlstoolsTools for nonlinear regression diagnostics
 nlt A nondecimated lifting transform for signal
denoising
 nlts(non)linear time series analysis
 nnlsThe Lawson-Hanson algorithm for non-negative
least squares (NNLS)
 plotrix Various plotting functions
 quantregQuantile Regression
 Rcmdr   ** No title available (pre-2.0.0 install?) **
 sandwichRobust Covariance Matrix Estimators
 SparseM Sparse Linear Algebra
 sspline Smoothing Splines on the Sphere
 zoo Z's ordered observations

 Packages in library '/usr/lib/R/library':
 baseThe R Base Package
 bootBootstrap R (S-Plus) Functions (Canty)
 class   Functions for Classification
 cluster Cluster Analysis Extended Rousseeuw et al.
 codetools   Code Analysis Tools for R
 datasetsThe R Datasets Package
 foreign Read Data Stored by Minitab, S, SAS, SPSS,
Stata, Systat, dBase, ...
 graphicsThe R Graphics Package
 grDevices   The R Graphics Devices and Support for Colours
and Fonts
 gridThe Grid Graphics Package
 KernSmooth  Functions for kernel smoothing for Wand  Jones
(1995)
 lattice Lattice Graphics
 MASSMain Package of Venables and Ripley's MASS
 methods Formal Methods and Classes
 mgcvGAMs with GCV smoothness estimation and GAMMs
by REML/PQL
 nlmeLinear and Nonlinear Mixed Effects Models
 nnetFeed-forward Neural Networks and Multinomial
Log-Linear Models
 quadprogFunctions to solve Quadratic Programming
 lattice Lattice Graphics
 MASSMain Package of Venables and Ripley's MASS
 methods Formal Methods and Classes
 mgcvGAMs with GCV smoothness estimation and GAMMs
by REML/PQL
 nlmeLinear and Nonlinear Mixed Effects Models
 nnet   

Re: [R] Inconsistent linear model calculations

2008-05-15 Thread Michael Kubovy
Hi,

To get help with this problem, you will have to create an example that  
others can duplicate. That is why each message to the list says (at  
the bottom): PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html 
  and provide commented, minimal, self-contained, reproducible code.

Before you do any of that, please run some textbook examples using  
lm(), which will tell you whether lm() is working or not. It is  
***extremely*** unlikely that for a function as stable and heavily- 
used as lm(), the same data and the same command produced different  
results on different computers, different versions of R, or different  
OSs.

Your list of packages installed is not informative, because these  
packages are unlikely to affect your running of lm(). To tell the list  
which version of R you are running please include the output of  
sessionInfo().

You will find that many people are eager to help beginners, as long as  
they give enough information about the problem they encountered.
_
Professor Michael Kubovy
University of Virginia
Department of Psychology
USPS: P.O.Box 400400Charlottesville, VA 22904-4400
Parcels:Room 102Gilmer Hall
 McCormick RoadCharlottesville, VA 22903
Office:B011+1-434-982-4729
Lab:B019+1-434-982-4751
Fax:+1-434-982-4766
WWW:http://www.people.virginia.edu/~mk9y/

On May 15, 2008, at 8:05 AM, e-letter wrote:

 Readers,

 Using version 251 I tried the following command:

 lm(y~a+b,data=datafile)

 Resulting in, inter alia:
 ...
 coefficients
 (intercept) a
 1.2 3.4

 Packages installed:
 snip
 Why do I get different results when entering the same equation
 command? The correct answer was obtained using the older version of
 the software, so I want to replicate using the new version, which is
 installed onto a new pc that I am using. Any advice.

 Yours,

 [EMAIL PROTECTED]

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] Inconsistent linear model calculations

2008-05-15 Thread e-letter
2008/5/15 Douglas Bates [EMAIL PROTECTED]:
 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.

 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.

data below:

  yabcd   e f
1  300 39.87 39.85 39.90 39.87333  9
2  400 45.16 45.23 45.17 45.18667 16
3  500 50.72 51.03 50.90 50.88333 25
4  600 56.85 56.80 57.02 56.89000 36
5  700 63.01 63.09 63.14 63.08000 49
6  800 69.52 59.68 69.63 66.27667 64

so substitute a in my generic equation below for data column e (e.g.
39.87...) and b for f (e.g. 9e4).


 Perhaps you are Brian Ripley's evil twin trying to provoke him.  I
 would say that references to a nonexistent version 171 are
 deliberately provocative.

No idea and couldn't care less who br is:

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

Get your facts correct before spouting further rubbish.

__
R-help@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.


Re: [R] Inconsistent linear model calculations

2008-05-15 Thread Ben Bolker
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(yabcd   e f\
+ 1  300 39.87 39.85 39.90 39.87333  9\
+ 2  400 45.16 45.23 45.17 45.18667 16\
+ 3  500 50.72 51.03 50.90 50.88333 25\
+ 4  600 56.85 56.80 57.02 56.89000 36\
+ 5  700 63.01 63.09 63.14 63.08000 49\
+ 6  800 69.52 59.68 69.63 66.27667 64),
+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)ef  
 -4.097e+001.234e-012.929e-06  

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

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

Coefficients:
(Intercept)ab  
 -2.000e+001.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@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.


Re: [R] Inconsistent linear model calculations

2008-05-15 Thread e-letter
On 15/05/2008, Michael Kubovy [EMAIL PROTECTED] wrote:
 Hi,

 Your reply doesn't help you with your lm() problem. You need to show the
 problem with lm() as well. Your original message was unclear on what is
 wrong.

The problem I have with lm() is that when I enter this command, I
obtain different answers!

 So here is a todo list, before you do anything else:
 (1) Get the most recent version of R (2.7.0).

No thank you. I rely on my urpmi repository.
 (2) Make sure you issue the command update.packages() at least once a week

You must be joking! Waste my time every week to perform a basic task
such as interpolation, or least fit squares linear regression? I am a
novice seeking only to perform rudimentary statistics.
 (3) Find a textbook example of a linear model. Run it using lm().
  (a) If it comes out right, then nothing is wrong with the function, and
 you've been confused somewhere else.

Well, I sought a statistician who showed me how to do this task using
mathematica. Despite advice otherwise, I am interested to learn how to
perform this basic task using r because it's free and and use linux.
The output from the lm() command using version 171 yielded the same
result as obtained from the statistician who helped me. In contrast
enabling the version 251 did not yield the same result, hence this
original post.
  (b) If it comes out wrong, read the help page for lm(), get a textbook or
 read some of the introductory materials on CRAN. lm() is never wrong (this
 is not necessarily true for all R functions, but it's true for most).
 (4) Before you ask the list for help, read
 http://www.R-project.org/posting-guide.html carefully, and
 follow the rules religiously.

Done, but not religiously. ;)
 (5) Generally do not reply to the person who helped you, but to the list.
 You can cc the person who helped you, but that is rarely appropriate (avoid
 cluttering people's mailboxes).
 (6) Do *not* be rude (as in your recent message). You will be shunned.
 Ripley and Bates are two of the most distinguished statisticians alive.
 Accept their criticism gracefully.

Telling a user the software version is nonexistent is equally rude;
I've little respect for such typical techie petulance.
 (7) Your most recent message doesn't help enough. Write it so that if I copy
 and paste your code into R, I can reproduce the result you're worried about.

I didn't know you can copy data directly into r; why not simply copy
the text to your text editor and save in csv format?

Yours,

__
R-help@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.


Re: [R] Inconsistent linear model calculations

2008-05-15 Thread Kenn Konstabel
On Thu, May 15, 2008 at 3:05 PM, e-letter [EMAIL PROTECTED] wrote:

 Using version 251 I tried the following command:

 lm(y~a+b,data=datafile)

 Resulting in, inter alia:
 ...
 coefficients
 (intercept) a
 1.2 3.4

[...]

 When using version 171 I entered the same command:

 lm(y~a+b,data=datafile)

 Resulting in, inter alia:
 ...
 coefficients
 (intercept) a b
 5.6 7.8 9.01



 Why do I get different results when entering the same equation
 command? The correct answer was obtained using the older version of
 the software, so I want to replicate using the new version, which is
 installed onto a new pc that I am using. Any advice.


First check if your data frame is the same on both occasions. (It definitely
wasn't the data set you provided in a later message - so it sounds possible
you've made another error.)

Secondly, try to make sure you're copying real output here. You should have
three coefficients if you ask for three.

Third, check your lm function:

lm%in%ls()

Maybe an evil twin of yours has modified it, for instance, this way:

lm- function(...) cat(coefficients\
(intercept) \ta\
1.2 \t\t3.4\n)

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] Inconsistent linear model calculations

2008-05-15 Thread Rolf Turner


On 16/05/2008, at 7:23 AM, e-letter wrote:


Well, I sought a statistician who showed me how to do this task using
mathematica. Despite advice otherwise,


You are certainly getting bad advice!


I am interested to learn how to
perform this basic task using r because it's free and and use linux.


That's ``R'' not ``r''.


The output from the lm() command using version 171 yielded the same
result as obtained from the statistician who helped me. In contrast
enabling the version 251 did not yield the same result, hence this
original post.


As was previously pointed out:

***THERE IS NOT SUCH THING AS VERSION 251 OF R!!!***

Nor is there a version ``171''.

You can find out what version you are actually using by
typing ``version''.  For example, when I type ``version''
I get the following:

  version
   _
platform   i386-apple-darwin8.10.1
arch   i386
os darwin8.10.1
system i386, darwin8.10.1
status
major  2   
minor  7.0 
year   2008
month  04
day22
svn rev45424
language   R
version.string R version 2.7.0 (2008-04-22) 


(``Arrows'' - added.)  So the version of R that I am  
running is 2.7.0.


cheers,

Rolf Turner


##
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}

__
R-help@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.


Re: [R] Inconsistent linear model calculations

2008-05-15 Thread e-letter
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  V2V3V4V5   V6 V7
1  1 300 39.87 39.85 39.90 39.87333  9
2  2 400 45.16 45.23 45.17 45.18667 16
3  3 500 50.72 51.03 50.90 50.88333 25
4  4 600 56.85 56.80 57.02 56.89000 36
5  5 700 63.01 63.09 63.14 63.08000 49
6  6 800 69.52 69.82 69.63 69.65667 64

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

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

Coefficients:
(Intercept)   V2   V7
  2.553e+014.332e-021.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  V2V3V4V5   V6 V7
1  1 300 39.87 39.85 39.90 39.87333  9
2  2 400 45.16 45.23 45.17 45.18667 16
3  3 500 50.72 51.03 50.90 50.88333 25
4  4 600 56.85 56.80 57.02 56.89000 36
5  5 700 63.01 63.09 63.14 63.08000 49
6  6 800 69.52 59.68 69.63 66.27667 64
 lm(V6~V2+V7,data=dubious)

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

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



Below is the csv file itself:

1 300 39.87 39.85 39.90 39.87333  9
2 400 45.16 45.23 45.17 45.18667 16
3 500 50.72 51.03 50.90 50.88333 25
4 600 56.85 56.80 57.02 56.89000 36
5 700 63.01 63.09 63.14 63.08000 49
6 800 69.52 59.68 69.63 66.27667 64

Enjoy! :)

__
R-help@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.


Re: [R] Inconsistent linear model calculations

2008-05-15 Thread Charilaos Skiadas

On May 15, 2008, at 5:37 PM, e-letter wrote:


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  V2V3V4V5   V6 V7
1  1 300 39.87 39.85 39.90 39.87333  9
2  2 400 45.16 45.23 45.17 45.18667 16
3  3 500 50.72 51.03 50.90 50.88333 25
4  4 600 56.85 56.80 57.02 56.89000 36
5  5 700 63.01 63.09 63.14 63.08000 49
6  6 800 69.52 69.82 69.63 69.65667 64


This is exactly why we asked you for a reproducible example and full  
code. That last entry in the V6 column is 69.65667 in this case, but  
66.27667 in the other cases. So you clearly are working with two  
slightly different dodgy files, and consequently two slightly  
different dubious data sets, and lm rightfully produces two slightly  
different accurate coefficients.


Haris Skiadas
Department of Mathematics and Computer Science
Hanover College


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


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

Coefficients:
(Intercept)   V2   V7
  2.553e+014.332e-021.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  V2V3V4V5   V6 V7
1  1 300 39.87 39.85 39.90 39.87333  9
2  2 400 45.16 45.23 45.17 45.18667 16
3  3 500 50.72 51.03 50.90 50.88333 25
4  4 600 56.85 56.80 57.02 56.89000 36
5  5 700 63.01 63.09 63.14 63.08000 49
6  6 800 69.52 59.68 69.63 66.27667 64

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


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

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





Below is the csv file itself:

1 300 39.87 39.85 39.90 39.87333  9
2 400 45.16 45.23 45.17 45.18667 16
3 500 50.72 51.03 50.90 50.88333 25
4 600 56.85 56.80 57.02 56.89000 36
5 700 63.01 63.09 63.14 63.08000 49
6 800 69.52 59.68 69.63 66.27667 64

Enjoy! :)



__
R-help@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.


Re: [R] Inconsistent linear model calculations

2008-05-15 Thread Rolf Turner


On 16/05/2008, at 9:44 AM, Charilaos Skiadas wrote:

This is exactly why we asked you for a reproducible example and  
full code. That last entry in the V6 column is 69.65667 in this  
case, but 66.27667 in the other cases. So you clearly are working  
with two slightly different dodgy files, and consequently two  
slightly different dubious data sets, and lm rightfully produces  
two slightly different accurate coefficients.


	Well spotted!!!  I stared and stared and was flummoxed as to what  
was going on.

Good eyes!

cheers,

Rolf Turner

##
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}

__
R-help@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.


Re: [R] Inconsistent linear model calculations

2008-05-15 Thread e-letter
Thank you to all you eagle eyes; amendment made accordingly and solved. Not
sure how the difference occurred...

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] Inconsistent linear model calculations

2008-05-15 Thread Kingsford Jones
Also, it's worth pointing out the reason for the numerical instability
of the parameter estimates: the predictors are nearly collinear.

 (dubious - read.table('clipboard'))
  V1  V2V3V4V5   V6 V7
1  1 300 39.87 39.85 39.90 39.87333  9
2  2 400 45.16 45.23 45.17 45.18667 16
3  3 500 50.72 51.03 50.90 50.88333 25
4  4 600 56.85 56.80 57.02 56.89000 36
5  5 700 63.01 63.09 63.14 63.08000 49
6  6 800 69.52 59.68 69.63 66.27667 64
 round(cor(dubious), 3)
  V1V2V3V4V5V6V7
V1 1.000 1.000 0.999 0.951 0.999 0.997 0.991
V2 1.000 1.000 0.999 0.951 0.999 0.997 0.991
V3 0.999 0.999 1.000 0.942 1.000 0.995 0.996
V4 0.951 0.951 0.942 1.000 0.943 0.970 0.912
V5 0.999 0.999 1.000 0.943 1.000 0.995 0.995
V6 0.997 0.997 0.995 0.970 0.995 1.000 0.983
V7 0.991 0.991 0.996 0.912 0.995 0.983 1.000


Note that the correlation for V2 and V7 is about .991


Kingsford Jones


On Thu, May 15, 2008 at 3:01 PM, e-letter [EMAIL PROTECTED] wrote:
 Thank you to all you eagle eyes; amendment made accordingly and solved. Not
 sure how the difference occurred...

[[alternative HTML version deleted]]

 __
 R-help@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.


__
R-help@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.