dataesr/scientific-paragraphs-categorization huggingface dataset:
Moreover, frailtypack includes prediction tools, such as concordance measures adapted to shared frailty models and predicted probability of events for the joint models. Characteristics of a previous version of the package, such as estimation of several shared and standard joint frailty models using penalized likelihood, were already described elsewhere  (Rondeau, Mazroui, and Gonzalez 2012). This work focuses on an overview and developments of joint models included in the package (model for recurrent/clustered events and a terminal event, model for multivariate recurrent events and a terminal event, model for longitudinal data and a terminal event and model for longitudinal data, recurrent events and a terminal event) and the prediction tools accompanied by predictive accuracy measures. Finally, several options available for the models (e.
g. , two correlated frailties in the model for recurrent events and a terminal event, left-censoring for the longitudinal data) will be presented with the appropriate examples. A practical guide to different types of models included in the package along with available options is presented in a schematic table in Appendix A. This article firstly presents joint models with details on estimation methods (Section 2) and predictions of an event in the framework of these joint models (Section 3). In Section 4, the frailtypack package features are detailed. Section 5 contains some examples on real datasets and finally, Section 6 concludes the paper.
The events can be chosen arbitrarily but it is assumed that the event 2 impedes the process of the event 1. Usually the event 2 is death of a patient and the other is an event of interest (e. g. , surrogate endpoint for OS) such as time to tumor progression or progression-free survival. The interest of using the joint model for the clustered data is that it considers the dependency between the survival processes and respects that event 2 is a competitive event for event 1. The frailty term u i is common for a given group and represents the clustered association between the processes (at the cluster level) as well as the intra-cluster correlation. The package frailtypack includes clustered joint models for two survival outcomes in presence of semi-competing risks (time-to-event, recurrent events are not allowed).
The variance of the frailty terms represent the heterogeneity in the data, associated with unobserved covariates. Moreover, high value of the variance η indicates strong dependence between the recurrent events and high value of the variance θ indicates that the recurrent and the terminal events are strongly dependent. The individual information is equivalent to Θ i from Model (1) and the parameters to estimate are ξ = {r 0 (•), λ 0 (•), β R , β T , θ, η}. In the package frailtypack for Model (2), called also general joint frailty model, only Gamma distribution is allowed for the random effects.
The strength of the dependencies between the processes is quantified by α and vectors η R and η T. The vector of the random effects u i = (b i , v i ) of dimension q = q 1 + 1 follows the multivariate normal distribution: u i = b i v i ∼ N 0, B 1 0 0 σ 2 v , where the dimension of the matrix B 1 in the frailtypack package is allowed to be maximum 2. It is convenient if one assume for the biomarker a random intercept and slope: Y i (t) = m i (t) + i (t) = X Li (t) β L + b i0 + b i1 × t + i (t) and then b i0 represents the heterogeneity of the baseline measures of the biomarker among the subjects and b i1 the heterogeneity of the slope of the biomarker's linear trajectory among the subjects. As for Model (4) we allow the biomarker to be leftcensored, again with y o i the observed outcomes and y c i the undetected ones.
In this case, the standard non-adaptive Gauss-Hermite quadrature, that uses a specific number of points, gives accurate results but often can be time consuming and thus alternatives have been proposed. The multivariate non-adaptive procedure using fully symmetric interpolatory integration rules proposed by  Genz and Keister (1996)  offers advantageous computational time but in case of datasets in which some individuals have few repeated measurements, this method may be moderately unstable. Another possibility is the pseudo-adaptive Gauss-Hermite quadrature that uses transformed quadrature points to center and scale the integrand by utilizing estimates of the random effects from an appropriate linear mixed-effects model (this transformation does not include the frailty in the trivariate model, for which the standard method is used).
Direct calculations of the Brier score are not implemented in the package frailtypack but using predictions P i (t, t + w; ξ)), the Brier score can be obtained using weights w i (•) function pec from the package pec (Gerds 2016) (for details, see the colorectal example in Section 5. 3). For an internal validation (on a training dataset, i. e. , used for estimation) of the model as a prediction tool for new patients, a k-fold cross-validation is used to correct for over-optimism. In this procedure, the joint model estimations are performed k times on k -1 partitions from the random split and the predictions are calculated on the left partitions. The prediction curves are based on these predictions, in the calculated for all the patients.
Modeling and prediction using the R package frailtypack 4. 1. Estimation of joint models In the package frailtypack there are four different functions for the estimation of joint models, one for each model. The joint models for recurrent events and a terminal event (1) (and models for two clustered survival outcomes) as well as the general joint frailty models (2) are estimated with function frailtyPenal. The joint models for two recurrent events and a terminal event (3) are estimated with multivPenal. The estimation of joint models for a longitudinal outcome and a terminal event (4) is performed with longiPenal. Finally, function trivPenal estimates trivariate joint models (5). All these functions make calls to compiled Fortran codes programmed for computation and optimization of the log-likelihood.
g. , terminal(death)). It should be noted that the function cluster(x) is different from that included in the package survival. In both cases it is used for the identification of the correlated groups but in frailtypack it indicates the application of frailty model and in survival, a GEE (Generalized Estimating Equations) approach, without random effects. Argument formula. terminalEvent requires the combination of covariates related to the terminal event on the right-hand side. The name of data. frame with the variables used in the function should be put for argument data. Logical argument recurrentAG indicates whether the calendar timescale for recurrent events or clustered data with the counting process approach of  Andersen and Gill (1982)  (TRUE) or the gap timescale (FALSE by default) is to be used.
Argument formula. LongitudinalData is equal to the sum of fixed explicative variables for the longitudinal outcome. For the model, two datasets are required: data containing information on the terminal event process and data. Longi with data related to longitudinal measurements. Random effects associated to the longitudinal outcome are defined with random using the appropriate names of the variables from data. Longi. If a random intercept is assumed, the option "1" should be used. For a random intercept and slope, arguments random should be equal to a vector with elements "1" and the name of a variable representing time point of the biomarker measurements. At the moment, more complicated structures of the random effects are not available in the package. The name of the variable representing the individuals in data.
Prediction The current increase of interest in the joint modeling of correlated data is often related to the individual predictions that these models offer. Indeed, calculating the probabilities of a terminal event given a joint model results in precise predictions that consider the past of an individual. Moreover, there exist statistical tools that evaluate a model's capacity for these dynamic predictions. In the package frailtypack we provide prediction function for dynamic predictions of a terminal event in a finite horizon, epoce function for evaluating predictive accuracy of a joint model and Diffepoce for comparing the accuracy of two joint models.
Longi containing repeated measurements and covariates related to the longitudinal outcome. These two datasets must refer to the same individuals for which the predictions will be calculated. Moreover, the names and the types of variables should be equivalent to those in the dataset used for estimation. The details on how to prepare correctly the data are presented in appropriate examples (Section 5). Argument t is a time or vector of times for predictions and window is a horizon or vector of horizons. The function calculates the probability of the terminal event between a time of prediction and a horizon (both arguments are scalars), between several times of prediction and a horizon (t is a vector and window a scalar) and finally, between a time of prediction and several horizons (t is a scalar and window a vector of positive values).
For all the predictions, confidence intervals can be calculated using the MC method with MC. sample number of samples (maximum 1000). If the confidence bands are not to be calculated argument MC. sample should be equal to 0 (the default). Predictive accuracy measure with epoce and Diffepoce functions Predictive ability of joint models can be evaluated with function epoce that computes the estimators of the EPOCE, the MPOL and CVPOL a. For a given estimation, the evaluation can be performed on the same data and then both MPOL and CVPOL a are calculated, as well as on a new dataset but then only MPOL is calculated as the correction for over-optimism is not necessary. The call of the function is: epoce(fit, pred. times, newdata = NULL, newdata. Longi = NULL) with fit an object of jointPenal, longiPenal or trivPenal classes, pred.
times a vector of time for which the calculations are performed. In case of external validation, new datasets newdata and newdata. Longi should be provided (newdata. Longi only in case of longiPenal and trivPenal objects). However, the names and types of variables in newdata and newdata. Longi must be the same as in the datasets used for estimation. To compare the predictive accuracy of two joint models fit to the same data but possibly with different covariates, the simple comparison of obtained values of EPOCE can be enhanced by calculating the 95% tracking interval of difference between the EPOCE estimators. For this purpose we propose function: Diffepoce(epoce1, epoce2) where epoce1 and epoce2 are objects inheriting from the epoce class.
Illustrating examples The package frailtypack provides various functions for models for correlated outcomes and survival data. The Cox proportional hazard model, the shared frailty model for recurrent events (clustered data), the nested frailty model, the additive frailty model and the joint frailty model for recurrent events and a terminal event have already been illustrated elsewhere  (Rondeau and Gonzalez 2005; Rondeau et al. 2012). In this section we focus on extended models for correlated data presented in Section 2 using three datasets: readmission, dataMultiv and colorectal. Although the joint frailty model has already been presented in the literature, we illustrate its usage as the form of the function has developed in the meantime.
Example on dataset readmission for joint frailty models Dataset readmission comes from a rehospitalization study of patients after a surgery and diagnosed with colorectal cancer  (Gonzalez, Fernandez, Moreno, Ribes, Merce, Navarro, Cambray, and Borras 2005; Rondeau et al. 2012). It contains information on times (in days) of successive hospitalizations and death (or last registered time of follow-up for right-censored patients) counting from date of surgery, and patients characteristics: type of treatment, sex, Dukes' tumoral stage, comorbidity Charlson's index and survival status. The dataset includes 403 patients with 861 rehospitalization events in total. Among the patients 112 (28%) died during the study.
This may suggest, that the model may have underestimated the number of death in the early follow-up period. The identified individuals of which the residuals result in non-zero mean, had short intervals between their rehospitalization and death (1 day). Indeed, the removal of these individuals (50 patients) resulted in residuals with the mean close to 0 all along the follow-up period (plot not shown here). The package frailtypack provides also the estimation of the random effects. Vector frailty. pred from jointPenal object contains the individual empirical Bayes estimates. They can be graphically represented for each individual with additional information on number of events (point size) to identify the outlying data. R> plot(1 : 403, modJoint. gap$frailty. pred, xlab = "Id of patients", + ylab = "Frailty predictions for each patient", type = "p", axes = F, + cex = as.
Time-varying coefficients In the framework of standard joint frailty models, it is possible to fit the models with timevarying effects of prognostic factors. Using function timedep in a formula of frailtyPenal, the time-dependent coefficients can be estimated using B-splines of order q (option betaorder) with m interior knots (option betaknots). In the example of readmission dataset we are interested in verifying whether the variable sex has a time-varying effect on both recurrent and terminal events. In the result, using the method print the estimated values of parameters with time-constant effects and graphics of log-hazard ratios for time-dependent variables for each events are obtained (Appendix B, Figure  10 ). For rehospitalizations, we found firstly a protective effect for females (β(t) < 0) and later an increased risk (β(t) > 0).
5 year after their surgeries. We set the time of prediction for 2 years and calculate the probability in a time window of 3 years (we apply a moving window with a step of 0. 5 year). Patient 1 had Dukes' stage A and patient 2, Dukes' stage D. We focused on the predicted probabilities regarding the complete history of recurrences (Equation  8 ) and compared the results with those obtained using the incomplete history and ignoring the history. To prepare data for the predictions, we started with an empty data frame with the variables of interest and the covariates: R> datapred <-data. frame(time = 0, event = 0, id = 0, dukes = 0, charlson = + 0, sex = 0, chemo = 0) R> datapred  [ ,4 : 7] <-lapply(datapred[ , 4 : 7] ,as. factor) R> levels(datapred$dukes) <-c(1, 2, 3) R> levels(datapred$charlson) <-c(1, 2, 3) R> levels(datapred$sex) <-c(1, 2) R> levels(datapred$chemo) <-c(1, 2) Patient 1 with Dukes' stage A had two observed hospitalizations at 365th and 548th day after the surgery:  365, 1, 1, 1, 1, 1, 2)  R> datapred[2, 1, 1, 1, 1, 1, 2)  Patient 2 had the hospitalizations observed in the same times as Patient 1 but was assumed to have Dukes' stage B: R> datapred[1, ] <-c( R> datapred[3, ] <-c(365, 1, 2, 3, 1, 1, 2) R> datapred[4, ] <-c(548, 1, 2, 3, 1, 1, 2) We calculated the predictions for both patients: In the result, three types of predictions were calculated for 6 time horizons.
Joint frailty model for clustered data The joint models for clustered survival data can be estimated using again frailtyPenal function. A dataset should include information on two survival outcomes for individuals from several groups. This model is presented using readmission dataset artificially created clusters on individuals. The first survival event will be the first observed rehospitalization and the second event, death. The framework of semi-competing risks is used here, thus individuals' follow-up stops at time of the rehospitalization, death or in case when none of these events are observed, the censoring time. We consider 6 clusters defined by a new variable group: R> readmission <-transform(readmission, group = id %% 6 + 1 ) R> readm_cluster <-subset(readmission, (t. start == 0 & event == 1) + | event == 0) New dataset readm_cluster includes clusters with 97 to 107 individuals per group.
General joint frailty model To estimate the general frailty model, argument jointGeneral must be equal to TRUE in function frailtyPenal. We applied this model to original readmission dataset assuming two independent frailty terms using a following code: R> modJoint. general <-frailtyPenal(Surv(time, event) ~cluster(id) + dukes + + charlson + sex + chemo + terminal(death), formula. terminalEvent = + dukes + charlson + sex + chemo, data = readmission, jointGeneral = TRUE, + n. knots = 8, kappa = c(2. 11e+08, 9. 53e+11)) In the output of the function, estimations of the variances of both random effects are given. For the analyzed example, the estimated variance θ of the frailty u i associating recurrent events and death indicates relationship between the processes ( θ = 0. 68, p-value < 0. 001).
Example on dataset dataMultiv for multivariate joint frailty model For the following example we applied a generated dataset for 800 individuals from Model (3) with 2 types of recurrent events and a terminal event. The random effects were assumed to follow the normal distribution u i ∼ N (0, 0. 5), v i ∼ N (0, 0. 5) and the correlation coefficient ρ = 0. 5. The coefficients for the random effects were α 1 = α 2 = 1. The baseline hazard functions r (1) 0 (t), r (2) 0 (t) and λ 0 (t) followed the Weibull distribution and the time for right censoring was fixed at 5. The generated data included 1652 observations. For detailed description of the generation scenario see  Mazroui et al. (2012). The dataset includes individuals times of events with variables indicating the type of event: INDICREC for the recurrent event of type 1 (local recurrences), INDICMETA for the recurrent event of type 2 (metastases) and INDICDEATH for censoring status (death).
Multivariate frailty model We consider the multivariate frailty model for the exemplary dataset dataMultiv to study jointly local recurrences, metastases and death for patients diagnosed with cancer. To define the model, three formulas must be defined in the function with additional indication on variables including status of the second recurrent event (event2) and of the terminal event (terminal), both included in the first formula. All the baseline hazard functions must be of the same type (Weibull, splines or piecewise constant). We fit the model as follows (computational time 54 minutes on a personal computer with an Intel Core i7 3. 40 GHz processor and 8 GB RAM runing Windows 7): R> data("dataMultiv") R> modMultiv. spli <-multivPenal(Surv(TIMEGAP, INDICREC) ~cluster(PATIENT) + + v1 + v2 + event2(INDICMETA) + terminal(INDICDEATH), formula.
Example on dataset colorectal for models with longitudinal data Datasets colorectal and colorectal. Longi represent a random selection of 150 patients from a multi-center randomized phase III clinical trial FFCD 2000-05 of patients diagnosed with metastatic colorectal cancer not amenable to curative intent surgery. The trial was conducted between 2002 and 2007 in France by Fédèration Francophone de Cancérologie Digestive (FFCD) (Ducreux, Malka, Mendiboure, Etienne, Texereau, Auby, Rougier, Gasmi, Castaing, Abbas, Michel, Gargot, Azzedine, Lombard-Bohas, Geoffroy, Denis, Pignon, Bedenne, and Bouché 2011). The data contains a follow-up of tumor size measure (sum of the longest diameters of target lesions) and times of apparition of new lesions as recurrent events. Moreover, some baseline characteristics (age, WHO performance status and previous resection), treatment arm (combination vs.
sequential) and time of death (or last observed time for a right-censored individual) are included in the data. Dataset colorectal provides information on recurrent event and death and dataset colorectal. Longi on the measurements of tumor size. A total of 906 tumor size measurements and 289 of recurrences were recorded for patients included. Among them, 121 died during the study. The variable tumor. size in colorectalLongi is the transformed sum of the longest diameters (SLD * ) of an individual's target lesions measured during a visit (SLD * = (SLD 0. 3 -1)/0. 3). The status of new lesions occurrence is registered in new. lesions in dataset colorectal. In this dataset start of time interval time0 (0 or time of previous recurrence) and time of event time1 (recurrence or censoring by terminal event) represent information for times of apparition of new lesions and for death (or right censoring).
We provide extracts of colorectal and colorectalLongi datasets to guide the users how to prepare suitable dataset for joint models with longitudinal data using the package. These functions require datasets in long format (one row per observation and usually several rows per individuals) and only in case of data in longiPenal the long format is one row per individual (as it contains information on termianl event only). In example of the colorectal dataset this is represented as follows: R> data("colorectalLongi") R> head(colorectalLongi, 10) Joint model for longitudinal data and a terminal event Firstly, we estimated the bivariate joint model for longitudinal data and a terminal event (4). We considered a left-censored biomarker, transformed tumor size measurements are not observed below a threshold -3.
33 (which corresponds to 'zero' measures in the nontransformed data). The value of κ smoothing parameter was chosen using a corresponding reduced model, ie. a Cox model for the terminal event. For a model with a random intercept and slope for the biomarker and the link function being the random effects of the biomarker we used the following form of the longiPenal function using colorectalLongi dataset and a subset colorectal with only information on the terminal event (colorectalSurv): Next, we explored predictiveness of this model comparing it with a model in which the link function was represented by the current level of the biomarker m i (t). Thus, we fitted a bivariate model with the same covariates and characteristics but with the option link = "Current-level" (model modLongi2). Then, for times of prediction between 1.
For the colorectal dataset the differences in CVPOLa were not of great importance, thus we apply a trivariate model with the random effects of the biomarker as the link function, as this model is less computationally intensive. Joint model for longitudinal data, recurrent events and a terminal event The package frailtypack allows the estimation of the trivariate models for a longitudinal biomarker, recurrent events and a terminal event. In the dataset colorectal, the recurrent events are represented by the appearance of new lesions during the treatment. Usually in clinical trials the size of new lesions is not registered and thus, their burden cannot be simply added to the measure of the tumor size of the target lesions. However, it is of interest to add the information on new lesions to a model as it influences overall survival.
Dynamic Predictions Both, for the bivariate models for longitudinal data and a terminal event and for the trivariate models, the package provides individual predictions of the terminal event. To create patients' profiles, two datasets must be provided, one including the history of the biomarker and the values of covariates at measurement times (dataLongi) and a second one with the information on covariates related to the terminal event (data). In case of the trivariate model, this dataset should also include the history of recurrences. For the example of colorectal dataset, we created two profiles of patients that differed from each other by the trajectory of the tumor size. The first patient had a progressive disease with a tumor size increasing in time and the second patient a response to the treatment with a diminishing tumor.