An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20090217/a7a88d6b/attachment-0001.pl>
using stepAIC with negative binomial regression - error message help
2 messages · Tim Clark, Ben Bolker
t c <mudiver1200 <at> yahoo.com> writes:
Dear List, I am having problems running stepAIC with a negative binomial regression model.? I am working with data on manta ray abundance, using 20 predictor variables.?
[snip] The model I ran was:
glm.nb.full<glm.nb(mantas~site+year+
cosday+sinday+daylength+ lunarpercent+sstmean+sststd+
sshmean+sshstd+cosdir+sindir+spd+
temp+alt+tideht+high+falling+low+plankton)
? However, when I use stepAIC on the model I get the message: ?
stepAIC(glm.nb.full)
Start:? AIC=19240.46 mantas ~ site + year + cosday + sinday + daylength + lunarpercent + ??? sstmean + sststd + sshmean + sshstd + cosdir + sindir + spd + ??? temp + alt + tideht + high + falling + low + plankton ? Error in dropterm.default(object, ...) : ? number of rows in use has changed: remove missing values?
Yes. As the note in ?stepAIC says,
The model fitting must apply the models to the same dataset. This
may be a problem if there are missing values and an 'na.action'
other than 'na.fail' is used (as is the default in R). We suggest
you remove the missing values first.
The easiest way to remove missing values is with na.omit, e.g.
fullmod <- glm.nb(..., data=na.omit(mydata))
stepAIC(fullmod)
aren't cosday, sinday, and daylength pretty strongly collinear ... ?
Ben Bolker