[R] difference in results from R vs SPSS

Chuck Cleland ccleland at optonline.net
Sat Jun 24 13:29:09 CEST 2006


Fiona Sammut wrote:
> Hi all,
> 
> 1.  I am doing some data analysis using both R and SPSS, to get used to 
> both software packages.  I had performed linear regression in R and SPSS 
> for a number of times before this last one and the resulting coefficient 
> values always matched.  However, this last data set I was analyzing 
> using simple linear regression and using the command lm(y~x), gave me 
> different readings from R and SPSS:
> 
> R:                y= 33.803 + 6.897x
> 
> SPSS:             y= 47.589 + 6.263x
> 
> I have no doubts regarding the procedure employed in SPSS and I am sure 
> I am using the same dataset for both software packages.

   My guess is you have missing values defined in SPSS but don't have 
those same values set to NA in R.  Have you requested basic descriptive 
statistics in both programs and found that they match?  Also, perhaps x 
a factor in R.  If so, how are its contrasts set?

> 2.  Correct me if I am wrong, but from what I've read, it seems that the 
> command /anova /in R works out an analysis of variance without including 
> the intercept.  Is that so?  Cause again I am working out an anova in R 
> and SPSS and I got different resulting sums of squares and different 
> degrees of freedom.  I thought this was because one package is working 
> with an intercept and the other isn't.

   I don't think this has anything to do with the discrepancy.

> Can anyone enlighten me as to what might have happened in both 1. and 2. 
> please?  Are they both due to my poor knowledge of R or could occurences 
> as above happen?
> 
> 
> 3.  I would like a reference to a command which can be used to fit a 
> distribution to a disrete distribution.

library(MASS)
?fitdistr

> Thanks in advance for your consideration.
> 
> - Fiona Sammut
> ------------------------------------------------------------------------
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

-- 
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894



More information about the R-help mailing list