% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/EL.R
\name{EL.smooth}
\alias{EL.smooth}
\title{Smooth estimates and confidence intervals using the smoothed two-sample EL method}
\usage{
EL.smooth(
  method,
  X,
  Y,
  t,
  bw = bw.nrd0,
  conf.level = NULL,
  simultaneous = FALSE,
  bootstrap.samples = 300,
  more.warnings = FALSE
)
}
\arguments{
\item{method}{One of \code{"pp"}, \code{"qq"}, \code{"roc"}, \code{"qdiff"},
or \code{"fdiff"}.}

\item{X}{A numeric vector of data values.}

\item{Y}{A numeric vector of data values.}

\item{t}{A numeric vector of points at which to calculate estimates and
confidence intervals.}

\item{bw}{A function taking a numeric vector and returning a bandwidth, or a
numeric vector of length two giving the bandwidths for \code{X} and \code{Y}
respectively. Default is \code{\link[stats]{bw.nrd0}}.}

\item{conf.level}{Confidence level for the intervals, a number in \eqn{(0,1)},
or \code{NULL} to skip confidence band calculation.}

\item{simultaneous}{Logical. If \code{TRUE}, simultaneous confidence bands are
constructed via a nonparametric bootstrap. Default is \code{FALSE} (pointwise
intervals).}

\item{bootstrap.samples}{Integer. Number of bootstrap samples used when
\code{simultaneous = TRUE}. Default is \code{300}.}

\item{more.warnings}{Logical. If \code{FALSE} (default), a single warning is
issued if any problem occurs. If \code{TRUE}, a warning is produced for every
point with a problem.}
}
\value{
A list with components:
\describe{
  \item{\code{estimate}}{Estimated values at points \code{t}.}
  \item{\code{conf.int}}{A two-row matrix where each column gives the lower
    and upper confidence bounds at the corresponding point in \code{t}.}
  \item{\code{simultaneous.conf.int}}{Logical; \code{TRUE} if simultaneous
    bands were constructed.}
  \item{\code{bootstrap.crit}}{The bootstrap critical value of the
    \eqn{-2\log}-likelihood statistic for simultaneous bands at level
    \code{conf.level}. Only present when \code{conf.level} is not \code{NULL}
    and \code{simultaneous = TRUE}.}
}
}
\description{
Calculates estimates and pointwise confidence intervals (or simultaneous bands)
for P-P and Q-Q plots, ROC curves, quantile differences (\code{qdiff}) and CDF
differences (\code{ddiff}) using the smoothed empirical likelihood method.
}
\details{
Confidence bands are drawn only if \code{conf.level} is not \code{NULL}.

When constructing simultaneous confidence bands, check that the chosen range
of \code{t} values does not produce excessively wide bands (for example, for
a P-P plot the interval \eqn{[0.05, 0.95]} is typically a sensible choice).
This should be verified for each dataset. Note that simultaneous band
calculation can be slow.
}
\examples{
\donttest{
#### Simultaneous confidence bands for a P-P plot
X1 <- rnorm(200)
X2 <- rnorm(200, 1)
x <- seq(0.05, 0.95, length = 19)
y <- EL.smooth("pp", X1, X2, x, conf.level = 0.95,
               simultaneous = TRUE, bw = c(0.3, 0.3))
conf.int <- data.frame(x = x, ci.l = y$conf.int[1,], ci.u = y$conf.int[2,])

## Plot with both pointwise and simultaneous confidence bands
EL.plot("pp", X1, X2, conf.level = 0.95, bw = c(0.3, 0.3)) +
    ggplot2::geom_line(data = conf.int, ggplot2::aes(x = x, y = ci.u), lty = "dotted") +
    ggplot2::geom_line(data = conf.int, ggplot2::aes(x = x, y = ci.l), lty = "dotted")
}

}
\references{
Valeinis, J. and Cers, E. Extending the two-sample empirical likelihood.
Preprint: \url{http://home.lu.lv/~valeinis/lv/petnieciba/EL_TwoSample_2011.pdf}

Hall, P. and Owen, A. (1993). Empirical likelihood bands in density estimation.
\emph{Journal of Computational and Graphical Statistics}, \strong{2}(3), 273--289.
}
\seealso{
\code{\link{EL.plot}}, \code{\link{EL.statistic}}
}
\author{
E. Cers, J. Valeinis
}
\keyword{hplot}
\keyword{nonparametric}
\keyword{smooth}
