inst/HILBE_SCRIPTS/syn.geo.r

# syn.geo.r     Synthetic log-geometric regression
# Table 10.4: Hilbe, Negative Binomial Regression, 2 ed, Cambridge Univ Press 
library(MASS)
nobs <- 50000
x2 <- runif(nobs)
x1 <- runif(nobs)
xb <- 2*x1 - .5*x2 - 1   
exb <- exp(xb)               
xg <- rgamma(n = nobs, shape = 1, rate = 1) 
xbg <-exb*xg                 
gy <- rpois(nobs, xbg)      
gnb2 <-glm.nb(gy ~ x1 + x2)   
summary(gnb2)
gpy <- glm(gy ~ x1 + x2, family=poisson)
summary(gpy)

Try the COUNT package in your browser

Any scripts or data that you put into this service are public.

COUNT documentation built on May 2, 2019, 2:37 a.m.