search for: phat_

Displaying 2 results from an estimated 2 matches for "phat_".

Did you mean: phat
2001 Feb 08
2
dnbinom(,size<1,)=0 (PR#842)
...om_ function(x,n,p){ gamma(x+n)/gamma(n)/gamma(x+1)*p^n * (1-p)^x } fn_ function(p){ r_ p[1] th_ p[2] ll _ -sum(x[1:max(kk)]*log(dnbinom(kk[-length(kk)],r,th))) - x[length(kk)]*log(1-pnbinom((max(kk)-1),r,th)) return(ll) } a_ nlm(fn,p=c(.9,.5),hes=T) est_ a$est phat_ c(dnbinom(kk[-length(kk)],est[1],est[2]), 1-pnbinom((max(kk)-1),est[1],est[2])) E_ n*phat chi2_ sum((x-E)^2/E) cat('Chi2 goodness-of-fit = ',chi2,'\n') cat('P-value=',1-pchisq(chi2,df=length(kk)-1-2),'\n') print(cbind(O=x,E=round(E,1),err=round((x-E)^2/E,1))...
2001 Feb 07
3
Goodness of fit to Poisson / NegBinomial
All, I have some data on parasites on apple leaves and want to do a goodness of fit test to a Poisson distribution. This seems to do it: mites <- c(rep(0,70), rep(1,38), rep(2,17), rep(3,10), rep(4,9), rep(5,3), rep(6,2), rep(7,1)) tab <- table(mites) NSU <- length(mites) N <-