bc_plot: Bias Correction Plot

Description Usage Arguments Examples

Description

This function plots the results of bias_correction. It allows for visuallizing error rates deemed acceptable by the user

Usage

1
2
bc_plot(p, lower = 0.045, upper = 0.055, col_accept = "lightblue",
  col_reject = "indianred")

Arguments

p

a vector of p-values returned from bias_correction

lower

lower bound of what is considered an acceptable error rate

upper

upper bound of what is considered an acceptable error rate

col_accept

color of bias corrected p-value that falls within lower and upper

col_reject

color of bias corrected p-value that does not fall within lower and upper

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
bc_plot(p, lower = 0.025, upper = 0.065, col_accept = "purple", col_reject = "orange")

# plot based on for loop results
     
# number of litters    
     n_lit <- seq(5, 20, 5)
     
#--ncol = 4 (four returned false positive rates)
#--nrow = length of n_lit
 mat <- matrix(ncol = 6, nrow = length(n_lit))
 for(j in 1:length(n_lit)){
 lit <- n_lit[j] 
 mat[j, 1:6] <- bias_correction(nsim = 100, icc = 0.5, 
                                       v_overall = 10, n_litters = lit , 
                                       pups_litter = 4)[1:6]
                                       }
                                       
res_df <- as.data.table(cbind(n_lit, mat))
colnames(res_df) <- c("n_litters", "d1", "d2", "d3", "d4", "d5", "dm")
res_df


par(mfrow=c(2,2))

for(i in 1:nrow(res_df)){
cond <- mat[i,-1]
bc_plot(cond)
abline(h = 0.05, col = "red", lty = 10, lwd = 2)
abline(h = 0)
}

dev.off()
 

donaldRwilliams/litterEffects documentation built on May 30, 2019, 9:42 p.m.