REED: Calculating Power After Estimation – Everybody Should Do This!

(1) tvaluedf,1-Power = (tcritdf,1-α/2τ )

# Function to calculate power

power_function <- function(effect_size, standard_error, df, alpha) {
  
# This matches FIGURE 1 in Tian et al. (2024)
# "Power to the researchers: Calculating power after estimation"
#  Review of Development Economics
#  http://doi.org/10.1111/rode.13130 
  
  t_crit <- qt(alpha / 2, df, lower.tail = FALSE)  
  tau <- effect_size / standard_error
  t_value = t_crit - tau
  calculate_power <- pt(t_value, df, lower.tail = FALSE)
  
  return(calculate_power)
}

Leave a comment