[datatable-help] glm error when modeling in negative binomial regression

paulite paulaveronica at gmail.com
Mon Feb 26 01:14:46 CET 2018


Hi there! I am running this model in negative binomial regression, using
glm.I had no problems with running the model with a set of data, but now
that i'm trying to run if for new one.  I always have this same error when
running the regression:>         > #Run Regression>    
x=cbind(factor2ind(d$year),factor2ind(d$month_week))>     >     out<-
glm(cbind(influenza, n_sample) ~ x, family=quasibinomial, data=d)>     >    
d$prop<-out$fitted.values*/Error in `$<-.data.frame`(`*tmp*`, prop, value =
c(0.0486530542835839,  :   replacement has 208 rows, data has 365/*>    
d$n_p1<-d$prop*d$factor*10>     >     obs<-aggregate(d$prop, by =
list(d$month_week), FUN=summary)>     pred<-aggregate(d$n_p1, by =
list(d$month_week), FUN=summary)> By the way, I previously prepared the data
set  and defined that:       d$factor<-sapply(d$year,f)>        
d$n_sample<-(d$n_muestras*d$factor*10)>        
d$prop<-(d$influenza/d$n_sample)But I still don't understand why it keeps
saying that dataframe has less replacements than rows. Could anybody help me
with this? Many thankss!!!P



--
Sent from: http://r.789695.n4.nabble.com/datatable-help-f2315188.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/datatable-help/attachments/20180225/863e6df7/attachment.html>


More information about the datatable-help mailing list