| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/joinerml.R |
| 3 |
\name{tidy.mjoint} |
| 4 |
\alias{tidy.mjoint} |
| 5 |
\alias{mjoint_tidiers} |
| 6 |
\alias{joinerml_tidiers} |
| 7 |
\title{Tidy a(n) mjoint object} |
| 8 |
\usage{ |
| 9 |
\method{tidy}{mjoint}( |
| 10 |
x, |
| 11 |
component = "survival", |
| 12 |
conf.int = FALSE, |
| 13 |
conf.level = 0.95, |
| 14 |
boot_se = NULL, |
| 15 |
... |
| 16 |
) |
| 17 |
} |
| 18 |
\arguments{ |
| 19 |
\item{x}{An \code{mjoint} object returned from \code{\link[joineRML:mjoint]{joineRML::mjoint()}}.} |
| 20 |
|
| 21 |
\item{component}{Character specifying whether to tidy the survival or |
| 22 |
the longitudinal component of the model. Must be either \code{"survival"} or |
| 23 |
\code{"longitudinal"}. Defaults to \code{"survival"}.} |
| 24 |
|
| 25 |
\item{conf.int}{Logical indicating whether or not to include a confidence |
| 26 |
interval in the tidied output. Defaults to \code{FALSE}.} |
| 27 |
|
| 28 |
\item{conf.level}{The confidence level to use for the confidence interval |
| 29 |
if \code{conf.int = TRUE}. Must be strictly greater than 0 and less than 1. |
| 30 |
Defaults to 0.95, which corresponds to a 95 percent confidence interval.} |
| 31 |
|
| 32 |
\item{boot_se}{Optionally a \code{bootSE} object from \code{\link[joineRML:bootSE]{joineRML::bootSE()}}. If |
| 33 |
specified, calculates confidence intervals via the bootstrap. Defaults to |
| 34 |
\code{NULL}, in which case standard errors are calculated from the |
| 35 |
empirical information matrix.} |
| 36 |
|
| 37 |
\item{...}{Additional arguments. Not used. Needed to match generic |
| 38 |
signature only. \strong{Cautionary note:} Misspelled arguments will be |
| 39 |
absorbed in \code{...}, where they will be ignored. If the misspelled |
| 40 |
argument has a default value, the default value will be used. |
| 41 |
For example, if you pass \code{conf.lvel = 0.9}, all computation will |
| 42 |
proceed using \code{conf.level = 0.95}. Two exceptions here are: |
| 43 |
\itemize{ |
| 44 |
\item \code{tidy()} methods will warn when supplied an \code{exponentiate} argument if |
| 45 |
it will be ignored. |
| 46 |
\item \code{augment()} methods will warn when supplied a \code{newdata} argument if it |
| 47 |
will be ignored. |
| 48 |
}} |
| 49 |
} |
| 50 |
\description{ |
| 51 |
Tidy summarizes information about the components of a model. |
| 52 |
A model component might be a single term in a regression, a single |
| 53 |
hypothesis, a cluster, or a class. Exactly what tidy considers to be a |
| 54 |
model component varies across models but is usually self-evident. |
| 55 |
If a model has several distinct types of components, you will need to |
| 56 |
specify which components to return. |
| 57 |
} |
| 58 |
\examples{ |
| 59 |
\dontshow{if (rlang::is_installed("joineRML")) withAutoprint(\{ # examplesIf} |
| 60 |
|
| 61 |
# broom only skips running these examples because the example models take a |
| 62 |
# while to generate—they should run just fine, though! |
| 63 |
\dontrun{ |
| 64 |
|
| 65 |
|
| 66 |
# load libraries for models and data |
| 67 |
library(joineRML) |
| 68 |
|
| 69 |
# fit a joint model with bivariate longitudinal outcomes |
| 70 |
data(heart.valve) |
| 71 |
|
| 72 |
hvd <- heart.valve[!is.na(heart.valve$log.grad) & |
| 73 |
!is.na(heart.valve$log.lvmi) & |
| 74 |
heart.valve$num <= 50, ] |
| 75 |
|
| 76 |
fit <- mjoint( |
| 77 |
formLongFixed = list( |
| 78 |
"grad" = log.grad ~ time + sex + hs, |
| 79 |
"lvmi" = log.lvmi ~ time + sex |
| 80 |
), |
| 81 |
formLongRandom = list( |
| 82 |
"grad" = ~ 1 | num, |
| 83 |
"lvmi" = ~ time | num |
| 84 |
), |
| 85 |
formSurv = Surv(fuyrs, status) ~ age, |
| 86 |
data = hvd, |
| 87 |
inits = list("gamma" = c(0.11, 1.51, 0.80)), |
| 88 |
timeVar = "time" |
| 89 |
) |
| 90 |
|
| 91 |
# extract the survival fixed effects |
| 92 |
tidy(fit) |
| 93 |
|
| 94 |
# extract the longitudinal fixed effects |
| 95 |
tidy(fit, component = "longitudinal") |
| 96 |
|
| 97 |
# extract the survival fixed effects with confidence intervals |
| 98 |
tidy(fit, ci = TRUE) |
| 99 |
|
| 100 |
# extract the survival fixed effects with confidence intervals based |
| 101 |
# on bootstrapped standard errors |
| 102 |
bSE <- bootSE(fit, nboot = 5, safe.boot = TRUE) |
| 103 |
tidy(fit, boot_se = bSE, ci = TRUE) |
| 104 |
|
| 105 |
# augment original data with fitted longitudinal values and residuals |
| 106 |
hvd2 <- augment(fit) |
| 107 |
|
| 108 |
# extract model statistics |
| 109 |
glance(fit) |
| 110 |
} |
| 111 |
\dontshow{\}) # examplesIf} |
| 112 |
} |
| 113 |
\seealso{ |
| 114 |
\code{\link[=tidy]{tidy()}}, \code{\link[joineRML:mjoint]{joineRML::mjoint()}}, \code{\link[joineRML:bootSE]{joineRML::bootSE()}} |
| 115 |
|
| 116 |
Other mjoint tidiers: |
| 117 |
\code{\link{glance.mjoint}()} |
| 118 |
} |
| 119 |
\concept{mjoint tidiers} |
| 120 |
\value{ |
| 121 |
A \code{\link[tibble:tibble]{tibble::tibble()}} with columns: |
| 122 |
\item{conf.high}{Upper bound on the confidence interval for the estimate.} |
| 123 |
\item{conf.low}{Lower bound on the confidence interval for the estimate.} |
| 124 |
\item{estimate}{The estimated value of the regression term.} |
| 125 |
\item{p.value}{The two-sided p-value associated with the observed statistic.} |
| 126 |
\item{statistic}{The value of a T-statistic to use in a hypothesis that the regression term is non-zero.} |
| 127 |
\item{std.error}{The standard error of the regression term.} |
| 128 |
\item{term}{The name of the regression term.} |
| 129 |
|
| 130 |
} |