Learn R Programming

sprinter (version 1.1.0)

simul.int: Function for simulating survival data with interactions

Description

simul.int simulates survival data with exponentially distributed survival times where interactions are included. The interactions are generated by variables without effect.

Usage

simul.int(seed, n = 100, p = 1000,
                              n.main = 2,
                              n.int = 2,
                              beta.main=2, 
                              beta.int = 4, 
                              censparam = 1/5, 
                              lambda = 1/20)

Arguments

seed
seed for random number generator.
n
number of individuals in the data set.
p
number of covariates in the data set.
n.main
number of main effects with effects.
n.int
number of interactions with effects.
beta.main
effect size of main effects.
beta.int
effect size of interaction effects.
censparam
value for censoring Parameter.
lambda
value for baseline hazard.

Value

  • simul.int returns the simulated data set and the information about the effect sizes:
  • datasimulated dataset with p+2 columns and n rows. The last two columns consist of exponentially distributed survival time (obs.time) and status (obs.status).
  • infoinformation about the effect sizes of the main effects and of the included interactions.

Details

The function simul.int creates exponentially distributed survival times with baseline hazard lambda. The number of covariates is p and the sample size is n. All covariates are standard normal distributed. The first n.main columns correspond to the main effects and the following n.int columns correspond to the interactions. The effect sizes of the main effects are in absolute value beta.main, whereupon the first floor(n.main/2) variables have positive effect sizes and the rest of the main effects have effect size -beta.main. The effect sizes of the interactions are in absolute value beta.inter, where half of them are positive and half of them are negative like for the main effects.

Examples

Run this code
# Create survival data with interactions:
simul <- simul.int(287578,n = 200, p = 1000,
                          beta.int = 1.0,
                          beta.main = 0.9, 
                          censparam = 1/20, 
                          lambda = 1/20)
#Show the effect sizes of the main effects and interactions of the simulated data set:
simul$info

# Extract the data set:
data <- simul$data

# Plot the Kaplan Meier:
simul.fit <- survfit(Surv(obs.time,obs.status) ~ 1, data = data)
plot(simul.fit)

Run the code above in your browser using DataLab