Skip to content

Commit

Permalink
Compute significance code based on adjusted p-value
Browse files Browse the repository at this point in the history
  • Loading branch information
tischi committed Mar 14, 2019
1 parent 12134a1 commit ceecc19
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions functions.r
Original file line number Diff line number Diff line change
Expand Up @@ -1230,11 +1230,7 @@ htmTreatmentSummary <- function(data, measurements, col_Experiment, col_Treatmen

t_test__p_value <- 2 - 2 * pt( abs(t$statistic), df = n - (nBlocks-1) - 2 )
t_test__estimate <- t$estimate[2]
t_test__signCode <- ifelse(t_test__p_value<0.001,"***",
ifelse(t_test__p_value<0.01,"**",
ifelse(t_test__p_value<0.05,"*",
ifelse(t_test__p_value<0.1,"."," "
))))

}

if ( (sum(d$treatment=="control")>=1) & (sum(d$treatment==treat)>=1) ) {
Expand Down Expand Up @@ -1305,7 +1301,7 @@ htmTreatmentSummary <- function(data, measurements, col_Experiment, col_Treatmen
results$median__means[i] = median__means
results$t_test__p_value[i] = t_test__p_value
results$t_test__p_value_adjusted[i] = NA # this will be computed below after the treatment loop
results$t_test__signCode[i] = t_test__signCode
results$t_test__signCode[i] = NA # this will be computed below after the treatment loop
results$t_test__estimate[i] = t_test__estimate
#results$z_scores[i] = z_scores
#results$median__z_scores[i] = median__z_scores
Expand Down Expand Up @@ -1341,6 +1337,14 @@ htmTreatmentSummary <- function(data, measurements, col_Experiment, col_Treatmen

results$t_test__p_value_adjusted = p.adjust(results$t_test__p_value, method = "BH")


results$t_test__signCode <- ifelse(results$t_test__p_value_adjusted<0.001,"***",
ifelse(results$t_test__p_value_adjusted<0.01,"**",
ifelse(results$t_test__p_value_adjusted<0.05,"*",
ifelse(results$t_test__p_value_adjusted<0.1,".",
" "
))))

echo("")
echo("done. Created Treatment Summary Table.")

Expand Down

0 comments on commit ceecc19

Please sign in to comment.