Reputation: 21
I am trying to run a stepwise analysis on a negative binomial model with many factors:
step(glm.nb(totphy~lat+long+elev+cult+poll+blkage+canden+irr+dust+dustcon+mid+herb+miteprob+ermprob+tsmprob+mcdprob+brprob+armprob+mitapp+acra+agri+carz+envi+fujim+next+vend+zeal+cover+orchtype+pestint+mating+ties+rimon+igr+lime+naa+sevin+land+area+ermpres+tsmpres+mcdpres+armpres+zmalipres+ltemp+lmaxtemp+lmintemp+ldewp+lrh+lwindsp+lwinddir+lsolar+lprecip+lleaf+lsoil,data=mites), direction="forward", criterion=aic)
This code works if I only include the variables up to "fujim", adding more variables causes this error:
Error in eval(expr, envir, enclos) :
no loop for break/next, jumping to top level
I am fairly unfamiliar with R, so what does this mean?
Upvotes: 2
Views: 1960
Reputation: 765
As Karl Forner points, the problem is probably on a variable called "next", so just rename it. Check the following code:
# Data
data=data.frame("y"=rnorm(10),"x"=rnorm(10),"next"=1:10)
# Error
lm("y~x+next",data=data)
# Good
colnames(data)[3]="mod.next"
lm("y~x+mod.next",data=data)
Upvotes: 3