small.Huggins89.t1 <- transform(Huggins89.t1, Zedd = z1, Z2 = z2, Z3 = z3)
small.Huggins89.t1 <- subset(small.Huggins89.t1, y1 + y2 + y3 > 0)
# fit1 is the bottom equation on p.133, but this is only for the 1st 3 responses.
# Currently posbernoulli.tb() cannot handle more than 3 Bernoulli variates.
# The fit is not very good.
fit1 <-
vglm(cbind(y1, y2, y3) ~ x2 + Zedd,
xij = list(Zedd ~ z1 + z2 + z3 + Z2 + Z3 - 1),
posbernoulli.tb(parallel.t = TRUE), maxit = 155,
data = small.Huggins89.t1, trace = TRUE,
form2 = ~ x2 + Zedd + z1 + z2 + z3 + Z2 + Z3)
coef(fit1)
coef(fit1, matrix = TRUE) # M_t model
constraints(fit1)
summary(fit1)
fit1@extra$N.hat # Estimate of the population size N
fit1@extra$SE.N.hat # Its standard error
fit.t <- vglm(cbind(y1, y2, y3, y4, y5, y6, y7, y8, y9, y10) ~ x2,
posbernoulli.t, data = Huggins89.t1, trace = TRUE)
coef(fit.t)
coef(fit.t, matrix = TRUE) # M_t model
summary(fit.t)
fit.t@extra$N.hat # Estimate of the population size N
fit.t@extra$SE.N.hat # Its standard error
fit.b <- vglm(cbind(y1, y2, y3, y4, y5, y6, y7, y8, y9, y10) ~ x2,
posbernoulli.b, data = Huggins89.t1, trace = TRUE)
coef(fit.b)
coef(fit.b, matrix = TRUE) # M_b model
summary(fit.b)
fit.b@extra$N.hat
fit.b@extra$SE.N.hat
fit.0 <- vglm(cbind(y1, y2, y3, y4, y5, y6, y7, y8, y9, y10) ~ x2,
posbernoulli.b(parallel.b = TRUE), data = Huggins89.t1,
trace = TRUE)
coef(fit.0, matrix = TRUE) # M_0 model (version 1)
coef(fit.0)
summary(fit.0)
fit.0@extra$N.hat
fit.0@extra$SE.N.hat
Fit.0 <- vglm(cbind(y1, y2, y3, y4, y5, y6, y7, y8, y9, y10) ~ x2,
posbernoulli.t(parallel.t = TRUE), data = Huggins89.t1,
trace = TRUE)
coef(Fit.0)
coef(Fit.0, matrix = TRUE) # M_0 model (version 2)
summary(Fit.0)
Fit.0@extra$N.hat
Fit.0@extra$SE.N.hat
Run the code above in your browser using DataLab