I'm a beginner at statistics. Currently attending an introductory course, which uses spss. I've been trying to learn r at the same time, and so far I've consistently been getting the same results, for calculations with both tools, As expected.
However, we're currently doing correlations (Pearson's Rho
), and fitting linear models, and I'm consistently getting different results between R
and SPSS
.
The dataset is GSS2012.zip in this zip-file.
d = GSS2012$tolerance
e = GSS2012$age
f = GSS2012$polviews
g = GSS2012$educ
SPSS R std. error (SPSS)
intercept 6,694 7,29707726 0,623
e -0,031 -0,03130627 0,006
f -0,123 -0,20586503 0,072
g 0,411 0,40029541 0,033
Full, minimal working examples to get the results above, are found below.
I've tried different use="stuff"
for cor
; didn't make difference.
cor(d, e, use = "pairwise.complete.obs")
Full, minimal working example for lm
:
> library(haven)
> GSS2012 <- read_sav("full version/GSS2012.sav")
> lm(GSS2012$tolerance ~ GSS2012$age + GSS2012$polviews + GSS2012$educ, na.action="na.exclude", singular.ok = F)
Call:
lm(formula = GSS2012$tolerance ~ GSS2012$age + GSS2012$polviews +
GSS2012$educ, na.action = "na.exclude", singular.ok = F)
Coefficients:
(Intercept) GSS2012$age GSS2012$polviews GSS2012$educ
7.29708 -0.03131 -0.20587 0.40030
Nothing has so far given me the same values as SPSS
. ---Not that I know the latter are necessarily correct, I'd just like to replicate the results.
SPSS script:
DATASET ACTIVATE DataSet1.
REGRESSION
/MISSING LISTWISE
/STATISTICS COEFF OUTS R ANOVA
/CRITERIA=PIN(.05) POUT(.10)
/NOORIGIN
/DEPENDENT tolerance
/METHOD=ENTER age polviews educ.
Articles like these are probably related: link1; link2; link3, but I haven't been able to use the information therein to replicate the SPSS
data. (Again, R
might have more accurate results; I don't know. But I'm in "an SPSS
environment", and thus it would be good if I'd be able to get the same results for now :)