EVOLUTION-MANAGER
Edit File: finegray.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Create data for a Fine-Gray model</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for finegray {survival}"><tr><td>finegray {survival}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Create data for a Fine-Gray model</h2> <h3>Description</h3> <p>The Fine-Gray model can be fit by first creating a special data set, and then fitting a weighted Cox model to the result. This routine creates the data set. </p> <h3>Usage</h3> <pre> finegray(formula, data, weights, subset, na.action= na.pass, etype, prefix="fg", count, id, timefix=TRUE) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>formula</code></td> <td> <p>a standard model formula, with survival on the left and covariates on the right. </p> </td></tr> <tr valign="top"><td><code>data</code></td> <td> <p>an optional data frame, list or environment (or object coercible by as.data.frame to a data frame) containing the variables in the model. </p> </td></tr> <tr valign="top"><td><code>weights</code></td> <td> <p>optional vector of observation weights</p> </td></tr> <tr valign="top"><td><code>subset</code></td> <td> <p>an optional vector specifying a subset of observations to be used in the fitting process. </p> </td></tr> <tr valign="top"><td><code>na.action</code></td> <td> <p>a function which indicates what should happen when the data contain NAs. The default is set by the na.action setting of options. </p> </td></tr> <tr valign="top"><td><code>etype</code></td> <td> <p>the event type for which a data set will be generated. The default is to use whichever is listed first in the multi-state survival object. </p> </td></tr> <tr valign="top"><td><code>prefix</code></td> <td> <p>the routine will add 4 variables to the data set: a start and end time for each interval, status, and a weight for the interval. The default names of these are "fgstart", "fgstop", "fgstatus", and "fgwt"; the <code>prefix</code> argument determines the initial portion of the new names. </p> </td></tr> <tr valign="top"><td><code>count</code></td> <td> <p>a variable name in the output data set for an optional variable that will contain the the replication count for each row of the input data. If a row is expanded into multiple lines it will contain 1, 2, etc. </p> </td></tr> <tr valign="top"><td><code>id</code></td> <td> <p>optional, the variable name in the data set which identifies subjects.</p> </td></tr> <tr valign="top"><td><code>timefix</code></td> <td> <p>process times through the <code>aeqSurv</code> function to eliminate potential roundoff issues.</p> </td></tr> </table> <h3>Details</h3> <p>The function expects a multi-state survival expression or variable as the left hand side of the formula, e.g. <code>Surv(atime, astat)</code> where <code>astat</code> is a factor whose first level represents censoring and remaining levels are states. The output data set will contain simple survival data (status = 0 or 1) for a single endpoint of interest. In the output data set subjects who did not experience the event of interest become censored subjects whose times are artificially extended over multiple intervals, with a decreasing case weight from interval to interval. The output data set will normally contain many more rows than the input. </p> <p>Time dependent covariates are allowed, but not (currently) delayed entry. If there are time dependent covariates, e.g.., the input data set had <code>Surv(entry, exit, stat)</code> as the left hand side, then an <code>id</code> statement is required. The program does data checks in this case, and needs to know which rows belong to each subject. </p> <p>See the competing risks vignette for more details. </p> <h3>Value</h3> <p>a data frame</p> <h3>Author(s)</h3> <p>Terry Therneau</p> <h3>References</h3> <p>Fine JP and Gray RJ (1999) A proportional hazards model for the subdistribution of a competing risk. JASA 94:496-509. </p> <p>Geskus RB (2011). Cause-Specific Cumulative Incidence Estimation and the Fine and Gray Model Under Both Left Truncation and Right Censoring. Biometrics 67, 39-49. </p> <h3>See Also</h3> <p><code><a href="coxph.html">coxph</a></code>, <code><a href="aeqSurv.html">aeqSurv</a></code></p> <h3>Examples</h3> <pre> # Treat time to death and plasma cell malignancy as competing risks etime <- with(mgus2, ifelse(pstat==0, futime, ptime)) event <- with(mgus2, ifelse(pstat==0, 2*death, 1)) event <- factor(event, 0:2, labels=c("censor", "pcm", "death")) # FG model for PCM pdata <- finegray(Surv(etime, event) ~ ., data=mgus2) fgfit <- coxph(Surv(fgstart, fgstop, fgstatus) ~ age + sex, weight=fgwt, data=pdata) # Compute the weights separately by sex adata <- finegray(Surv(etime, event) ~ . + strata(sex), data=mgus2, na.action=na.pass) </pre> <hr /><div style="text-align: center;">[Package <em>survival</em> version 2.44-1.1 <a href="00Index.html">Index</a>]</div> </body></html>