# Five terms in this model: intercept and four covariates,
# but the covariate "ftv" is a factor with 3 levels,
# so there are six parameters
bwt.glm <- glm(low ~ lwtkg + age + smoke + ftv, data=birthwt, family="binomial")
## Convert indicator for terms to indicator for parameters
inds <- rbind(c(1,1,1,0,0),
c(1,1,1,1,1))
expand_inds(inds, bwt.glm)
Run the code above in your browser using DataLab