\Header{power.t.test}{Power calculations for one and two sample t tests}
\keyword{htest}{power.t.test}
\begin{Description}\relax
Compute power of test, or determine parameters to obtain target power.\end{Description}
\begin{Usage}
\begin{verbatim}
power.t.test(n=NULL, delta=NULL, sd=1, sig.level=0.05, power=NULL,
             type=c("two.sample", "one.sample", "paired"),
             alternative=c("two.sided", "one.sided"))
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{n}] Number of observations (per group)
\item[\code{delta}] True difference in means
\item[\code{sd}] Standard deviation
\item[\code{sig.level}] Significance level (Type I error probability)
\item[\code{power}] Power of test (1 minus Type II error probability)
\item[\code{type}] Type of t test
\item[\code{alternative}] One- or two-sided test
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
Exactly one of the parameters \code{n}, \code{delta}, \code{power},
\code{sd}, and \code{sig.level} must be passed as NULL, and that
parameter is determined from the others. Notice that the last two have
non-NULL defaults so NULL must be explicitly passed if you want to
compute them.\end{Details}
\begin{Value}
Object of class \code{power.htest}, a list of the arguments (including
the computed one) augmented with \code{method} and \code{note}
elements.\end{Value}
\begin{Note}\relax
\code{uniroot} is used to solve power equation for unknowns, so
you may see errors from it, notably about inability to bracket the
root when invalid arguments are given.\end{Note}
\begin{Author}\relax
Peter Dalgaard.  Based on previous work by Claus Ekstrøm\end{Author}
\begin{SeeAlso}\relax
\code{\Link{t.test}}, \code{\Link{uniroot}}\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
 power.t.test(n=20, delta=1)
 power.t.test(power=.90, delta=1)
 power.t.test(power=.90, delta=1, alt="one.sided")
\end{ExampleCode}
\end{Examples}

