[R] Help on adding a negative binomial density plot
David Winsemius
dwinsemius at comcast.net
Tue Oct 3 18:15:05 CEST 2017
> On Oct 3, 2017, at 4:20 AM, David <dasolexa at hotmail.com> wrote:
>
> Dear David,
>
> thanks ever so much for your answer.
>
> Do you mean predicting the original values based on the fitted model
Yes.
> and then comparing observed vs. predicted by, for example, a scatterplot?
Not really sure what plot type would be most illuminating. You indicated your original plan was for a histogram, which made me think that either there were a large number of replicates at each point or you planned on aggregating the counts without regard for their locations, i.e. nature of the "Sampling_point" variable. There might be issues related to distances from edges or adjacency that might require a "spatial" treatment (for which packages are available). Also unclear was the number of different cleaning methods or cleaning intensities or cleaning durations, i.e. the structure of the "Cleaning" variable.
As always ... and as pointed out in the Posting Guide ... a complete description of the data structure (and size) of the problem, and an example dataset is most helpful in providing illustrations of code. This might also be more on-topic on the mixed models mailing list if it involves any tricky issues. If it just involves running the code, then this mailing list is probably adequate to the task.
And it's a plain text list so be warned that an html formatted version of a dataset will generally arrive in a mangled form to the list readership.
> > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
--
David.
>
> 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
> > 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