Description Usage Arguments Details Value See Also Examples
View source: R/summary.emfrail.R
Summary for emfrail
objects
1 2 3 4 |
object |
An object of class |
lik_ci |
Logical. Should the confidence intervals for the frailty parameter be calculated based on the likelihood? If not, they are calculated with the delta method. |
print_opts |
A list with options for printing the summary object. These include |
... |
Ignored |
Regardless of
the fitted model, the following fields will be present in this object: est_dist
(an object of class emfrail_distribution
) with the estimated
distribution, loglik
(a named vector with the log-likelihoods of the no-frailty model, the frailty model,
the likelihood ratio test statistic and the p-value of the one-sided likelihood ratio test), theta
(a named vector with
the estimated value of the parameter θ, the standard error, and the limits of a 95
is a data frame with the following columns: id
(cluster identifier), z
(empirical Bayes frailty estimates), and optional
lower_q
and upper_q
as the 2.5
For the the PVF or gamma distributions, the field fr_var
contains a transformation of theta
to correspond to the
frailty variance.
The fields pvf_pars
and stable_pars
are for quantities that are calculated only when the distribution is PVF or stable.
If the model contains covariates, the field coefmat
contains the corresponding estimates. The p-values are based on
the adjusted standard errors, if they have been calculated successfully (i.e. if they appear when prining the summary object).
Otherwise, they are based on the regular standard errors.
An object of class emfrail_summary
,
with some more human-readable results from an emfrail
object.
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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | data("bladder")
mod_gamma <- emfrail(Surv(start, stop, status) ~ treatment + cluster(id), bladder1)
summary(mod_gamma)
summary(mod_gamma, print_opts = list(frailty_verbose = FALSE))
# plot the Empirical Bayes estimates of the frailty
# easy way:
plot(mod_gamma, type = "hist")
# a fancy graph:
sum_mod <- summary(mod_gamma)
library(dplyr)
library(ggplot2)
# Create a plot just with the points
pl1 <- sum_mod$frail %>%
arrange(z) %>%
mutate(x = 1:n()) %>%
ggplot(aes(x = x, y = z)) +
geom_point()
# If the quantiles of the posterior distribution are
# known, then error bars can be added:
if(!is.null(sum_mod$frail$lower_q))
pl1 <- pl1 + geom_errorbar(aes(ymin = lower_q, ymax = upper_q), alpha = 0.5)
pl1
# The plot can be made interactive!
# ggplot2 gives a warning about the "id" aesthetic, just ignore it
pl2 <- sum_mod$frail %>%
arrange(z) %>%
mutate(x = 1:n()) %>%
ggplot(aes(x = x, y = z)) +
geom_point(aes(id = id))
if(!is.null(sum_mod$z$lower_q))
pl2 <- pl2 + geom_errorbar(aes(ymin = lower_q, ymax = upper_q, id = id), alpha = 0.5)
library(plotly)
ggplotly(pl2)
# Proportional hazards test
off_z <- log(sum_mod$frail$z)[match(bladder1$id, sum_mod$frail$id)]
zph1 <- cox.zph(coxph(Surv(start, stop, status) ~ treatment + cluster(id), data = bladder1))
# no sign of non-proportionality
zph2 <- cox.zph(coxph(Surv(start, stop, status) ~ treatment + offset(off_z), data = bladder1))
zph2
# the p-values are even larger; the frailty "corrects" for proportionality.
|
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
Call:
emfrail(formula = Surv(start, stop, status) ~ treatment + cluster(id),
data = bladder1)
Regression coefficients:
coef exp(coef) se(coef) adjusted se z p
treatmentpyridoxine 0.14076 1.15115 0.33872 0.33905 0.41556 0.6777
treatmentthiotepa -0.15888 0.85309 0.33054 0.33123 -0.48068 0.6307
Estimated distribution: gamma / left truncation: FALSE
Fit summary:
Commenges-Andersen test for heterogeneity: p-val 4.08e-18
(marginal) no-frailty Log-likelihood: -800.212
(marginal) Log-likelihood: -763.58
LRT: 1/2 * pchisq(73.3), p-val 5.67e-18
Frailty summary:
theta = 0.835 (0.21) / 95% CI: [0.521, 1.395]
variance = 1.197 / 95% CI: [0.717, 1.921]
Kendall's tau: 0.374 / 95% CI: [0.264, 0.49]
Median concordance: 0.377 / 95% CI: [0.261, 0.501]
E[log Z]: -0.706 / 95% CI: [-1.212, -0.399]
Var[log Z]: 2.152 / 95% CI: [1.031, 4.607]
Confidence intervals based on the likelihood function
Call:
emfrail(formula = Surv(start, stop, status) ~ treatment + cluster(id),
data = bladder1)
Attaching package: 'dplyr'
The following objects are masked from 'package:stats':
filter, lag
The following objects are masked from 'package:base':
intersect, setdiff, setequal, union
Warning: Ignoring unknown aesthetics: id
Attaching package: 'plotly'
The following object is masked from 'package:ggplot2':
last_plot
The following object is masked from 'package:stats':
filter
The following object is masked from 'package:graphics':
layout
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
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
rho chisq p
treatmentpyridoxine -0.00807 0.0125 0.911
treatmentthiotepa 0.01193 0.0271 0.869
GLOBAL NA 0.0617 0.970
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.