nice_plots: Funciton to plot nice plots

Description Usage Arguments Details Value Author(s) References Examples

View source: R/nice_plots.R

Description

OPWpaper has stored .RDATA from the simulations. This function will use those simulated data to plot

Usage

1
2
3
nice_plots(x_vec, y_matrix, fdr = TRUE, power = TRUE,
  low_eff_plot = FALSE, null = NULL, cv = NULL, ey = NULL, cor = NULL,
  figure = c("ranksProb", "nullPropVsPower", "effectVsFPFP", "CV"))

Arguments

x_vec

A numeric vector corresponds to the x-axis

y_matrix

A numeric matrix corresponds to the y-axix

fdr

A character vector of ("TRUE" or "FALSE"), determine whether the FDR or FWER will be used, default is FDR.

power

A character vector of ("TRUE" or "FALSE"), determine whether the power will be plotted, default is TRUE

low_eff_plot

A character vector of ("TRUE" or "FALSE"), deteremine whether the power of the low effect sizes will be plotted, default is FALSE

null

Numeric, proportion of the true null if power or FDR/FWER is plotted against the effect sizes

cv

Numeric, coefficient of variation of the test statistics

ey

Numeric, the value of the effect size if power is plotted against the proportion of the true null tests.

cor

Numeric, the correlation coefficient if the figure is for the ranks probability

figure

A character vector of c("ranksProb", "nullPropVsPower", "effectVsFPFP", "CV"), determine the types of figure will be plotted

Details

OPWeight package proposed methods to compute the ranks probabilities of the covariate given the test effect size to obtian the optimal power. This function is desigend to plot the power curves under different scenerios. Note that, we alreday simulated power and FDR/FWER for the different scenerios and stored in the packages OPWpaper as .RDATA. This function will only be able to use those data sets or data with the similar formats.

Value

A plot of multiple curves

Author(s)

Mohamad S. Hasan, shakilmohamad7@gmail.com

References

Hasan and Schliekelman (2017)

Examples

 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
27
28
29
30
31
32
33
# examples from the previously stored .RDATA
# plot of power against the effect sizes

load(system.file("simulations/results", "simu_fwerPowerFdrPower_cont.RDATA",
                package = "OPWpaper"), envir = environment())
ey_vec <- c(seq(0, 1, .2), 2, 3, 5, 8)
p_.5_eq_power <- nice_plots(x_vec = ey_vec, y_matrix = FwerPowerFdrPower2e1,
                                null = 50, figure = "effectVsFPFP")

# p_.9_eq_power <- nice_plots(x_vec = ey_vec, y_matrix = FwerPowerFdrPower4e1,
#                                null = 90, figure = "effectVsFPFP")
# p_.99_eq_power<- nice_plots(x_vec = ey_vec, y_matrix = FwerPowerFdrPower5e1,
#                                null = 99, figure = "effectVsFPFP")

# p_.5_low_ef_eq_power <- nice_plots(x_vec = ey_vec, y_matrix = FwerPowerFdrPower2e1,
#                       null = 50, low_eff_plot = TRUE, figure = "effectVsFPFP")
# p_.9_low_ef_eq_power <- nice_plots(x_vec = ey_vec, y_matrix = FwerPowerFdrPower4e1,
#                       null = 90, low_eff_plot = TRUE, figure = "effectVsFPFP")
# p_.99_low_ef_eq_power<- nice_plots(x_vec = ey_vec, y_matrix = FwerPowerFdrPower5e1,
#                       null = 99, low_eff_plot = TRUE, figure = "effectVsFPFP")

# p_eq_power = plot_grid(p_.5_eq_power, p_.9_eq_power, p_.99_eq_power,
#                    p_.5_low_ef_eq_power, p_.9_low_ef_eq_power, p_.99_low_ef_eq_power,
#                    ncol = 3, labels = letters[1:3], align = 'hv')
# title <- ggdraw() + draw_label("Power: et = ey")
# plot_grid(title, p_eq_power, legend, ncol = 1, rel_heights=c(.1, 1, .1))

# plot of power against the true propotion of the null
# mat_ef.6 <- rbind(FwerPowerFdrPower1f1[13:16, 4], FwerPowerFdrPower2f1[13:16, 4],
# FwerPowerFdrPower3f1[13:16, 4], FwerPowerFdrPower4f1[13:16, 4],
# FwerPowerFdrPower5f1[13:16, 4])
# p_ef.6 <- nice_plots(x_vec = nullProp, y_matrix = mat_ef.6, fdr = TRUE,
# power = TRUE, ey = 0.6, figure = "nullPropVsPower")

mshasan/OPWpaper documentation built on March 3, 2021, 7:02 a.m.