# NOT RUN {
## Model and focus from the main vignette
wide.glm <- glm(low ~ lwtkg + age + smoke + ht + ui +
smokeage + smokeui, data=birthwt, family=binomial)
vals.smoke <- c(1, 58.24, 22.95, 1, 0, 0, 22.95, 0)
vals.nonsmoke <- c(1, 59.50, 23.43, 0, 0, 0, 0, 0)
X <- rbind("Smokers" = vals.smoke, "Non-smokers" = vals.nonsmoke)
prob_logistic(coef(wide.glm), X=X)
prob_logistic_deriv(coef(wide.glm), X=X)
## Mean mpg for a particular covariate category in the Motor Trend data
## See the "fic" linear models vignette for more detail
wide.lm <- lm(mpg ~ am + wt + qsec + disp + hp, data=mtcars)
cmeans <- colMeans(model.frame(wide.lm)[,c("wt","qsec","disp","hp")])
X <- rbind(
"auto" = c(intercept=1, am=0, cmeans),
"manual" = c(intercept=1, am=1, cmeans)
)
mean_normal(coef(wide.lm), X)
mean_normal_deriv(coef(wide.lm), X)
# }
Run the code above in your browser using DataCamp Workspace