# 2 one-tailed tests or a single two-tailed test?

My goal is to calculate the power to detect both a hypothetical future 30% increase and decrease in a proportion (call it 0.5, for example. +/-30% would be = 0.65 and 0.35, respectively), but I'm not sure if I need to formulate this into a single two-tailed test or if 2 one-tailed tests is ok (with an adjusted alpha=0.025). Running two tests doesn't seem appropriate, but running 1 test doesn't seem feasible (can't get it to handle all the info.). I'm using a one-sample test because it's a repeated measure design (same 47 locations of data collection). Also, I thought I had this figured out, but both "greater" and "not equal" or "less" and "not equal" seem like the same option: i.e. what power do I have to notice that +30% is "greater" or "not equal" to my original proportion (0.5)(?)

``````library(pwrss)

# 2 one-tailed tests:

arcsin.trans = TRUE, alpha = 0.05,
alternative = "greater",         # or "not equal"?
n = 47, power = NULL)

arcsin.trans = TRUE,
alpha = 0.05,
alternative = "less",         # or "not equal"?
n = 47, power = NULL)
``````

This is the single two-tailed test, but is it asking "what's the power to detect a difference BETWEEN -30% and +30% change" or "what's the power to detect a -30% AND a +30% change from 0.5"? Given the high power from such a small sample size, I'd say the former is true (almost 100% we can tell the difference between a 30% decline and a 30% increase) - but this is not what I'm aiming for...so I'm stuck.

``````#1 two-tailed tests:

arcsin.trans = TRUE,
alpha = 0.05,
alternative = "not equal",
n = 47, power = NULL)

Approach: Arcsine Transformation
A Proportion against a Constant (z Test)
H0: p = p0
HA: p != p0
------------------------------
Statistical power = 0.987
n = 47
------------------------------
Alternative = “not equal”
Non-centrality parameter = 4.178
Type I error rate = 0.05
Type II error rate = 0.013
``````

UPDATE:

Also, it appears the order in which each proportions is entered first matters, but it's not clear to me from the documentation (page 41) which is which: "p=expected proportion and p0=constant to be compared (a proportion)".

For anyone interested in a possible solution:
I found out by using a different package that an increase of 30% (or decrease) on a proportion isn't simply a matter of multiply by 0.3. Instead an arcsin transformation that the `pwr` package uses is necessary. The function `ES.h() = 2*asin(sqrt(p1))-2*asin(sqrt(p2))` within `pwr.p.test(`) can calculate this effect size, or with a known effect size (in my case) one can calculate the resultant % change value by solving for p1 with `p1 = sin(asin(sqrt(p2))+h/2)^2` or simply `p1 = p2 + h/2`.

Note how this differs from `p1 = p2*0.3 + p2` depending on the starting mean:

``````# effect size formula (h=0.3 effect size)
> 0.5 + h/2
 0.65

> 0.6 + h/2
 0.75

# Standard way of scaling a continuous variable (30% increase):
> (0.5*0.3) + 0.5
 0.65 # same as the effect size method

> (0.6*0.3) + 0.6
 0.78 # Slightly different now!
``````

Now, using the `pwr` package, I see that both a positive and negative effect size result in the same power! The null is we can't tell if a 30% change happened (H0: p1 = p2), while the alternative is we can and it's "greater" than our mean (HA: p1 > p2) or less - makes no difference in terms of power.

``````> pwr.p.test(h = 0.3,  # <- 30% increase effect size
+            n = 47,
+            sig.level = 0.05,
+            power = NULL,
+            alternative = "greater")

proportion power calculation for binomial distribution (arcsine transformation)

h = 0.3
n = 47
sig.level = 0.05
power = 0.6597727
alternative = greater

> pwr.p.test(h = -0.3,  # <- 30% decrease effect size
+            n = 47,
+            sig.level = 0.05,
+            power = NULL,
+            alternative = "less")

proportion power calculation for binomial distribution (arcsine transformation)

h = -0.3
n = 47
sig.level = 0.05
power = 0.6597727
alternative = less
``````

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.