M_t <- vglm(cbind(y1, y2, y3, y4, y5, y6) ~ 1, trace = TRUE,
posbernoulli.t, data = Perom) # Has parallel.t = FALSE
coef(M_t, matrix = TRUE)
summary(M_t)
M_th.1 <- vglm(cbind(y1, y2, y3, y4, y5, y6) ~ sex + weight, trace = TRUE,
posbernoulli.t, data = Perom) # Has parallel.t = FALSE
summary(M_th.1)
head(depvar(M_th.1)) # Response capture history matrix
dim(depvar(M_th.1))
M_h.2 <- vglm(cbind(y1, y2, y3, y4, y5, y6) ~ sex + weight, trace = TRUE,
posbernoulli.t(parallel.t = TRUE), data = Perom)
lrtest(M_th.1, M_h.2) # Test the parallelism assumption
coef(M_h.2)
coef(M_h.2, matrix = TRUE)
constraints(M_h.2, matrix = TRUE)
summary(M_h.2)
head(model.matrix(M_h.2, type = "vlm"), 21)
M_h.2@extra$N.hat # Estimate of the population size; should be about N
M_h.2@extra$SE.N.hat # SE of the estimate of the population size
# An approximate 95 percent confidence interval:
round(M_h.2@extra$N.hat + c(-1, 1) * 1.96 * M_h.2@extra$SE.N.hat, 1)
# Fit (effectively) the parallel model using posbinomial()
Perom <- transform(Perom, ysum = y1 + y2 + y3 + y4 + y5 + y6,
tau = 6)
M_h.3 <- vglm(cbind(ysum, tau - ysum) ~ sex + weight,
posbinomial, data = Perom, trace = TRUE)
max(abs(coef(M_h.2) - coef(M_h.3))) # Should be zero
logLik(M_h.3) - logLik(M_h.2) # Difference is due to the binomial constants
Run the code above in your browser using DataLab