92
92
# ' percentiles will be provided.
93
93
# ' @param times A numeric vector of length 1 or a character string. Specifies the
94
94
# ' times at which to obtain the estimated survival probabilities.
95
- # ' If \code{newdata} is not provided , then the
95
+ # ' If \code{newdata} is \code{NULL} , then the
96
96
# ' \code{times} argument is optional; if it is not provided then \code{times}
97
97
# ' will default to the last known event or censoring time for each individual,
98
98
# ' whereas if it is provided then it must be a numeric vector of length 1, and
161
161
# '
162
162
# ' @seealso \code{\link{plot.survfit.stanjm}} for plotting the estimated survival
163
163
# ' probabilities, \code{\link{ps_check}} for for graphical checks of the estimated
164
- # ' survival function, and \code{\link{posterior_predict }} for estimating the
164
+ # ' survival function, and \code{\link{posterior_traj }} for estimating the
165
165
# ' marginal or subject-specific longitudinal trajectories.
166
166
# '
167
167
# ' @examples
168
168
# '
169
169
# ' # Run example model if not already loaded
170
- # ' if (!exists("examplejm ")) example(examplejm )
170
+ # ' if (!exists("example_jm ")) example(example_jm )
171
171
# '
172
172
# ' # Obtain subject-specific survival probabilities for a few
173
173
# ' # selected individuals in the estimation dataset who were
176
176
# ' # survival probabilities, that is, conditional on having survived
177
177
# ' # until the event or censoring time, and then by default will
178
178
# ' # extrapolate the survival predictions forward from there.
179
- # ' head(pbcSurv_subset[pbcSurv_subset $status == 0,])
180
- # ' ps1 <- posterior_survfit(examplejm , ids = c(7,13,16))
179
+ # ' head(pbcSurv[pbcSurv $status == 0,])
180
+ # ' ps1 <- posterior_survfit(example_jm , ids = c(7,13,16))
181
181
# ' head(ps1)
182
182
# ' # We can plot the estimated survival probabilities using the
183
183
# ' # associated plot function
193
193
# ' # is to specify that we want the survival time estimated at time 0
194
194
# ' # and then extrapolated forward 5 years. We also specify that we
195
195
# ' # do not want to condition on their last known survival time.
196
- # ' ps2 <- posterior_survfit(examplejm , ids = c(7,13,16), times == 0,
197
- # ' extrapolate = TRUE, control = list(ext_distance = 5, condition = FALSE))
196
+ # ' ps2 <- posterior_survfit(example_jm , ids = c(7,13,16), times == 0,
197
+ # ' extrapolate = TRUE, control = list(edist = 5, condition = FALSE))
198
198
# ' ps2
199
199
# '
200
200
# ' # Instead of estimating survival probabilities for a specific individual
215
215
# ' nd <- data.frame(id = c("new1", "new2"),
216
216
# ' sex = c("f", "f"),
217
217
# ' trt = c(1, 0))
218
- # ' ps3 <- posterior_survfit(examplejm , newdata = nd, times = 0,
219
- # ' extrapolate = TRUE, control = list(ext_distance = 5, condition = FALSE))
218
+ # ' ps3 <- posterior_survfit(example_jm , newdata = nd, times = 0,
219
+ # ' extrapolate = TRUE, control = list(edist = 5, condition = FALSE))
220
220
# ' ps3
221
221
# '
222
222
# ' # We can then plot the estimated survival functions to compare
229
229
# ' # for individuals in our estimation sample) then we can specify
230
230
# ' # 'standardise = TRUE'. We can then plot the resulting standardised
231
231
# ' # survival curve.
232
- # ' ps4 <- posterior_survfit(examplejm , standardise = TRUE,
232
+ # ' ps4 <- posterior_survfit(example_jm , standardise = TRUE,
233
233
# ' times = 0, extrapolate = TRUE)
234
234
# ' plot(ps4)
235
235
# '
@@ -482,16 +482,16 @@ posterior_survfit <- function(object, newdata = NULL, extrapolate = TRUE,
482
482
# ' It can also be passed to the function \code{\link{plot_stack}}.
483
483
# '
484
484
# ' @seealso \code{\link{posterior_survfit}}, \code{\link{plot_stack}},
485
- # ' \code{\link{posterior_predict }}, \code{\link{plot.predict.stanjm}}
485
+ # ' \code{\link{posterior_traj }}, \code{\link{plot.predict.stanjm}}
486
486
# '
487
487
# ' @examples
488
488
# '
489
489
# ' # Run example model if not already loaded
490
- # ' if (!exists("examplejm ")) example(examplejm )
490
+ # ' if (!exists("example_jm ")) example(example_jm )
491
491
# '
492
492
# ' # Obtain subject-specific conditional survival probabilities
493
493
# ' # for all individuals in the estimation dataset.
494
- # ' ps1 <- posterior_survfit(examplejm , extrapolate = TRUE)
494
+ # ' ps1 <- posterior_survfit(example_jm , extrapolate = TRUE)
495
495
# '
496
496
# ' # We then plot the conditional survival probabilities for
497
497
# ' # a subset of individuals
@@ -516,17 +516,16 @@ posterior_survfit <- function(object, newdata = NULL, extrapolate = TRUE,
516
516
# ' # subject-specific survival functions, with plot(s)
517
517
# ' # of the estimated longitudinal trajectories for the
518
518
# ' # same individuals
519
- # ' ps1 <- posterior_survfit(examplejm, ids = c(7,13,16))
520
- # ' pt1 <- posterior_predict(examplejm, , ids = c(7,13,16),
521
- # ' interpolate = TRUE, extrapolate = TRUE)
519
+ # ' ps1 <- posterior_survfit(example_jm, ids = c(7,13,16))
520
+ # ' pt1 <- posterior_traj(example_jm, , ids = c(7,13,16))
522
521
# ' plot_surv <- plot(ps1)
523
522
# ' plot_traj <- plot(pt1, vline = TRUE, plot_observed = TRUE)
524
523
# ' plot_stack(plot_traj, plot_surv)
525
524
# '
526
525
# ' # Lastly, let us plot the standardised survival function
527
526
# ' # based on all individuals in our estimation dataset
528
- # ' ps2 <- posterior_survfit(examplejm , standardise = TRUE, times = 0,
529
- # ' control = list(ext_points = 20))
527
+ # ' ps2 <- posterior_survfit(example_jm , standardise = TRUE, times = 0,
528
+ # ' control = list(epoints = 20))
530
529
# ' plot(ps2)
531
530
# '
532
531
# '
0 commit comments