% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/RcppExports.R
\name{samplesizeRiskRatioExactEquiv}
\alias{samplesizeRiskRatioExactEquiv}
\title{Sample Size for Exact Unconditional Test of Equivalence in Risk
Ratio}
\usage{
samplesizeRiskRatioExactEquiv(
  beta = NA_real_,
  riskRatioLower = NA_real_,
  riskRatioUpper = NA_real_,
  pi1 = NA_real_,
  pi2 = NA_real_,
  allocationRatioPlanned = 1,
  alpha = 0.05,
  calculateAttainedAlpha = TRUE,
  max_n_search = 1000L,
  window = 10L
)
}
\arguments{
\item{beta}{The type II error.}

\item{riskRatioLower}{The lower equivalence limit of risk ratio.}

\item{riskRatioUpper}{The upper equivalence limit of risk ratio.}

\item{pi1}{The assumed probability for the active treatment group.}

\item{pi2}{The assumed probability for the control group.}

\item{allocationRatioPlanned}{Allocation ratio for the active treatment
versus control. Defaults to 1 for equal randomization.}

\item{alpha}{The significance level for each of the two one-sided
tests. Defaults to 0.05.}

\item{calculateAttainedAlpha}{Whether to calculate the attained alpha.}

\item{max_n_search}{The maximum sample size to search up to. If no
sample size up to this value satisfies the windowed power criterion,
an error is thrown.}

\item{window}{The number of consecutive sample sizes that must all
satisfy the power criterion to confirm the found sample size.
This is to mitigate non-monotonicity of power in sample size for
the exact test.}
}
\value{
A data frame with the following variables:
\itemize{
\item \code{alpha}: The specified significance level for each of the two
one-sided tests.
\item \code{attainedAlpha}: The attained significance level.
\item \code{power}: The power.
\item \code{n}: The sample size.
\item \code{riskRatioLower}: The lower equivalence limit of risk ratio.
\item \code{riskRatioUpper}: The upper equivalence limit of risk ratio.
\item \code{pi1}: The assumed probability for the active treatment group.
\item \code{pi2}: The assumed probability for the control group.
\item \code{riskRatio}: The risk ratio.
\item \code{allocationRatioPlanned}: Allocation ratio for the active
treatment versus control.
\item \code{zstatRiskRatioLower}: The efficacy boundaries on the
z-test statistic scale for the one-sided null hypothesis on the
lower equivalence limit.
\item \code{zstatRiskRatioUpper}: The efficacy boundaries on the
z-test statistic scale for the one-sided null hypothesis on the
upper equivalence limit.
}
}
\description{
Obtains the sample size given power for exact unconditional
test of equivalence in risk ratio.
}
\examples{

samplesizeRiskRatioExactEquiv(
  beta = 0.2, riskRatioLower = 0.7, riskRatioUpper = 1/0.7,
  pi1 = 0.95, pi2 = 0.95, alpha = 0.05)

}
\author{
Kaifeng Lu, \email{kaifenglu@gmail.com}
}
\keyword{internal}
