Description Usage Arguments Value See Also Examples
Built-in focus functions and their derivatives
1 2 3 4 5 6 7 | prob_logistic(par, X)
prob_logistic_deriv(par, X)
mean_normal(par, X)
mean_normal_deriv(par, X)
|
par |
Vector of parameter estimates, including the intercept. |
X |
Vector or matrix of covariate values, including the intercept. This can either be a vector of length p, or a n x p matrix, where p is the number of covariate effects, and n is the number of alternative sets of covariate values at which the focus function is to be evaluated. |
prob_logistic
returns the probability of the outcome in a logistic regression model, and mean_normal
returns the mean outcome in a normal linear regression. The _deriv
functions return the vector of partial derivatives of the focus with respect to each parameter (or matrix, if there are multiple foci).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | ## 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.