get_terms | R Documentation |
This function basically creates a new df
from data
for
each term in terms
, creating a range from minimum and maximum of the
predict(fit, newdata=df, type="terms")
. Terms are then
stacked to a tidy data frame.
get_terms(data, fit, terms, ...)
data |
A data frame containing variables used to fit the model. Only first row will be used. |
fit |
A fitted object of class |
terms |
A character vector (can be length one). Specifies the terms for which partial effects will be returned |
... |
Further arguments passed to |
A tibble with 5 columns.
library(survival)
fit <- coxph(Surv(time, status) ~ pspline(karno) + pspline(age), data=veteran)
terms_df <- veteran %>% get_terms(fit, terms = c("karno", "age"))
head(terms_df)
tail(terms_df)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.