Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- set.seed(123)
- data = rNBII(100,mu = 6,sigma=0.5) #generate NB1 data with mean mu=5 and variance (1+sigma)*mu = 9
- h0 = gamlss(data~1,family=PO) #null model: poisson
- h1 = gamlss(data~1,family=NBII) #alternative model: NB1/ODP
- df = h1$df.fit - h0$df.fit
- deviance = as.numeric(-2*logLik(h0) + 2*logLik(h1))
- p.value = pchisq(deviance,df,lower.tail=F)
- > p.value
- [1] 0.01429169 #reject the null model at > 95% confidence
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement