tidy.risks {risks} | R Documentation |
Tidy model summaries for risks models
Description
Obtain a tibble (data frame) with parameters, coefficients, standard errors, confidence limits, and p-values. A column with the type of model fitted is added.
Usage
## S3 method for class 'risks'
tidy(
x,
conf.int = TRUE,
conf.level = 0.95,
bootrepeats = 1000,
bootci = c("bca", "normal", "nonpar"),
bootverbose = FALSE,
exponentiate = FALSE,
default = TRUE,
...
)
Arguments
x |
Model |
conf.int |
Show confidence intervals? |
conf.level |
Optional. Confidence level. Defaults to |
bootrepeats |
Optional. Number of bootstrap repeats.
Applicable to models fitted via marginal standardization and bootstrapping
( |
bootci |
Optional and applicable for
|
bootverbose |
Optional. Add values of |
exponentiate |
Optional. Exponentiate coefficients and confidence
limits? Defaults to FALSE. Setting |
default |
Use default, normality-based confidence intervals?
Defaults to TRUE. With |
... |
Passed on |
Details
If multiple types of models are fitted, tidy()
can be used
to parameters for all models at once, in one tibble. The last
column of the tibble includes the name of the model. See examples.
Value
tibble
Examples
# Define example data
library(broom) # provides tidy() function
dat <- tibble::tibble(
death = c(rep(1, 54), rep(0, 138)),
stage = c(rep("Stage I", 7), rep("Stage II", 26), rep("Stage III", 21),
rep("Stage I", 60), rep("Stage II", 70), rep("Stage III", 8)),
receptor = c(rep("Low", 2), rep("High", 5), rep("Low", 9), rep("High", 17),
rep("Low", 12), rep("High", 9), rep("Low", 10), rep("High", 50),
rep("Low", 13), rep("High", 57), rep("Low", 2), rep("High", 6)))
# Fit and tidy the model
fit_rr <- riskratio(formula = death ~ stage + receptor, data = dat)
tidy(fit_rr)
# Marginal standardization,
# increase number of bootstrap repeats:
fit_rr <- riskratio(
formula = death ~ stage + receptor, data = dat,
approach = "margstd_boot")
tidy(fit_rr, bootrepeats = 2000)
# Multiple types of models fitted:
fit_rr <- riskratio(formula = death ~ stage + receptor, data = dat,
approach = "all")
tidy(fit_rr)