[R] Help with "step()" function

Kenneth Cabrera krcabrer at epm.net.co
Wed Mar 22 01:03:27 CET 2006


Hi R users:

When I use this commands:
-------------------------------------------------------------
testData<-read.table("testData.dat",header=T)
model1J<-glm(MCHNV~offset(Offset1),data=testData,family="poisson")
step(model1J,direction="forward",
      scope=(list(upper=~IA+IM+altura+Region+Region:IA+Region:IM+Region:altura+offset(Offset1))))
-------------------------------------------------------------
(the "testData" (testData.dat) is attached to the e-mail to reproduce the
problem):
I got this error:
-------------------------------------------------------------
.
.
.
  MCHNV ~ Region + IA + altura + offset(Offset1)

                 Df Deviance     AIC
+ IA:Region      8   540.24 1377.73
+ IM             1   586.84 1410.32
+ altura:Region  8   574.21 1411.70
<none>               600.74 1422.23

Step:  AIC= 1377.73
  MCHNV ~ Region + IA + altura + Region:IA + offset(Offset1)

Error in factor.scope(ffac, list(add = fadd, drop = fdrop)) :
         upper scope does not include model
-------------------------------------------------------------

What am I doing wrong?

I try also with:

step(model1J,direction="forward",
      scope=(list(upper=~IA+IM+altura+Region+IA:Region+Region:IM+Region:altura+offset(Offset1))))

and with

step(model1J,direction="forward",
      scope=(list(upper=~IA+IM+altura+Region+IA:Region+Region:IA+Region:IM+Region:altura+offset(Offset1))))

I got the same message

Thank you for your help.

Kenneth


More information about the R-help mailing list