[R] Step.glm() question

Smith, Phil pzs6 at CDC.GOV
Tue Jan 17 21:41:26 CET 2006


Hi:

I am using step.glm() as follows:

form1 	<- 	as.formula(haspdata ~ 1)
lg.mod1 	<- 	glm ( formula=form1, data=st.mtx,
family=binomial , na.action=na.omit ) 

upper		<-	as.formula( haspdata ~ (
c5+childnm+educ1+incpov1+marital+msa+racekid+racemom+sex+shotcard )^2)
lower		<-	as.formula(haspdata~1)
lst		<-	list( upper=upper , lower=lower )
form1a.step	<-	step(lg.mod1, scope=lst , trace=T ,
direction="both" )

I get the following error message in R: 

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

Because I am trying to migrate from Splus to R, I ran that same code in
Splus and do not get an error.

Could someone please tell me:
	1) what I'm doing wrong in R, and
	2) what the distinction between R and Splus is in this case.

Thank you,

Philip J. Smith, PhD
Centers for Disease Control and Prevention
National Immunization Program
Immunization Services Division
MS E-32
1600 Clifton Road, NE
Atlanta, GA 30333
ph: 404 639 8729
fax: 404 639 3266
pzs6 at cdc.gov




More information about the R-help mailing list