r - Negative binomial modelling error -


i have been asked lecturer fit negative binomial model data (looking @ distance patch of forest moth observations occurred @ different status groups (endemic, exotic, native).

my dataframe looked (n=2466):

id         native.exotic urban_non bush.distance scientific_name 12469         exotic         0             0     opodiphthera eucalypti 224769        native         1           170     agrotis ipsilon 251928        native         1           405     platyptilia falcatalis 524208        exotic         1          2010     ctenoplusia limbirena 

i advised use mass , run code

 m1 <- glm.nb(count ~ bush.distance*native.exotic, data=moth) drop1(m1, test="chisq") xv <- (with(moth, seq(from=min(bush.distance), max(bush.distance),  length.out=200))) newdat <- expand.grid(bush.distance=xv,  native.exotic=levels(moth$native.exotic)) newdat$fit <- predict(m1, newdata = newdat, type="response") + geom_line(data = newdat, aes(x=bush.distance, y=fit)) 

however, have no count variable. used melt convert data long format looks this:

dist  status   count    0  endemic  844    1  endemic  8    5  endemic  3   10  endemic  5 

but still when run code, result:

m1 <- glm.nb(count ~ dist*status, data=bush_status) error: no valid set of coefficients has been found: please supply starting values 

my knowledge of r super basic apologise if haven't explained appreciated. thanks!


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -