Advertisement
Guest User

Untitled

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