forked from pharmaverse/ggsurvfit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSurv_CNSR.Rd
More file actions
64 lines (56 loc) · 2.66 KB
/
Surv_CNSR.Rd
File metadata and controls
64 lines (56 loc) · 2.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/Surv_CNSR.R
\name{Surv_CNSR}
\alias{Surv_CNSR}
\title{Create a Survival Outcome from CDISC Data}
\usage{
Surv_CNSR(AVAL, CNSR)
}
\arguments{
\item{AVAL}{The follow-up time. The follow-up time is assumed to originate from zero.
When no argument is passed, the default value is a column/vector named \code{AVAL}.}
\item{CNSR}{The censoring indicator where \verb{>=1=censored} and \code{0=death/event}.
When no argument is passed, the default value is a column/vector named \code{CNSR}.}
}
\value{
Object of class 'Surv'
}
\description{
The aim of \code{Surv_CNSR()} is to map the inconsistency in data convention between
the \href{https://cran.r-project.org/package=survival}{survival} package and
\href{https://www.cdisc.org/standards/foundational/adam/adam-basic-data-structure-bds-time-event-tte-analyses-v1-0}{CDISC ADaM ADTTE data model}.
The function creates a survival object (e.g. \code{survival::Surv()}) that
uses CDISC ADaM ADTTE coding conventions and converts the arguments to the
status/event variable convention used in the
\href{https://cran.r-project.org/package=survival}{survival} package.
The \code{AVAL} and \code{CNSR} arguments are passed to
\code{survival::Surv(time = AVAL, event = CNSR == 0, type = "right", origin = 0)}.
}
\section{Details}{
The \code{Surv_CNSR()} function creates a survival object utilizing the
expected data structure in the CDISC ADaM ADTTE data model,
mapping the CDISC ADaM ADTTE coding conventions with the expected
status/event variable convention used in the survival package---specifically,
the coding convention used for the status/event indicator.
The survival package expects the status/event indicator in the
following format: \code{0=alive}, \code{1=dead}. Other accepted choices are
\code{TRUE}/\code{FALSE} (\code{TRUE = death}) or \code{1}/\code{2} (\code{2=death}).
A final but risky option is to omit the indicator variable, in which case
all subjects are assumed to have an event.
The CDISC ADaM ADTTE data model adopts a different coding convention for
the event/status indicator. Using this convention, the event/status variable
is named \code{'CNSR'} and uses the following coding: \code{censor >= 1}, \code{status/event = 0}.
}
\examples{
# Use the `Surv_CNSR()` function with ggsurvfit functions
survfit2(formula = Surv_CNSR() ~ STR01, data = adtte) \%>\%
ggsurvfit() +
add_confidence_interval()
# Use the `Surv_CNSR()` function with functions from other packages as well
survival::survfit(Surv_CNSR() ~ STR01, data = adtte)
survival::survreg(Surv_CNSR() ~ STR01 + AGE, data = adtte) \%>\%
broom::tidy()
}
\seealso{
\code{\link[survival:Surv]{survival::Surv()}}
}