| node_aalen | R Documentation |
Data from the parents is used to generate the node using Aalen additive hazards regression using the inversion method. Currently, only time-constant coefficients and a constant baseline hazard function are supported.
node_aalen(data, parents, formula=NULL, betas, intercept,
cens_dist=NULL, cens_args, name,
as_two_cols=TRUE, left=0)
data |
A |
parents |
A character vector specifying the names of the parents that this particular child node has. If non-linear combinations or interaction effects should be included, the user may specify the |
formula |
An optional |
betas |
A numeric vector with length equal to |
intercept |
A single number, specifying the intercept of the model. |
cens_dist |
A single character naming the distribution function that should be used to generate the censoring times or a suitable function. For example, |
cens_args |
A list of named arguments which will be passed to the function specified by the |
name |
A single character string specifying the name of the node. |
as_two_cols |
Either |
left |
A single number, specifying the left-truncation time. If set to something > 0, only times that are larger than this value will be generated. Is set to 0 by default, so that no left-truncation is used. |
This function generates survival times according to a Aalen additive hazards model with time-constant beta coefficients and a time-constant baseline hazard. Time-dependent effects or time-dependent baseline hazards are currently not supported. To also include censoring, this function allows the user to supply a function that generates random censoring times. If the censoring time is smaller than the generated survival time, the individual is considered censored.
Like the other time-to-event based node type functions, this function usually adds two columns to the resulting dataset instead of one. The first column is called paste0(name, "_status") and is a logical variable, where TRUE indicates that the event has happened and FALSE indicates right-censoring. The second column is named paste0(name, "_time") and includes the survival or censoring time corresponding to the previously mentioned event indicator. This is the standard format for right-censored time-to-event data without time-varying covariates. If no censoring is applied, this behavior can be turned off using the as_two_cols argument.
Returns a data.table of length nrow(data) containing two columns if as_two_cols=TRUE and always when cens_dist is specified. In this case, both columns start with the nodes name and end with _status and _time. The first is a logical vector, the second a numeric one. If as_two_cols=FALSE and cens_dist is NULL, a numeric vector is returned instead.
Robin Denz
Aalen, Odd O. A Linear Regression Model for the Analysis of Life Times. Statistics in Medicine. 1989; (8): 907-925.
library(simDAG)
set.seed(34543)
# define DAG, here with two baseline covariates and
# no censoring of Y
dag <- empty_dag() +
node("A", type="runif") +
node("B", type="rbernoulli") +
node("Y", type="aalen", formula= ~ 0.1 + A*0.2 + B*-0.05)
sim_dat <- sim_from_dag(dag=dag, n_sim=1000)
head(sim_dat)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.