% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/getPsi.R
\name{getPsi}
\alias{getPsi}
\title{Calculate Psi, the Inverse of Nu Prime}
\usage{
getPsi(nuPrime, conditionalPower, design, firstStagePValue)
}
\arguments{
\item{nuPrime}{The function value to be inverted.}

\item{conditionalPower}{The target conditional power \eqn{CP} of the design. Must be a numeric value.}

\item{design}{An object of class \code{TrialDesignOptimalConditionalError} created by \code{getDesignOptimalConditionalErrorFunction()}. Contains all necessary arguments to calculate the optimal conditional error function for the specified case.}

\item{firstStagePValue}{First-stage p-value or p-values. Must be a numeric vector between 0 and 1.}
}
\value{
The value of alpha which corresponds to nuPrime and lies between 0 and \code{conditionalPower}.
}
\description{
Get point-wise values of psi (inverse of nu prime)
}
\details{
The function \eqn{\psi} is the inverse of:
\deqn{\nu'(\alpha) = -2 \cdot(\Phi^{-1}(1-\alpha) + \Phi^{-1}(1-CP)) / \phi(\Phi^{-1}(1-\alpha))}.
If the conditional power \eqn{CP} lies outside of the range \eqn{1-\Phi(2) \leq CP \leq \Phi(2)}, the calculation is slightly more complicated (design and firstStagePValue need to be provided).
The argument \code{conditionalPower} is either the fixed target conditional power or the value of the conditional power function at the corresponding first-stage p-value.
}
\examples{
# Returns 0.05
getPsi(getNuPrime(alpha = 0.05, conditionalPower = 0.9), conditionalPower = 0.9,
  design = NULL, firstStagePValue = NULL)
}
