op <- options(digits = 4)
data("birds", package = "TH.data")
### fit count transformation model with cloglog link
m_birds <- cotram(SG5 ~ AOT + AFS + GST + DBH + DWC + LOG, data = birds,
method = "cloglog")
logLik(m_birds)
### classical likelihood inference
summary(m_birds)
### coefficients of the linear predictor (discrete hazard ratios)
exp(-coef(m_birds))
### compute predicted median along with 10% and 90% quantile for the first
### three observations
nd <- birds[1:3,]
round(predict(m_birds, newdata = nd, type = "quantile", prob = c(.1, .5, .9),
smooth = TRUE), 3)
### plot the predicted distribution for these observations
plot(m_birds, newdata = nd, type = "distribution",
col = c("skyblue", "grey", "seagreen"))
options(op)
Run the code above in your browser using DataLab