inst/HILBE_SCRIPTS/nbr2_7_1.r

# nbr2_7_1.r   
# Table 7.1: Hilbe, Negative Binomial Regression, 2 ed, Cambridge Univ Press 
# Poisson with frequency table of observed counts

library(MASS)         
nobs <- 50000
x1 <- runif(nobs)
x2 <- runif(nobs)
x3 <- runif(nobs)
py <-rpois(nobs, exp(1 + 0.5*x1 - 0.75*x2 + 0.25*x3))
cnt <-  table(py)
df <- data.frame( prop.table( table(py) ) )
df$cumulative <- cumsum( df$Freq )
dfall <- data.frame(cnt, df$Freq, df$cumulative)
dfall

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.