## Not run:
# # Example 1: simulated data
# nTimePts <- 5 # (aka tau == # of sampling occasions)
# nnn <- 1000 # Number of animals
# pdata <- rposbern(n = nnn, nTimePts = nTimePts, pvars = 2)
# dim(pdata); head(pdata)
#
# M_tbh.1 <- vglm(cbind(y1, y2, y3, y4, y5) ~ x2,
# posbernoulli.tb, data = pdata, trace = TRUE)
# coef(M_tbh.1) # First element is the behavioural effect
# coef(M_tbh.1, matrix = TRUE)
# constraints(M_tbh.1, matrix = TRUE)
# summary(M_tbh.1, presid = FALSE) # Standard errors are approximate
# head(fitted(M_tbh.1))
# head(model.matrix(M_tbh.1, type = "vlm"), 21)
# dim(depvar(M_tbh.1))
#
# M_tbh.2 <- vglm(cbind(y1, y2, y3, y4, y5) ~ x2,
# posbernoulli.tb(parallel.t = FALSE ~ 0),
# data = pdata, trace = TRUE)
# coef(M_tbh.2) # First element is the behavioural effect
# coef(M_tbh.2, matrix = TRUE)
# constraints(M_tbh.2, matrix = TRUE)
# summary(M_tbh.2, presid = FALSE) # Standard errors are approximate
# head(fitted(M_tbh.2))
# head(model.matrix(M_tbh.2, type = "vlm"), 21)
# dim(depvar(M_tbh.2))
#
# # Example 2: deermice subset data
# fit1 <- vglm(cbind(y1, y2, y3, y4, y5, y6) ~ sex + weight,
# posbernoulli.t, data = deermice, trace = TRUE)
# coef(fit1)
# coef(fit1, matrix = TRUE)
# constraints(fit1, matrix = TRUE)
# summary(fit1, presid = FALSE) # Standard errors are approximate
#
# # fit1 is the same as Fit1 (a M_{th} model):
# Fit1 <- vglm(cbind(y1, y2, y3, y4, y5, y6) ~ sex + weight,
# posbernoulli.tb(drop.b = TRUE ~ sex + weight,
# parallel.t = TRUE), # No parallelism for the intercept
# data = deermice, trace = TRUE)
# constraints(Fit1)
# ## End(Not run)
Run the code above in your browser using DataLab