if (FALSE) data("xs.nz", package = "VGAMdata")
fit1 <-
vglm(cbind(worry, worrier) ~ bs(age) + sex + ethnicity + cat + dog,
binom2.or(zero = NULL), data = xs.nz, trace = TRUE)
summary(fit1, HDEtest = FALSE) # 'cat' is not significant at all
dim(constraints(fit1, matrix = TRUE))
(tclist1 <- trim.constraints(fit1)) # No 'cat'
fit2 <- # Delete 'cat' manually from the formula:
vglm(cbind(worry, worrier) ~ bs(age) + sex + ethnicity + dog,
binom2.or(zero = NULL), data = xs.nz,
constraints = tclist1, trace = TRUE)
summary(fit2, HDEtest = FALSE) # A simplified model
dim(constraints(fit2, matrix = TRUE)) # Fewer regression coefficients
Run the code above in your browser using DataLab