% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/rollScreening.R
\name{rollScreening}
\alias{rollScreening}
\title{Rolling-window peer performance screening}
\usage{
rollScreening(
  X,
  factors = NULL,
  Y = NULL,
  screen = c("alpha", "sharpe", "msharpe"),
  width = 36L,
  by = 1L,
  level = 0.9,
  na.neg = TRUE,
  control = list(),
  dates = NULL
)
}
\arguments{
\item{X}{Matrix \eqn{(T \times N)}{(TxN)} of \eqn{T} returns for the \eqn{N}
funds.}

\item{factors}{Matrix \eqn{(T \times K)}{(TxK)} of factor returns (for
\code{screen = "alpha"}). Default: \code{NULL}.}

\item{Y}{Optional matrix \eqn{(T \times M)}{(TxM)} of returns for a peer group
(cross-group screening, see \code{\link{alphaScreening}}). Default:
\code{NULL}.}

\item{screen}{Performance measure to screen on: \code{"alpha"} (default),
\code{"sharpe"}, or \code{"msharpe"}.}

\item{width}{Window length (number of observations). Default: \code{36}.}

\item{by}{Step (in observations) between successive windows. Default:
\code{1}.}

\item{level}{Modified Value-at-Risk level (for \code{screen = "msharpe"}).
Default: \code{0.9}.}

\item{na.neg}{A logical value passed to \code{\link{msharpeScreening}}
(for \code{screen = "msharpe"}) indicating whether a negative modified
Value-at-Risk yields \code{NA}. Default: \code{TRUE}.}

\item{control}{Control parameters passed to the screening function (see
\code{\link{alphaScreening}}); set \code{control = list(screen_beta = TRUE)}
to obtain per-factor heterogeneity series. With \code{nCore > 1} each
window spins up its own PSOCK cluster, which is wasteful for many small
windows; the default \code{nCore = 1} runs serially without any cluster.}

\item{dates}{Optional vector of length \eqn{T} (e.g. \code{Date}) used to
label the windows by their end date. Default: \code{NULL}.}
}
\value{
A \code{data.frame} of class \code{rollScreening} with one row per
window (or per window/coefficient when \code{screen_beta = TRUE}), with
columns \code{window}, \code{index} (end-of-window row), optionally
\code{date}, \code{coefficient}, the averaged \code{pizero}/\code{pipos}/
\code{pineg}, and \code{heterogeneity} (\eqn{1-\bar\pi^0}).
}
\description{
Runs a peer performance screening on a rolling time window and
returns the time series of cross-sectionally averaged peer performance
ratios. This is the design underlying the dynamic analyses of Ardia et al.
(2022, 2023): on each window the screening is computed and the ratios are
averaged across funds (per coefficient when \code{screen_beta = TRUE}),
yielding a series of (factor exposure) heterogeneity measures.
}
\examples{
\donttest{
data("hfdata")
set.seed(1234)
## a subset keeps the example quick; drop the column index to screen the
## whole universe
roll <- rollScreening(hfdata[, 1:20], screen = "alpha", width = 36, by = 6,
                      control = list(nCore = 1))
plot(roll)
}
}
\references{
Ardia, D., Bluteau, K., Tran, D. (2022).
How easy is it for investment managers to deploy their talent in green and brown stocks?
\emph{Finance Research Letters} \bold{48}, 102992.

Ardia, D., Bluteau, K., Lortie-Cloutier, G., Tran, D. (2023).
Factor exposure heterogeneity in green and brown stocks.
\emph{Finance Research Letters} \bold{55}, Part A, 103900.
}
\seealso{
\code{\link{alphaScreening}}, \code{\link{exposureHeterogeneity}}.
}
\author{
David Ardia and Kris Boudt.
}
\keyword{htest}
