[R] Analogue to SPSS regression commands ENTER and REMOVE in R?

Ista Zahn istazahn at gmail.com
Thu Mar 4 17:14:08 CET 2010


Hi Dimitri,
It works a bit differently:

## The SPSS way:
compute dum1 = 0.
compute dum2 = 0.
if(grp = "b") dum1 = 1.
if(grp = "c") dum2 = 1.
exe.

regression
  /var = y x1 x2 z1 z2 grp
  /des = def
  /sta = def zpp cha tol f
  /dep = y
  /met = enter x1 x2
  /met = enter z1 z2
  /met = enter dum1 dum2.

## The R way:
contrasts(Dat$grp) <- contr.treatment(n=3, base=1)

m.x <- lm(y ~ x1 + x2, data=Dat)
m.xz <- update(m.x, . ~ . + z1 + z2)
m.xzg <- update(m.xz, . ~ . + grp)
anova(m.x, m.xz, m.xzg)

Hope it helps,
Ista

On Thu, Mar 4, 2010 at 10:47 AM, Dimitri Liakhovitski <ld7631 at gmail.com> wrote:
> I am not sure if this question has been asked before - but is there a
> procedure in R (in lm or glm?) that is equivalent to ENTER and REMOVE
> regression commands in SPSS?
> Thanks a lot!
>
> --
> Dimitri Liakhovitski
> Ninah.com
> Dimitri.Liakhovitski at ninah.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.
>



-- 
Ista Zahn
Graduate student
University of Rochester
Department of Clinical and Social Psychology
http://yourpsyche.org



More information about the R-help mailing list