Random number generation for Correlated Survival and Ordinal Outcomes
generate_rv.Rd
This function generates random number vectors of correlated survival and ordinal outcomes. Gaussian or Clayton copula is used to specify the correlation structure. Marginal distributions are based on a exponential distribution. The order outcome is generated by discretizing one of the correlated random numbers based on the quantile.
Arguments
- target_tau
the target value of the Kendall's \(\tau\)
- num_samples
the number of simulation samples
- censoring_rate
the censoring rate
- copula_type
copula type (default = "Gaussian")
Gaussian
: Gaussian copulaClayton
: Clayton copula
- x_levels
the number of category for the ordinal outcome (default = 5)
- x_probs
the proportion of each level of x (default = "equal")
equal
: equal sample sizesrandom
: random sample sizes
- x_values
the cutoff values of x. If
x_values
is specified,x_probs
is ignored.x_levels - 1
and the lengths ofx_levels
must be equal.- hr
the hazard rate for survival time (default = 1.0)
Value
y
: the survival time or censoring time outcome vectorevent
: the event indicator outcome vectorx
: the ordinal (or continuous) outcome vectort
: the true survival time vector (for simulation)c
: the true censoring time vector (for simulation)x0
:x
before discretization (for simulation)
Examples
library(surrosurvo)
set.seed(1234)
data <- generate_rv(0.7, 500, 0.3)
surrosurvo(data$y, data$event, data$x)
#> method tau se lcl ucl
#> 1 taumo1 0.6556501 0.02496919 0.6067114 0.7045888
#> 2 taumo2 0.6563674 0.01726476 0.6225291 0.6902057
#> 3 tauo 0.5042325 0.01834774 0.4682716 0.5401934
#> 4 tauso 0.7317075 0.02600037 0.6807477 0.7826672
# 5-level ordinal variable with Clayton copula
data <- generate_rv(0.7, 500, 0.1, copula_type = "Clayton", x_levels = 5)
surrosurvo(data$y, data$event, data$x)
#> method tau se lcl ucl
#> 1 taumo1 0.6375091 0.01774413 0.6027312 0.6722869
#> 2 taumo2 0.6376534 0.01599582 0.6063021 0.6690046
#> 3 tauo 0.5999920 0.01633828 0.5679696 0.6320144
#> 4 tauso 0.7182260 0.01822755 0.6825006 0.7539513