This function computes the conditional probability of surviving later times than the last observed time for which a
longitudinal measurement was available.
a data frame that contains the longitudinal and covariate information for the subjects for which prediction
of survival probabilities is required. The names of the variables in this data frame must be the same as in the data frames that
were used to fit the linear mixed effects model (using lme()) and the survival model (using coxph() or survreg())
that were supplied as the two first argument of jointModel. In addition, this data frame should contain a variable
that identifies the different subjects (see also argument idVar).
idVar
the name of the variable in newdata that identifies the different subjects.
simulate
logical; if TRUE, a Monte Carlo approach is used to estimate survival probabilities. If FALSE,
a first order estimator is used instead. (see Details)
survTimes
a numeric vector of times for which prediction survival probabilities are to be computed.
last.time
a numeric vector or character string. This specifies the known time at which each of the subjects in newdat
was known to be alive. If NULL, then this is automatically taken as the last time each subject provided a longitudinal
measurement. If a numeric vector, then it is assumed to contain this last time point for each subject. If a character string, then
it should be a variable in the data frame newdata.
M
integer denoting how many Monte Carlo samples to use – see Details.
CI.levels
a numeric vector of length two that specifies which quantiles to use for the calculation of confidence interval for the
predicted probabilities – see Details.
scale
a numeric scalar that controls the acceptance rate of the Metropolis-Hastings algorithm – see Details.
...
additional arguments; currently none is used.
Details
Based on a fitted joint model (represented by object), and a history of longitudinal responses
tilde{y_i}(t) = {y_i(s), 0 ≤q s ≤q t} and a covariates vector x_i (stored in
newdata), this function provides estimates of Pr(T_i > u | T_i > t,
tilde{y}_i(t), x_i), i.e., the conditional probability of surviving time u given that subject i, with covariate information
x_i, has survived up to time t and has provided longitudinal the measurements tilde{y}_i(t).
To estimate Pr(T_i > u | T_i > t, tilde{y}_i(t), x_i) and if simulate = TRUE, a
Monte Carlo procedure is followed with the following steps:
Step 1:
Simulate new parameter values, say θ^*, from N(hat{θ}, C(hat{θ})),
where hat{θ} are the MLEs and C(hat{θ}) their large sample covariance matrix, which are extracted from
object.
Step 2:
Simulate random effects values, say b_i^*, from their posterior distribution given survival up to time t,
the vector of longitudinal responses \tilde{y}_i(t) and θ^*. This is achieved using a Metropolis-Hastings algorithm with
independent proposals from a properly centered and scaled multivariate t distribution. The scale argument controls the
acceptance rate for this algorithm.
Step 3
Using θ^* and b_i^*, compute Pr(T_i >
u | T_i > t, b_i^*, x_i; θ^*).
Step 4:
Repeat Steps 1-3 M times.
Based on the M estimates of the conditional probabilities, we compute useful summary statistics, such as their mean, median, and
quantiles (to produce a confidence interval).
If simulate = FALSE, then survival probabilities are estimated using the formula
Pr(T_i > u | T_i > t, hat{b}_i, x_i; hat{θ}),
where hat{θ} denotes the MLEs as above, and hat{b}_i
denotes the empirical Bayes estimates.
Value
A list of class survfitJM with components:
summaries
a list with elements numeric matrices with numeric summaries of the predicted probabilities for each subject.
survTimes
a copy of the survTimes argument.
last.time
a numeric vector with the time of the last available longitudinal measurement of each subject.
obs.times
a list with elements numeric vectors denoting the timings of the longitudinal measurements for each subject.
y
a list with elements numeric vectors denoting the longitudinal responses for each subject.
full.results
a list with elements numeric matrices with predicted probabilities for each subject in each replication of the Monte Carlo
scheme described above.
success.rate
a numeric vector with the success rates of the Metropolis-Hastings algorithm described above for each subject.
scale
a copy of the scale argument.
Note
Predicted probabilities are not computed for joint models with method = "ch-Laplace" and method = "Cox-PH-GH".
Rizopoulos, D. (2012) Joint Models for Longitudinal and Time-to-Event Data: with
Applications in R. Boca Raton: Chapman and Hall/CRC.
Rizopoulos, D. (2011). Dynamic predictions and prospective accuracy in joint models for longitudinal and time-to-event data.
Biometrics67, 819–829.
Rizopoulos, D. (2010) JM: An R Package for the Joint Modelling of Longitudinal and Time-to-Event Data.
Journal of Statistical Software35 (9), 1–33. http://www.jstatsoft.org/v35/i09/
See Also
jointModel, plot.survfitJM
Examples
# linear mixed model fit
fitLME <- lme(sqrt(CD4) ~ obstime + obstime:drug,
random = ~ 1 | patient, data = aids)
# cox model fit
fitCOX <- coxph(Surv(Time, death) ~ drug, data = aids.id, x = TRUE)
# joint model fit
fitJOINT <- jointModel(fitLME, fitCOX,
timeVar = "obstime", method = "weibull-PH-aGH")
# sample of the patients who are still alive
ND <- aids[aids$patient == "141", ]
ss <- survfitJM(fitJOINT, newdata = ND, idVar = "patient", M = 50)
ss
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(JM)
Loading required package: MASS
Loading required package: nlme
Loading required package: splines
Loading required package: survival
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/JM/survfitJM.Rd_%03d_medium.png", width=480, height=480)
> ### Name: survfitJM
> ### Title: Prediction in Joint Models
> ### Aliases: survfitJM survfitJM.jointModel
> ### Keywords: methods
>
> ### ** Examples
>
> # linear mixed model fit
> fitLME <- lme(sqrt(CD4) ~ obstime + obstime:drug,
+ random = ~ 1 | patient, data = aids)
> # cox model fit
> fitCOX <- coxph(Surv(Time, death) ~ drug, data = aids.id, x = TRUE)
>
> # joint model fit
> fitJOINT <- jointModel(fitLME, fitCOX,
+ timeVar = "obstime", method = "weibull-PH-aGH")
>
> # sample of the patients who are still alive
> ND <- aids[aids$patient == "141", ]
> ss <- survfitJM(fitJOINT, newdata = ND, idVar = "patient", M = 50)
> ss
Prediction of Conditional Probabilities for Event
based on 50 Monte Carlo samples
$`141`
times Mean Median Lower Upper
1 6.0000 1.0000 1.0000 1.0000 1.0000
1 6.0368 0.9962 0.9965 0.9938 0.9979
2 6.6553 0.9324 0.9373 0.8928 0.9628
3 7.2738 0.8701 0.8789 0.7983 0.9272
4 7.8924 0.8097 0.8214 0.7104 0.8913
5 8.5109 0.7513 0.7652 0.6292 0.8551
6 9.1294 0.6952 0.7106 0.5546 0.8189
7 9.7479 0.6416 0.6578 0.4866 0.7827
8 10.3665 0.5905 0.6069 0.4248 0.7466
9 10.9850 0.5421 0.5582 0.3690 0.7107
10 11.6035 0.4964 0.5116 0.3180 0.6753
11 12.2221 0.4533 0.4674 0.2726 0.6402
12 12.8406 0.4129 0.4256 0.2322 0.6057
13 13.4591 0.3752 0.3863 0.1967 0.5718
14 14.0776 0.3401 0.3490 0.1656 0.5387
15 14.6962 0.3075 0.3144 0.1385 0.5063
16 15.3147 0.2774 0.2823 0.1152 0.4748
17 15.9332 0.2496 0.2526 0.0952 0.4442
18 16.5518 0.2240 0.2251 0.0781 0.4145
19 17.1703 0.2006 0.1999 0.0637 0.3859
20 17.7888 0.1792 0.1769 0.0516 0.3584
21 18.4074 0.1597 0.1560 0.0415 0.3320
22 19.0259 0.1420 0.1372 0.0331 0.3067
23 19.6444 0.1259 0.1202 0.0262 0.2825
24 20.2629 0.1114 0.1047 0.0206 0.2596
25 20.8815 0.0983 0.0909 0.0161 0.2378
26 21.5000 0.0866 0.0785 0.0124 0.2172
>
>
>
>
>
> dev.off()
null device
1
>