R: Calculate power for the Cox proportional hazard model with...
getpower.method1
R Documentation
Calculate power for the Cox proportional hazard model with
time-dependent exposure using method 1
Description
This functions runs nSim (Number of simulations, specified by the user) Monte Carlo simulations, each time it calling tdSim.method1 internally. The function returns a data frame of scenario-specific parameters (including statistical power) and appends the output to a file with file name specified in the input parameters list. The user also have an option whether to plot an incidence plot or not.
Length of the study in months; the default value is 24 (months).
med.TTE.Control
Median time to event for control group; the default value is 24 (months).
rho
Shape parameter of the Weibull distribution. Default is 1, which will generate survival times by using the exponential distribution.
med.TimeToCensor
Median time to censoring for all subjects. The default value is 14 (months).
beta
A numeric value that represents the exposure effect, which is the regression coefficient (log hazard ratio) that represent the magnitude of the relationship between the exposure covariate and the risk of an event.
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.
type
A text string indicating the what type of dataset is of interest. Either one of "fixed" or "td" should be inputted.
scenario
Any text string inputted by the user as an option to name a scenario that is being simulated. The use can simply put " " if he/she decide to not name the scenario.
prop.fullexp
A numeric value in interval [0, 1) that represents the proportion of exposed subjects that are fully exposed from the beginning to the end of the study. The default value is 0, which means all exposed subjects have an exposure status transition at some point during the study.
maxrelexptime
A numeric value in interval (0, 1] that represents the maximum relative exposure time. Suppose this value is p, the exposure time for each subject is then uniformly distributed from 0 to p*subject's time in the study. The default value is 1, which means all exposed subjects have an exposure status transition at any point during the time in study.
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 the study.
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 spend a short amount of time in the study after their exposure.
output.fn
A .csv filename to write in the output. If the filename does not exist, the function will create a new .csv file for the output.
simu.plot
A logical value indicating whether or not to output an incidence plot. The default value is FALSE.
Details
The function calculates power based on the Cox regression model, which calls the coxph function from the survival library using the the simulated data from tdSim.method1.
Value
A data.frame object with columns corresponding to
i_scenario
Scenario name specified by the user
i_type
Dataset type specified by the user
i_N
Number of subjects to be screened, specified by the user
i_min.futime
Minimum follow-up time to be considered, specified by the user
i_min.postexp.futime
Minimum post-exposure follow-up time to be considered, specified by the user
i_exp.prop
Exposure rate specified by the user
i_lambda
Value of the scale parameter of the Weibull distribution to generate survival times. Calculated from median time to event for control group, which is specified by the user.
i_rho
User-specified value of the shape parameter of the Weibull distribution to generate survival times
i_rateC
Rate of the exponential distribution to generate censoring times. Calculated from median time to censoring, which is specified by the user. i_beta Input value of regression coefficient (log hazard ratio).
N_eff
Simulated number of evaluable subjects, which is the resulting number of subjects with or without considering minimum follow-up time and/or minimum post-exposure follow-up time.
N_effexp_p
Simulated proportion of exposed subjects with or without considering minimum follow-up time and/or minimum post-exposure follow-up time.
bhat
Simulated value of regression coefficient (log hazard ratio)
HR
Simulated value of hazard ratio
d
Simulated number of events in total
d_c
Simulated number of events in control group
d_exp
Simulated number of events in exposed group
mst_c
Simulated median survival time in control group
mst_exp
Simulated median survival time in exposed group
pow
Simulated statistical power from the Cox regression model on data with
time-dependent exposure
Therneau T (2015). A Package for Survival Analysis in S. version 2.38,
http://CRAN.R-project.org/package=survival
Examples
# Install the survival package if needed.
library(survival)
# We recommend setting nSim to at least 500. It is set to 10 in the example to
# reduce run time for CRAN submission.
# Run 10 simulations. Each time simulate a dataset of 600 subjects with
# time-dependent exposure with both minimum follow-up time (4 months) and
# minimum post-exposure follow-up time (4 months) imposed. Also consider a
# quick exposure after entering the study for each exposed subject. Set the
# maximum relative exposure time to be 1/6.
# Set the duration of the study to be 24 months; the median time to event for
# control group to be 24 months; exposure effect to be 0.3; median time to
# censoring to be 14 months; and exposure proportion to be 20%.
ret <- getpower.method1(nSim = 10, N = 600, b = 0.3, exp.prop = 0.2,
type = "td", scenario = " ", maxrelexptime = 1/6, min.futime = 4,
min.postexp.futime = 4, output.fn = "output.csv")
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(SimHaz)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/SimHaz/getpower.method1.Rd_%03d_medium.png", width=480, height=480)
> ### Name: getpower.method1
> ### Title: Calculate power for the Cox proportional hazard model with
> ### time-dependent exposure using method 1
> ### Aliases: getpower.method1
> ### Keywords: Power_Calculation
>
> ### ** Examples
>
> # Install the survival package if needed.
>
> library(survival)
>
> # We recommend setting nSim to at least 500. It is set to 10 in the example to
> # reduce run time for CRAN submission.
>
> # Run 10 simulations. Each time simulate a dataset of 600 subjects with
> # time-dependent exposure with both minimum follow-up time (4 months) and
> # minimum post-exposure follow-up time (4 months) imposed. Also consider a
> # quick exposure after entering the study for each exposed subject. Set the
> # maximum relative exposure time to be 1/6.
>
> # Set the duration of the study to be 24 months; the median time to event for
> # control group to be 24 months; exposure effect to be 0.3; median time to
> # censoring to be 14 months; and exposure proportion to be 20%.
>
>
> ret <- getpower.method1(nSim = 10, N = 600, b = 0.3, exp.prop = 0.2,
+ type = "td", scenario = " ", maxrelexptime = 1/6, min.futime = 4,
+ min.postexp.futime = 4, output.fn = "output.csv")
>
>
>
>
>
>
> dev.off()
null device
1
>