cifcurve()
-
formulaA model formula specifying the time-to-event outcome on the left-hand side (typicallyEvent(time, status)orsurvival::Surv(time, status)) and, optionally, a stratification variable on the right-hand side. Unlikecifplot(), this function does not accept a fittedsurvfitobject. -
dataA data frame containing variables informula. -
weightsOptional name of the weight variable indata. Weights must be nonnegative. -
subset.conditionOptional character expression to subsetdatabefore analysis. -
na.actionA function specifying the action to take on missing values (defaultna.omit). -
outcome.typeCharacter string specifying the type of time-to-event outcome. One of"survival"(Kaplan-Meier) or"competing-risk"(Aalen-Johansen). IfNULL(default), the function automatically infers the outcome type from the data: if the event variable has more than two unique levels,"competing-risk"is assumed; otherwise,"survival"is used. You can also use abbreviations such as"S"or"C". Mixed or ambiguous inputs (e.g.,c("S", "C")) trigger automatic detection based on the event coding. -
code.event1Integer code of the event of interest (default1). -
code.event2Integer code of the competing event (default2). -
code.censoringInteger code of censoring (default0). -
errorCharacter string specifying the method for SEs and CIs used internally. For"survival"without weights, choose one of"greenwood"(default),"tsiatis", or"if". For"competing-risk"without weights, choose one of"delta"(default),"aalen", or"if". SEs and CIs based on influence functions ("if") is recommended for weighted analysis. -
conf.typeCharacter specifying the method of transformation for CIs used internally (default"arcsine-square root"). -
conf.intNumeric two-sided level of CIs (default0.95). -
return_ifLogical. WhenTRUEandengine = "calculateAJ_Rcpp", the influence function is also computed and returned (defaultFALSE). -
report.survfit.std.errLogical. IfTRUE, report SE on the log-survival scale (survfit’s convention). Otherwise SE is on the probability scale. -
engineCharacter. One of"auto","calculateKM", or"calculateAJ_Rcpp"(default"calculateAJ_Rcpp"). -
prob.boundNumeric lower bound used to internally truncate probabilities away from 0 and 1 (default1e-7).
cifplot()
-
formula_or_fitA model formula or a survfit object. Note: When a formula is supplied, the left-hand side must beEvent(time, status)orsurvival::Surv(time, status). -
dataA data frame containing variables informula. -
weightsOptional name of the weight variable indata. Weights must be nonnegative. -
subset.conditionOptional character expression to subsetdatabefore analysis. -
na.actionA function specifying the action to take on missing values (defaultna.omit). -
outcome.typeCharacter string specifying the type of time-to-event outcome. One of"survival"(Kaplan-Meier) or"competing-risk"(Aalen-Johansen). IfNULL(default), the function automatically infers the outcome type from the data: if the event variable has more than two unique levels,"competing-risk"is assumed; otherwise,"survival"is used. You can also use abbreviations such as"S"or"C". Mixed or ambiguous inputs (e.g.,c("S", "C")) trigger automatic detection based on the event coding. -
code.event1Integer code of the event of interest (default1). -
code.event2Integer code of the competing event (default2). -
code.censoringInteger code of censoring (default0). -
errorCharacter string specifying the method for SEs and CIs used internally. For"survival"without weights, choose one of"greenwood"(default),"tsiatis", or"if". For"competing-risk"without weights, choose one of"delta"(default),"aalen", or"if". SEs and CIs based on influence functions ("if") is recommended for weighted analysis. -
conf.typeCharacter specifying the method of transformation for CIs used internally (default"arcsine-square root"). -
conf.intNumeric two-sided level of CIs (default0.95). -
type.yCharacter string specifying the y-scale. For survival/CIF curves,"surv"implies survival probabilities and"risk"implies CIF (1-survival in simple survival settings). Specify"cumhaz"to plot cumulative hazard or"cloglog"to generate a complementary log-log plot. IfNULL, a default is chosen fromoutcome.typeor the survfit object. -
label.xCharacter x-axis labels (default"Time"). -
label.yCharacter y-axis label (default is chosen automatically fromoutcome.typeandtype.y, e.g. “Survival”, “Cumulative incidence” or “Cumulative hazard”). -
label.strataCharacter vector of labels for strata. -
order.strataOptional ordering of strata levels. Whenpanel.per.variable = TRUE, supply a named listlist(var = c("L1","L2",...))for each RHS variable; unmatched levels are dropped. Whenpanel.per.variable = FALSE, supply a character vectorc("L1","L2",...)that specifies the display order (legend/risktable) of the single stratification factor. Levels not listed are dropped. Iflabel.stratais a named vector, its names must match the (re-ordered) levels. -
limits.xNumeric length-2 vectors for axis limits. IfNULLit is internally set toc(0,max(out_read_surv$t)). -
limits.yNumeric length-2 vectors for axis limits. IfNULLit is internally set toc(0,1). -
breaks.xNumeric vectors for axis breaks (defaultNULL). -
breaks.yNumeric vectors for axis breaks (defaultNULL). -
use.coord.cartesianLogical; ifTRUE, usesggplot2::coord_cartesian()for zooming instead of changing the scale limits (defaultFALSE). -
add.confLogical addadd_confidence_interval()to plot. It callsgeom_ribbon()(defaultTRUE). -
add.risktableLogical addadd_risktable(risktable_stats="n.risk")to plot (defaultTRUE). -
add.estimate.tableLogical addadd_risktable(risktable_stats="estimate (conf.low, conf.high)")to plot (defaultFALSE). -
symbol.risk.tableCharacter specifying the symbol used in the risk table to denote strata:"square","circle", or"triangle"(default"square"). -
font.size.risk.tableNumeric font size for texts in risk / estimate tables (default3). -
add.censor.markLogical addadd_censor_mark()to plot. It callsgeom_point()(defaultTRUE). -
shape.censor.markInteger point shape for censor marks (default3). -
size.censor.markNumeric point size for censor marks (default2). -
add.competing.risk.markLogical add time marks to describe event2 specified byEvent(), usually the competing events. It callsgeom_point()(defaultTRUE). -
competing.risk.timeNamed list of numeric vectors (names must be mapped to strata labels). -
shape.competing.risk.markInteger point shape for competing-risk marks (default16). -
size.competing.risk.markNumeric point size for competing-risk marks (default2). -
add.intercurrent.event.markLogical overlay user-specified time marks per strata callsgeom_point()(defaultTRUE). -
intercurrent.event.timeNamed list of numeric vectors (names must be mapped to strata labels). -
shape.intercurrent.event.markInteger point shape for intercurrent-event marks (default1). -
size.intercurrent.event.markNumeric point size for intercurrent-event marks (default2). -
add.quantileLogical addadd_quantile()to plot. It callsgeom_segment()(defaultTRUE). -
level.quantileNumeric quantile level foradd_quantile()(default0.5). -
panel.per.eventLogical. Explicit panel mode. IfTRUEandoutcome.type == "competing-risk",cifplot()internally callscifpanel()to display two event-specific CIFs side-by-side (event 1 and event 2) using reversedcode.events. Ignored for non-competing-risk outcomes. -
panel.censoringLogical. Explicit panel mode. IfTRUEandoutcome.type == "survival",cifplot()internally callscifpanel()to display KM-type curves for (event, censor) and (censor, event) so that censoring patterns can be inspected. -
panel.per.variableLogical. Explicit panel mode. IfTRUEand the right-hand side of the formula has multiple covariates (e.g.~ a + b + c), the function produces a panel where each variable in RHS is used once as the stratification factor. -
panel.modeCharacter specifying Automatic panel mode. If"auto"and none ofpanel.per.variable,panel.per.event,panel.censoringhas been set toTRUE, the function chooses a suitable panel mode automatically: (i) if the formula RHS has 2+ variables, it behaves likepanel.per.variable = TRUE; (ii) otherwise, ifoutcome.type == "competing-risk", it behaves likepanel.per.event = TRUE; (iii) otherwise, ifoutcome.type == "survival", it behaves likepanel.censoring = TRUE. If a panel mode is explicitly specified,panel.modeis ignored. -
rows.columns.panelOptional integer vectorc(nrow, ncol)controlling the panel layout. IfNULL, an automatic layout is used. -
styleCharacter plot theme controls (default"classsic"). -
paletteOptional character vector specify color palette, e.g.palette=c("blue", "cyan", "navy", "green")(defaultNULL). -
linewidthOptional numeric specifying the line width of curve (default0.8). -
linetypeOptional logical using different line types of curve (default\code{FALSE`). -
font.familyCharacter plot theme controls (e.g."sans","serif", and"mono". default"sans"). -
font.sizeInteger plot theme controls (default12). -
legend.positionCharacter specify position of legend:"top","right","bottom","left", or"none"(default"top"). -
filename.ggsaveCharacter save theggsurvfitplot with the path and name specified. -
width.ggsaveNumeric specify width of theggsurvfitplot. -
height.ggsaveNumeric specify height of theggsurvfitplot. -
dpi.ggsaveNumeric specify dpi of theggsurvfitplot.
cifpanel()
plotsOptional list of existing ggplot objects to be arranged into a panel. When plots is supplied, no new models are fitted; the plots are used as-is.formulaA model formula specifying the time-to-event outcome on the left-hand side (typicallyEvent(time, status)orsurvival::Surv(time, status)) and, optionally, a stratification variable on the right-hand side. Unlikecifplot(), this function does not accept a fittedsurvfitobject.formulasA list of formulas (one per panel). If provided, overridesformula.dataA data frame containing variables informula.weightsOptional name of the weight variable indata. Weights must be nonnegative.subset.conditionOptional character expression to subsetdatabefore analysis.na.actionA function specifying the action to take on missing values (defaultna.omit).outcome.typeCharacter string specifying the type of time-to-event outcome. One of"survival"(Kaplan-Meier) or"competing-risk"(Aalen-Johansen). IfNULL(default), the function automatically infers the outcome type from the data: if the event variable has more than two unique levels,"competing-risk"is assumed; otherwise,"survival"is used. You can also use abbreviations such as"S"or"C". Mixed or ambiguous inputs (e.g.,c("S", "C")) trigger automatic detection based on the event coding.code.event1Integer code of the event of interest (default1).code.event2Integer code of the competing event (default2).code.censoringInteger code of censoring (default0).code.eventsOptional numeric length-3 vectorc(event1, event2, censoring). When supplied, it overridescode.event1,code.event2, andcode.censoring(primarily used whencifpanel()is called or whenpanel.per.event = TRUE).errorCharacter string specifying the method for SEs and CIs used internally. For"survival"without weights, choose one of"greenwood"(default),"tsiatis", or"if". For"competing-risk"without weights, choose one of"delta"(default),"aalen", or"if". SEs and CIs based on influence functions ("if") is recommended for weighted analysis.conf.typeCharacter specifying the method of transformation for CIs used internally (default"arcsine-square root").conf.intNumeric two-sided level of CIs (default0.95).type.yCharacter string specifying the y-scale. For survival/CIF curves,"surv"implies survival probabilities and"risk"implies CIF (1-survival in simple survival settings). Specify"cumhaz"to plot cumulative hazard or"cloglog"to generate a complementary log-log plot. IfNULL, a default is chosen fromoutcome.typeor the survfit object.label.x,label.yOptional vectors/lists of axis labels per panel.label.strataOptional list of character vectors for legend labels per panel (passed tocifplot()).order.strataOptional list of character vectors for ordering labels per panel (passed tocifplot()).limits.x,limits.yOptional vectors/lists of numeric length-2 axis limits per panel.breaks.x,breaks.yOptional vectors/lists of axis breaks per panel (forwarded tobreaks.x/breaks.yincifplot()).add.conf,add.censor.mark,add.competing.risk.mark,add.intercurrent.event.mark,add.quantileOptional logical vectors/lists per panel to toggle features incifplot(). IfNULL, sensible defaults are used (CI/Censor on; others off).rows.columns.panelInteger vectorc(nrow, ncol)specifying the grid size.title.panel,subtitle.panel,caption.panelOptional strings for panel annotation.tag.panelPassed topatchwork::plot_annotation(tag_levels = ...).title.plotOptional length-2 character vector, titles for base/inset plots wheninset.panel = TRUE.legend.positionPosition of legends:"top","right","bottom","left", or"none".legend.collectIfTRUE(grid mode), collect legends across subplots.inset.panelIfTRUE, place the second plot as an inset over the first.inset.left,inset.bottom,inset.right,inset.topNumeric positions (0–1) of the inset box.inset.align.toOne of"panel","plot", or"full".inset.legend.positionLegend position for the inset plot (e.g.,"none").filename.ggsaveCharacter save the composed panel with the path and name specified.width.ggsaveNumeric specify width of the composed panel.height.ggsaveNumeric specify height of the composed panel.dpi.ggsaveNumeric specify dpi of the composed panel.print.panelLogical. IfTRUE, the composed patchwork object is printed immediately (for interactive use). IfFALSE, the object is returned invisibly so that it can be assigned, modified, or saved. Kept for backward compatibility.engineCharacter scalar selecting the internal plotting engine. Currently only"cifplot"is supported and used to construct each panelcifplot_single(). This argument is reserved for future extensions....Additional arguments forwarded tocifplot(e.g.,style,font.family,font.size, etc.). Panel-wise overrides provided via explicit arguments take precedence over....
polyreg()
-
nuisance.modelAformuladescribing the outcome and nuisance covariates, excluding the exposure of interest. The left-hand side must beEvent(time, status)orsurvival::Surv(time, status). -
exposureA character string giving the name of the categorical exposure variable indata. -
strataOptional character string with the name of the stratification variable used to adjust for dependent censoring (defaultNULL). -
dataA data frame containing the outcome, exposure and nuisance covariates referenced bynuisance.model. -
na.actionA function specifying the action to take on missing values (defaultna.omit). -
code.event1Integer code of the event of interest (default1). -
code.event2Integer code of the competing event (default2). -
code.censoringInteger code of censoring (default0). -
code.exposure.refInteger code identifying the reference exposure category (default0). -
effect.measure1Character string specifying the effect measure for the primary event. Supported values are"RR","OR"and"SHR". -
effect.measure2Character string specifying the effect measure for the competing event. Supported values are"RR","OR"and"SHR". -
time.pointNumeric time point at which the exposure effect is evaluated. Required for survival and competing risk analyses. -
outcome.typeCharacter string selecting the outcome type. Valid values are"competing-risk","survival","binomial","proportional-survival"and"proportional-competing-risk". Defaults to"competing-risk". IfNULL(default), the function automatically infers the outcome type from the data: if the event variable has more than two unique levels,"competing-risk"is assumed; otherwise,"survival"is used. You can also use abbreviations such as"S"or"C". Mixed or ambiguous inputs (e.g.,c("S", "C")) trigger automatic detection based on the event coding indata. -
conf.intNumeric two-sided level of CIs (default0.95). -
report.nuisance.parameterLogical ifTRUE, the returned object includes estimates of the nuisance model parameters (defaultFALSE). -
report.optim.convergenceLogical ifTRUE, optimization convergence summaries are returned (defaultFALSE). -
report.sandwich.confLogical orNULL. WhenTRUE, CIs based on sandwich variance are computed. WhenFALSE, they are omitted (defaultTRUE). This CI is default for time-point models ("outcome.type=COMPETING-RISK","survival"or"binomial") and is not available otherwise. -
report.boot.confLogical orNULL. WhenTRUE, bootstrap CIs are computed. WhenFALSE, they are omitted. IfNULL, the function chooses based onoutcome.type(defaultNULL). This CI is default for proportional models (outcome.type="proportional-competing-risk"or"proportional-survival"). -
boot.bcaLogical indicating the bootstrap CI method. UseTRUEfor bias-corrected and accelerated intervals orFALSEfor the normal approximation (default toFALSE). -
boot.replicationsInteger giving the number of bootstrap replications (default to200). -
boot.seedNumeric seed used for resampling of bootstrap. -
nleqslv.methodCharacter string specifying the solver used innleqslv(). Available choices are"Broyden"and"Newton". -
optim.parameter1Numeric tolerance for convergence of the outer loop (default1e-6). -
optim.parameter2Numeric tolerance for convergence of the inner loop (default1e-6). -
optim.parameter3Numeric constraint on the absolute value of parameters (default100). -
optim.parameter4Integer maximum number of outer loop iterations (default50). -
optim.parameter5Integer maximum number ofnleqslv()iterations per outer iteration (default50). -
optim.parameter6Integer maximum number of iterations for the Levenberg-Marquardt routine (default50). -
optim.parameter7Numeric convergence tolerance for the Levenberg-Marquardt routine (default1e-10). -
optim.parameter8Numeric tolerance for updating the Hessian in the Levenberg-Marquardt routine (default1e-6). -
optim.parameter9Numeric starting value for the Levenberg-Marquardt damping parameter lambda (default1e-6). -
optim.parameter10Numeric upper bound for lambda in the Levenberg-Marquardt routine (default40). -
optim.parameter11Numeric lower bound for lambda in the Levenberg-Marquardt routine (default0.025). -
optim.parameter12Numeric multiplicative increment applied to lambda when the Levenberg-Marquardt step is successful (default to2). -
optim.parameter13Numeric multiplicative decrement applied to lambda when the Levenberg-Marquardt step is unsuccessful (default0.5). -
data.initial.valuesOptional data frame providing starting values for the optimization (defaultNULL). -
normalize.covariateLogical indicating whether covariates should be centered and scaled prior to optimization (defaultTRUE). -
terminate.time.pointLogical indicating whether time points that contribute estimation are terminated by min of max follow-up times of each exposure level (defaultTRUE). -
prob.boundNumeric lower bound used to internally truncate probabilities away from 0 and 1 (default1e-7).