test_elife {longevity} | R Documentation |
Likelihood ratio test for covariates
Description
This function fits separate models for each distinct
value of the factor covariate
and computes a likelihood ratio test
to test whether there are significant differences between
groups.
Usage
test_elife(
time,
time2 = NULL,
event = NULL,
covariate,
thresh = 0,
ltrunc = NULL,
rtrunc = NULL,
type = c("right", "left", "interval", "interval2"),
family = c("exp", "gp", "weibull", "gomp", "gompmake", "extgp", "extweibull", "perks",
"perksmake", "beard", "beardmake"),
weights = rep(1, length(time)),
arguments = NULL,
...
)
Arguments
time |
excess time of the event of follow-up time, depending on the value of event |
time2 |
ending excess time of the interval for interval censored data only. |
event |
status indicator, normally 0=alive, 1=dead. Other choices are |
covariate |
vector of factors, logical or integer whose distinct values define groups |
thresh |
vector of thresholds |
ltrunc |
lower truncation limit, default to |
rtrunc |
upper truncation limit, default to |
type |
character string specifying the type of censoring. Possible values are " |
family |
string; choice of parametric family |
weights |
weights for observations |
arguments |
a named list specifying default arguments of the function that are common to all |
... |
additional arguments for optimization, currently ignored. |
Value
a list with elements
-
stat
likelihood ratio statistic -
df
degrees of freedom -
pval
the p-value obtained from the asymptotic chi-square approximation.
Examples
test <- with(subset(dutch, ndays > 39082),
test_elife(
time = ndays,
thresh = 39082L,
covariate = gender,
ltrunc = ltrunc,
rtrunc = rtrunc,
family = "exp"))
test