Description Usage Arguments Details Value Author(s) Examples

This function plots a power curve at each time and returns a subsetted data frame that match the list of input parameters.

1 2 |

`table_df` |
A data frame read from a .csv file of a format output from the getpower.method1 function. |

`N` |
Number of subjects needs to be screened |

`type` |
A text string indicating the what type of dataset is of interest. Either one of "fixed" or "td" should be inputted |

`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 |

`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 |

`show.plot` |
A logical value indicating whether to output a power curve or not. The default value is TRUE |

`newplot` |
A logical value indicating whether to create a new plot or add to an existing plot |

`col,lty,lwd,pch` |
Graphical parameters as in the regular plot function in R |

The gist of this function is that the user can check the plot with the values in the output data frame. Moreover, it is flexible that the user can choose to only output the data frame in order to plot their own graph (such as add titles or legends) based on the data. The user can also add as many lines as possible to an existing power curve plot so that he/she is allowed to compare different scenarios.

A data.frame object with columns corresponding to

`i_N` |
Number of subjects needs to be screened, specified by the user |

`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 |

`i_beta` |
Input value of regression coefficient (log hazard ratio) |

`pow` |
Simulated statistical power from the Cox regression model on data with time-dependent exposure |

Danyi Xiong, Teeranan Pokaprakarn, Hiroto Udagawa, Nusrat Rabbee

Maintainer: Nusrat Rabbee <[email protected]>

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | ```
# We recommend setting nSim to at least 500. It is set to 10 in the example to
# reduce run time for CRAN submission.
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")
ret2 <- 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 = 0, output.fn ="output.csv")
# Read in .csv file as a data frame
tb <- read.csv("output.csv", header = TRUE, sep = ",")
# Visualize the subsetted data frame of interest and create a new plot
visualize1 <- plot_power(table_df = tb, N = 600, type = "td", exp.prop = 0.2,
min.futime = 4, min.postexp.futime = 4, show.plot = TRUE, newplot = TRUE,
col = "red", lty = 1, lwd = 2, pch = 16)
# Add a different power curve to the previously created plot
visualize2 <- plot_power(table_df = tb, N = 600, type = "td", exp.prop=0.2,
min.futime = 4, min.postexp.futime = 0, show.plot = TRUE, newplot = FALSE,
col = "blue", lty = 1, lwd = 2, pch = 16)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.