[R] Help with replicating an old SPSS GLM analysis

John Fox jfox at mcmaster.ca
Thu Feb 7 19:42:13 CET 2002


Dear Andrew,

It's difficult to know from your description what the nature of the model 
is that you're trying to fit, and (2) what the problem is -- that is, what 
is the difference between the SPSS and R output: coefficients, sums of squares?

But the following points might help:

(1) GLM in SPSS fits linear models, so it is closer to lm in R than to glm, 
which fits *generalized* linear models.

(2) Because the predictors in the SPSS GLM procedure follow the keyword 
WITH they are (I assume) covariates rather than factors. What is the nature 
of these variables?

(3) The asterisks in the R model specification do not have the same meaning 
as in SPSS. In R, the asterisks produce an interaction plus all effects 
marginal to the interaction. With covariates, the interactions will just be 
products.

(4) Despite these problems, I don't see why the coefficient estimates 
should differ: Because you leave the family unspecified in the call to R 
glm, you'll get a linear model; specifying the terms marginal to the 
interactions in the model is redundant but not wrong.

If you supply some more information, maybe I or someone else can figure out 
what's wrong.

John

At 09:18 PM 2/6/2002 -0500, Andrew Perrin wrote:

>I'm trying to replicate an analysis I did a few years ago, then in SPSS,
>using the SPSS GLM command:
>
>GLM
>   n_diffpt  WITH age_i inc_i join_i work_i educ_i  give_i cs_i
>   eff_i age_a inc_a join_a work_a educ_a give_a cs_a eff_a
>   /METHOD = SSTYPE(3)
>   /INTERCEPT = INCLUDE
>   /PRINT  = PARAMETER ETASQ RSSCP GEF
>   /CRITERIA = ALPHA(.05)
>   /DESIGN =
>         age_i*age_a inc_i*inc_a join_i*join_a work_i*work_a
>           educ_i*educ_a give_i*give_a cs_i*cs_a eff_i*eff_a
>         age_i inc_i join_i work_i educ_i give_i cs_i eff_i
>         age_a inc_a join_a work_a educ_a give_a cs_a eff_a .
>
>The results are consistent when run in SPSS; however, I tried the simple
>version of recoding it in R (after using read.spss to bring in the data),
>and got entirely different results. I'm assuming there are significant
>differences in what I'm doing, but I can't find enough documentation of
>the SPSS GLM procedure to figure out what. Can anyone offer insights?
>
>The code I tried under R was:
>
>glm.mean <- glm(N.DIFFPT ~ AGE.I + INC.I + JOIN.I + WORK.I + EDUC.I +
>GIVE.I +
>         CS.I + EFF.I + AGE.A + INC.A + JOIN.A + WORK.A + EDUC.A + GIVE.A +
>         CS.A + EFF.A + AGE.I*AGE.A + INC.I*INC.A + JOIN.I*JOIN.A +
>         WORK.I*WORK.A + EDUC.I*EDUC.A + GIVE.I*GIVE.A + CS.I*CS.A +
>         EFF.I*EFF.A,
>         data=acps.df)

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list