[R] Help on adding a negative binomial density plot

David Winsemius dwinsemius at comcast.net
Mon Oct 2 18:18:36 CEST 2017


> 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



More information about the R-help mailing list