Dear list, I am just starting on analysis of count data in R 3.4.0. My dataset was obtained from counting particles on a surface before andd after a cleaning process. The sampling positions on the surface are pre-defined and are the same before and after cleaning. I have ~20% of 0's. I want to know if the cleaning process was useful at reducing the number of particles. I first fit a negative binomial model using> nbFit<-glmer.nb(Count ~ Cleaning + (1|Sampling_point) , data = myCountDB)I now would like to add a curve to the histogram representing the negative binomial density function fitted to my data using> curve(dnbinom(x=, size=, prob=, mu=), add=TRUE)But I am struggling defining the arguments to dnbinom. Using the str() function on the nbFit object I see there are many fields returned. And I get lost reading the ?glmer.nb help, greatly because of my lack of knowledge. Which ones should I use? Thanks ever so much for your valuable help Dave [[alternative HTML version deleted]]
> On Oct 2, 2017, at 2:05 AM, David <dasolexa at hotmail.com> wrote: > > Dear list, > > > I am just starting on analysis of count data in R 3.4.0. My dataset was obtained from counting particles on a surface before andd after a cleaning process. The sampling positions on the surface are pre-defined and are the same before and after cleaning. I have ~20% of 0's. I want to know if the cleaning process was useful at reducing the number of particles. > > > I first fit a negative binomial model using > > >> nbFit<-glmer.nb(Count ~ Cleaning + (1|Sampling_point) , data = myCountDB) > > > > I now would like to add a curve to the histogram representing the negative binomial density function fitted to my data using > > >> curve(dnbinom(x=, size=, prob=, mu=), add=TRUE)Why not use the predict function in that package? See ?merMod -- David.> > > But I am struggling defining the arguments to dnbinom. > > > Using the str() function on the nbFit object I see there are many fields returned. And I get lost reading the ?glmer.nb help, greatly because of my lack of knowledge. Which ones should I use? > > > Thanks ever so much for your valuable help > > > Dave > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.David Winsemius Alameda, CA, USA 'Any technology distinguishable from magic is insufficiently advanced.' -Gehm's Corollary to Clarke's Third Law
Dear David, thanks ever so much for your answer. Do you mean predicting the original values based on the fitted model and then comparing observed vs. predicted by, for example, a scatterplot? Thanks, David ________________________________ De: David Winsemius <dwinsemius at comcast.net> Enviado: lunes, 2 de octubre de 2017 18:18:36 Para: David Cc: R-help Asunto: Re: [R] Help on adding a negative binomial density plot> On Oct 2, 2017, at 2:05 AM, David <dasolexa at hotmail.com> wrote: > > Dear list, > > > I am just starting on analysis of count data in R 3.4.0. My dataset was obtained from counting particles on a surface before andd after a cleaning process. The sampling positions on the surface are pre-defined and are the same before and after cleaning. I have ~20% of 0's. I want to know if the cleaning process was useful at reducing the number of particles. > > > I first fit a negative binomial model using > > >> nbFit<-glmer.nb(Count ~ Cleaning + (1|Sampling_point) , data = myCountDB) > > > > I now would like to add a curve to the histogram representing the negative binomial density function fitted to my data using > > >> curve(dnbinom(x=, size=, prob=, mu=), add=TRUE)Why not use the predict function in that package? See ?merMod -- David.> > > But I am struggling defining the arguments to dnbinom. > > > Using the str() function on the nbFit object I see there are many fields returned. And I get lost reading the ?glmer.nb help, greatly because of my lack of knowledge. Which ones should I use? > > > Thanks ever so much for your valuable help > > > Dave > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.David Winsemius Alameda, CA, USA 'Any technology distinguishable from magic is insufficiently advanced.' -Gehm's Corollary to Clarke's Third Law [[alternative HTML version deleted]]