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
equal
: equal sample sizesrandom
: random sample sizes
- hr
the hazard ratio 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.08759590 0.4839653 0.8273349
#> 2 taumo2 0.6563674 0.01815766 0.6207791 0.6919558
#> 3 tauo 0.5042325 0.05508774 0.3962625 0.6122024
#> 4 tauso 0.7317075 0.08876159 0.5577379 0.9056770
# 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.06634978 0.5074659 0.7675522
#> 2 taumo2 0.6376534 0.01635919 0.6055899 0.6697168
#> 3 tauo 0.5999920 0.06012728 0.4821447 0.7178393
#> 4 tauso 0.7182260 0.07404910 0.5730924 0.8633595