0

I have the code below that I'm using to try to calculate the statistical power of detecting an effect size as large as the one below, with the given sample size. I'm calculating power for a one sample ttest with the alternative hypothesis that the sample mean is larger. No matter what I change the alpha parameter to I seem to get a power of 1.0 which seems large and incorrect. Am I doing something wrong below? If so, can someone please point out what I need to change? If it is correct, can someone please explain why?

values:

mean of population:
abar=35.95678241834582

mean of sample:
bbar=42.434961073666734

standard deviation of population:
astd=36.668227035470316

observations in sample:
nb=13933

code:

from statsmodels.stats.power import TTestIndPower

power_analysis = TTestIndPower()

effct_size = (bbar-abar)/astd

power = power_analysis.solve_power(effect_size = effct_size,
                                   nobs1=nb,
                                         power=None,
                                         alpha = 0.05,
                                  alternative='larger')

power

output:

1.0
user3476463
  • 3,967
  • 22
  • 57
  • 117
  • I guess the power equal 1 is correct (at floating point precision). If the sample size gets large enough, then we can detect any small non-zero effect size. The t-statistic for your example is around 20. – Josef Aug 18 '20 at 18:37
  • @Josef thanks for getting back to me on this. I did notice if I make the alpha value really small, it starts dropping below 1. also if I lowered the nobs1 greatly the power dropped. so have I input everything to the function correctly? – user3476463 Aug 19 '20 at 01:52

0 Answers0