Description Usage Arguments Details Value Examples
Convert data frame of covariate values to a design matrix
1 | newdata_to_X(newdata, wide, intercept = TRUE)
|
newdata |
Data frame where each row is a vector of covariate values defining an alternative focus quantity. |
wide |
Wide model which includes these covariates. |
intercept |
Include an intercept as the first column. |
Numeric values can be supplied for factor levels that are character strings denoting numbers (like "1"
or "2"
).
"Design" matrix of covariate values defining alternative focuses, with factors expanded to their contrasts. This is in the form required by the X
argument of fic
, with one row per alternative focus. The columns correspond to coefficients in a linear-type model. For the built-in focus functions such as mean_normal
and prob_logistic
, these coefficients include an intercept, but user-written focuses may be written in such a way as not to require an intercept (as in the example in the "skew normal" vignette).
1 2 3 4 5 | bwt.glm <- glm(low ~ lwtkg + age + smoke + ftv, data=birthwt, family="binomial")
newdata <- data.frame(lwtkg=1, age=60, smoke=0, ftv="2+")
newdata_to_X(newdata, bwt.glm)
## See the Cox regression section of the main package vignette for another example.
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.