Learn R Programming

SimHaz (version 0.1)

tdSim.method2: Simulate 1 dataframe (1 simulation) of time-dep exposure under method 2

Description

This function simulate Survival Data. It generates a simulated dataset with time-dependent exposure under method 2 with a user-specified list of parameters as input.

Usage

tdSim.method2(N,duration, lambda12, lambda23=NULL, lambda13, 
    HR=NULL, exp.prop,rateC, min.futime = 0, min.postexp.futime = 0)

Arguments

N
Number of subjects
duration
Duration of the study. This is used in censoring
lambda12
Lambda12 parameter to control time to exposure
lambda23
Lambda23 parameter to control time to event after exposure
lambda13
Lambda13 parameter to control time to event in the control group
HR
Hazard Ratio. This input is optional. If HR is set and lambda23 is not set, lambda23 = lambda13*HR
exp.prop
A numeric value between 0 and 1 (not include 0 and 1) that represents the proportion of subjects that are assigned with an exposure
rateC
Rate of the exponential distribution to generate censoring times
min.futime
A numeric value that represents minimum follow-up time (in months). The default value is 0, which means no minimum follow-up time is considered. If it has a positive value, this argument will help exclude subjects that only spend a short amount of time in
min.postexp.futime
A numeric value that represents minimum post-exposure follow-up time (in months). The default value is 0, which means no minimum post-exposure follow-up time is considered. If it has a positive value, this argument will help exclude subjects that only spe

Value

  • idInteger that represents a subject's identification number
  • startFor counting process formulation. Represents the start of each time interval
  • stopFor counting process formulation. Represents the end of each time interval
  • statusIndicator of event. status = 1 when event occurs and 0 otherwise
  • xIndicator of exposure. x = 1 when exposed and 0 otherwise

Details

Simulata a Survival dataset using a modified version of illness-death model controlled by lambda12, lambda23, lambda13

Examples

Run this code
sim_data <- tdSim.method2(500, duration=24,lambda12=1.3,lambda23=0.04, 
    lambda13=0.03, exp.prop=0.2,rateC=0.05, min.futime=4, min.postexp.futime=4)

Run the code above in your browser using DataLab