r - Issues plotting count distribution displot() -


i have count data. i'm trying document decision use negative binomial distribution rather poisson (i couldn't quasi-poisson dist. in lme4) , having graphical issues (the vector appended end of post). i've been trying implement distplot() function inform decision distribution model:

here's outcome variable (physician count): plot(d1.2$totalmds)physician count

which might poisson
enter image description here
mean , variance aren't close (the variance doubled 2 extreme values; still not anywhere near mean)

> var(d1.2$totalmds, na.rm = t) [1] 114240.7 > mean(d1.2$totalmds, na.rm = t) [1] 89.3121 

my outcome partly population driven i'm using total population offset variable in preliminary models. this, understand it, divides outcome natural log of offset variable totalmds/log(poptotal) what's being modeled. looks like:
enter image description here

but when try model using:
plot 1: distplot(x = d1.2$totalmds, type = "poisson")
plot 2: distplot(x = d1.2$totalmds, type = "nbinomial") # looks way off enter image description here enter image description here

plot 3: plot(fitdist(data = d1.2$totalmds, distr = "pois", method = "mle"))
plot 4: plot(fitdist(data = d1.2$totalmds, distr = "nbinom", method = "mle")) # throws warnings enter image description here enter image description here

plot 5: qqcomp(fitdist(data = d1.2$totalmds, distr = "pois", method = "mle"))
plot 6: qqcomp(fitdist(data = d1.2$totalmds, distr = "nbinom", method = "mle")) # throws warnings enter image description here enter image description here

does have suggestions why following plots little screwy/inconsistent?

as mentioned i'm using variable offset variable in actual analysis, if makes difference.

here's vector: https://gist.github.com/timothyslau/f95a777b713eb33a2fe6

i'm sure nb better poisson since var(d1.2$totalmds)/mean(d1.2$totalmds) # variance-to-mean ratio (vmr) > 1

but if nb appropriate plots should lot cleaner (i think, unless i'm doing wrong these plotting functions/packages).


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -