[R] Different result of multiple regression in R and SPSS

Bert Gunter gunter.berton at gene.com
Wed Jul 20 00:11:48 CEST 2011

Answer: Contrasts, i.e. the parameterization of the categorical variable(s) df.

?contrasts may be of some help, but you really need to do some
background studying of the linear models principles involved. Googling
may provide tutorials. Also searching the mail archives, e.g.:


-- Bert

On Tue, Jul 19, 2011 at 2:39 PM, J. <seoulseoulseoul at gmail.com> wrote:
> Hi, I am trying to do a simple multiple regression analysis that has one
> nominal variable (gender) and three numeric variables as independent
> variables and one numeric variable as dependent variable.
> So, I got a formula like this:
> summary(out.3 <- lm(scale(DV) ~  gender + scale(IV.1) + scale(IV.2) +
> scale(IV.3))
> I tried to compare the outcome in R with the outcome in SPSS and found the
> results are different!
> I found that R and SPSS have the exact same outcome when every variable is
> numeric; however, whenever I included "gender (0/1)" variable in the
> equation, the result become different.
> I guess that SPSS automatically treat gender as a numeric variable and
> standardize it when running analysis. So, I tried to change "gender" to a
> numeric variable and ran analysis but the results were still not identical.
> What is the problem here and what is the right way to do this analysis?
> Thanks,
> Jay Yang
> --
> View this message in context: http://r.789695.n4.nabble.com/Different-result-of-multiple-regression-in-R-and-SPSS-tp3679423p3679423.html
> Sent from the R help mailing list archive at Nabble.com.
> ______________________________________________
> 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.

"Men by nature long to get on to the ultimate truths, and will often
be impatient with elementary studies or fight shy of them. If it were
possible to reach the ultimate truths without the elementary studies
usually prefixed to them, these would not be preparatory studies but
superfluous diversions."

-- Maimonides (1135-1204)

Bert Gunter
Genentech Nonclinical Biostatistics

More information about the R-help mailing list