Equivalence test for 2 unrelated proportions

H0 : -1 < $$p_text{1}-p_text{2} \leq -\delta_text{1}$$ or $$\delta_text{2} \leq \delta < 1$$ HA: $$-delta_text{1} < \delta < \delta_text{2}$$

where proportions being compared are $$p_text{1}$$ = x/m and $$p_text{2}$$ = y/n, beta is the type II error,, del1 and del2 denote, $$\delta_text{1}$$ and $$\delta_text{2}$$.

[TYPE INTO R THE DESIRED INPUTS X,M,Y,N,DEL1,DEL2 AND BETA USING VALUES IN FORM BELOW].

beta <- 0.05
m <- 20
n <- 12
x <- 10
y <- 15
del1 <- 0.1
del2 <- 0.1

[THEN COPY AND PASTE THE BELOW INTO R]

If ind=1 we reject the null hypothesis of nonequivalence with a type II error of beta.

denom <- sqrt((1/m)(x/m)(1-(x/m))+(1/n)(y/n)(1-(y/n)))
tstat <- abs(((x/m) - (y/n)) - (del2-del1)/2) / denom
cval <- qchisq(p=beta,  df=1, (del1+del2)^2/(4*denom*denom))
ind <- 0
if (tstat < cval) ind = 1
print(ind)