npdf_cox {discfrail}  R Documentation 
This function fits a Cox proportional hazards model to grouped survival data, where the shared groupspecific frailties have a nonparametric discrete distribution. An EM algorithm is used to maximise the marginal partial likelihood.
npdf_cox(formula, groups, data, K = 2, estK = TRUE,
criterion = "BIC", eps_conv = 10^4, se_method = c("louis",
"exact"))
formula 
A formula expression in conventional R linear modelling
syntax. The response must be a survival time constructed by the
Only 
groups 
name of the variable which indicates the group in which each individual belongs (e.g. the hospital that the individual is treated in). This can be integer, factor or character. The name should be unquoted. 
data 
A data frame in which to find variables supplied in

K 
initial number of latent populations, or clusters of groups which have the same discrete frailty. 
estK 
If If 
criterion 
Criterion used to choose the bestfitting model to highlight when

eps_conv 
convergence tolerance for the EM algorithm. 
se_method 
Method or methods used to compute the standard errors. A character vector containing one or more of the following:
By default this is 
If estK=FALSE
this returns a list of class npdf
which includes information about the model fit, including estimates and standard errors.
If estK=TRUE
this returns a list of class npdflist
. This has an element models
that contains a list of length K
, with one component of class npdf
for each fitted model.
comparison
is a matrix composed of K
rows and 5 columns (K
, K_fitted
, llik
, AIC
, BIC
). K_fitted
is the number of estimated latent populations, which can be equal to or less than K
. llik
stands for loglikelihood, AIC
for Akaike Information Criterion and BIC
for Bayesian Information Criterion.
Kopt
is optimal model under each criterion.
criterion
is the preferred criterion.
In either case, the data frame used for the fit (the "model frame") is appended as a component mf
.
Gasperoni, F., Ieva, F., Paganoni, A.M., Jackson, C. and Sharples, L. (2018). Nonparametric frailty Cox models for hierarchical timetoevent data. Biostatistics.
Laird, N. (1978). Nonparametric maximum likelihood estimation of a mixing distribution. Journal of the American Statistical Association, 73(364), 805–811.
Louis, T. A. (1982). Finding the observed information matrix when using the EM algorithm. Journal of the Royal Statistical Society. Series B, 44(2), 226–233.
test < npdf_cox( Surv(time, status) ~ x, groups=family, data=weibdata2030, K = 4, eps_conv=10^4)
test # optimal model (by all criteria) has 2 latent populations
test$models[[1]] # examine alternative model with 1 latent population