### Install flexsurvcure Package Source: https://github.com/jrdnmdhl/flexsurvcure/blob/master/readme.md Installs the flexsurv and devtools packages, then installs the development version of flexsurvcure from GitHub. ```r install.packages("flexsurv") install.packages("devtools") devtools::install_github('jrdnmdhl/flexsurvcure') ``` -------------------------------- ### Fit Complex Cure Model with Covariates Source: https://github.com/jrdnmdhl/flexsurvcure/blob/master/vignettes/flexsurvcure.html Fit a more complex cure model by adding covariates to the parametric distribution of uncured individuals. This example uses the `anc` argument to include `group` as a covariate for the `scale` parameter in a WeibullPH distribution. ```R cure_model_complex <- flexsurvcure(Surv(rectime, censrec)~group, data=bc, link="logistic", dist="weibullPH", mixture=T, anc=list(scale=~group)) ``` ```R print(cure_model_complex) ``` -------------------------------- ### Complex Cure Model Summary Source: https://github.com/jrdnmdhl/flexsurvcure/blob/master/vignettes/flexsurvcure.html Displays a summary of a complex cure model fit, including model coefficients, event counts, and likelihood information. This output is typically generated after fitting a model using the flexsurvcure package. ```r ## scale NA NA NA ## groupMedium 1.69e-01 NA NA ## groupPoor 7.96e+00 NA NA ## scale(groupMedium) 2.29e+00 NA NA ## scale(groupPoor) 8.22e+00 NA NA ## ## N = 686, Events: 299, Censored: 387 ## Total time at risk: 771400 ## Log-likelihood = -2571.857, df = 7 ## AIC = 5157.713 ``` -------------------------------- ### Generate Survival Probabilities with Flexsurvcure Source: https://github.com/jrdnmdhl/flexsurvcure/blob/master/vignettes/flexsurvcure.html Use the `summary` S3 method to generate predicted survival probabilities at specified time points for different groups. The `tidy=T` argument ensures the output is in a tidy data frame format. ```R summary(cure_model, t=seq(from=0,to=3000,by=1000), type="survival", tidy=T) ``` -------------------------------- ### Fit a Mixture Cure Model Source: https://github.com/jrdnmdhl/flexsurvcure/blob/master/readme.md Fits a Weibull proportional hazards mixture cure model with a logistic link function. Requires the 'bc' dataset and 'flexsurvcure' package. ```r mixture = flexsurvcure(Surv(rectime,censrec)~group, data=bc, dist="weibullPH", link="logistic", mixture = T) plot(mixture) ``` -------------------------------- ### Fit Non-Mixture Cure Model with Covariates on Scale Parameter Source: https://github.com/jrdnmdhl/flexsurvcure/blob/master/readme.md Fits a Weibull proportional hazards non-mixture cure model with covariates on the scale parameter, using a log-log link function. Requires the 'bc' dataset and 'flexsurvcure' package. ```r non_mixture_covarite_scale = flexsurvcure(Surv(rectime,censrec)~group, data=bc, anc=list(scale=~group), dist="weibullPH", link="loglog", mixture = F) plot(non_mixture_covarite_scale) ``` -------------------------------- ### Plot Mixture Cure Model Results in R Source: https://github.com/jrdnmdhl/flexsurvcure/blob/master/vignettes/flexsurvcure.html Displays a graphical representation of the fitted mixture cure model results. This function is an S3 method for flexsurvcure objects. ```R plot(cure_model) ``` -------------------------------- ### Fit a Non-Mixture Cure Model Source: https://github.com/jrdnmdhl/flexsurvcure/blob/master/readme.md Fits a Weibull proportional hazards non-mixture cure model with a log-log link function. Requires the 'bc' dataset and 'flexsurvcure' package. ```r non_mixture = flexsurvcure(Surv(rectime,censrec)~group, data=bc, dist="weibullPH", link="loglog", mixture = F) plot(non_mixture) ``` -------------------------------- ### Plotting a Cure Model Source: https://github.com/jrdnmdhl/flexsurvcure/blob/master/vignettes/flexsurvcure.html Generates a plot from a fitted cure model object. This is useful for visualizing survival curves, predicted probabilities, or other model outputs. ```r plot(cure_model_complex) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.