Here's the framework I will work with
f(x) = y
x is a data frame of dim where x[1] is a numeric vector in -1:1 and x[2] is a factor with two levels, representing wither the captive animal is to assigned to one of two groups, one of which is DIST
(unvisited) and the other is P1
or P2
y is a result of a test to determine as to whether the difference in mean(x)
differs from 0
pre-determined level of confidence \alpha
f is a test, with n = 5 for each group, representing the mean x[1]
observed for all subjects in the group, which will be the two-sided, two-sample t.test. The conventional \alpha = 0.05 is selected and we solve for the power that can be achieved to test null hypothesis H_0 \mu = 0 against the alternative hypothesis H_1 \mu ≠0, that the mean value of x[1]
between the two groups does or does not differ from zero. Assumed effect sizes of 0.2,0.5,0.8 will be tested.
library(pwr)
# to find: power
# small effect anticipated from visitation
pwr.t.test(d=0.2,
n=5,
sig.level=0.05,
power = NULL,
type="two.sample",
alternative="two.sided")
#>
#> Two-sample t test power calculation
#>
#> n = 5
#> d = 0.2
#> sig.level = 0.05
#> power = 0.05904263
#> alternative = two.sided
#>
#> NOTE: n is number in *each* group
# medium effect predicted
pwr.t.test(d=0.5,
n=5,
sig.level=0.05,
power = NULL,
type="two.sample",
alternative="two.sided")
#>
#> Two-sample t test power calculation
#>
#> n = 5
#> d = 0.5
#> sig.level = 0.05
#> power = 0.107686
#> alternative = two.sided
#>
#> NOTE: n is number in *each* group
# strong effect predicted
pwr.t.test(d=0.8,
n=5,
sig.level=0.05,
power = NULL,
type="two.sample",
alternative="two.sided")
#>
#> Two-sample t test power calculation
#>
#> n = 5
#> d = 0.8
#> sig.level = 0.05
#> power = 0.2007395
#> alternative = two.sided
#>
#> NOTE: n is number in *each* group
Created on 2023-05-13 with reprex v2.0.2
At each assumed level of effect the number of subjects will be sufficient to result in a moderately low risk of rejecting H_0 when it is actually true, that is the means of the two group differ by zero. However, all of the tests have low power—the ability to reject H_0 when H_1 is actually true. These correspond to the risks of Type I and Type II errors.
So, for example if we anticipate that the effect size of observation vs. non-observation on the stress index to be strong, the power of the test, 0.20 is weak and it will not be possible to reliably reject H_0 when we should.