plot.emfrail: Plots for emfrail objects

Description Usage Arguments Value See Also Examples

View source: R/plot.emfrail.R

Description

Plots for emfrail objects

Usage

1
2
3
4
5
## S3 method for class 'emfrail'
plot(x, type = c("hist", "hr", "pred"),
  newdata = NULL, lp = NULL, strata = NULL, quantity = "cumhaz",
  type_pred = c("conditional", "marginal"), conf_int = "adjusted",
  conf_level = 0.95, individual = FALSE, ...)

Arguments

x

emfrail object, typically result of emfrail()

type

One (or more) of hist for a histogram of the estimated frailty values, hr for a plot of the conditional and marginal hazard ratio between two cases and pred for the predicted conditional and marginal cumulative hazard or survival for one case

newdata

A data.frame with values of the covariates. For type == "hr" the hazard ratio between the first two rows of newdata is calculated. For type == "pred" the prediction for the first row of newdata is calculated.

lp

A numeric vector of values of the linear predictor, each corresponding to a case. For type == "hr" the hazard ratio between the first two values of lp is calculated. For type == "pred" the prediction for the first value of lp is calculated.

strata

The name of the strata (if applicable) for which the prediction should be made.

quantity

For type == "pred" the predicted quantity; see quantity in predict.emfrail

type_pred

For type == "pred" the type of predicted quantity; see type in predict.emfrail

conf_int

For type == "pred" the type of confidence intervals; see conf_int in predict.emfrail

conf_level

The width of the confidence interval for type == "pred"; see conf_level in predict.emfrail

individual

For type == "pred" for drawing a curve when the rows of newdata refer to the same individual; see individual in predict.emfrail

...

Further arguments to be passed to the plot function

Value

Nothing

See Also

predict.emfrail, summary.emfrail, autoplot.emfrail.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
mod_rec <- emfrail(Surv(start, stop, status) ~ treatment + number + cluster(id), bladder1,
control = emfrail_control(ca_test = FALSE, lik_ci = FALSE))

# Histogram of the estimated frailties
plot(mod_rec, type = "hist")

# hazard ratio between placebo and pyridoxine
newdata1 <- data.frame(treatment = c("placebo", "pyridoxine"),
                       number = c(1, 3))

plot(mod_rec, type = "hr", newdata = newdata1)

# predicted cumulative hazard for placebo, and number = 1
plot(mod_rec, type = "pred", newdata = newdata1[1,])

# predicted survival for placebo, and number = 1
plot(mod_rec, type = "pred", quantity = "survival", newdata = newdata1[1,])

# predicted survival for an individual that switches from
# placebo to pyridoxine at time = 15
newdata2 <- data.frame(treatment = c("placebo", "pyridoxine"),
                       number = c(1, 3),
                       tstart = c(0, 15),
                       tstop = c(15, Inf))

plot(mod_rec, type = "pred", quantity = "survival", newdata = newdata2, individual = TRUE)

Example output

Loading required package: survival
Warning messages:
1: In Surv(start, stop, status) :
  Stop time must be > start time, NA created
2: In Surv(start, stop, status) : Invalid status value, converted to NA
3: In Surv(start, stop, status) :
  Stop time must be > start time, NA created
4: In Surv(start, stop, status) : Invalid status value, converted to NA

frailtyEM documentation built on Sept. 22, 2019, 5:05 p.m.