Learn R Programming

curesurv (version 0.1.2)

anova.curesurv: anova.curesurv function for likelihood-ratio test of two nested models from curesurv function

Description

This function computes an analysis of deviance table for two excess hazard models fitted using the curesurv R package.

Usage

# S3 method for curesurv
anova(object, ..., test = "LRT")

Value

An object of class anova inheriting from class matrix. The different columns contain respectively the degrees of freedom and the log-likelihood values of the two nested models, the degree of freedom of the chi-square statistic, the chi-square statistic, and the p-value of the likelihood ratio test.

Arguments

object

An object of class curesurv.

...

Additional object of class curesurv.

test

A character string. Computes the likelihood-ratio test for value "LRT". In case the two models are the same, but one with the correction of mortality tables and one without, the likelihood ratio test is computed for value "LRT_alpha" These are the only tests available for now.

Examples

Run this code
# \donttest{
library("curesurv")
library("survival")

testiscancer$age_crmin <- (testiscancer$age - min(testiscancer$age)) / sd(testiscancer$age)

fit_m0 <- curesurv(Surv(time_obs, event) ~ 1 | 1,
                          pophaz = "ehazard",
                          cumpophaz = "cumehazard",
                          model = "nmixture", dist = "tneh",
                          link_tau = "linear",
                          data = testiscancer,
                          method_opt = "L-BFGS-B")

fit_m1 <- curesurv(Surv(time_obs, event) ~ age_crmin | 1,
                          pophaz = "ehazard",
                          cumpophaz = "cumehazard",
                          model = "nmixture", dist = "tneh",
                          link_tau = "linear",
                          data = testiscancer,
                          method_opt = "L-BFGS-B")

anova(fit_m0, fit_m1)
# }

Run the code above in your browser using DataLab