% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ssc.R
\name{ssc}
\alias{ssc}
\title{Staggered Synthetic Control Estimation}
\usage{
ssc(Y, D, S = NULL, alpha = 0.05)
}
\arguments{
\item{Y}{Numeric matrix (\eqn{N \times T_{total}}) of outcomes.
Rows are units, columns are time periods (pre- and post-treatment).}

\item{D}{Binary matrix (\eqn{N \times T_{total}}) of treatment indicators.
\code{D[i,t] = 1} if unit \eqn{i} is treated at time \eqn{t}.
Treatment must be absorbing (once treated, always treated).}

\item{S}{Integer or \code{NULL}.  Number of post-treatment periods to use.
If \code{NULL} (default), all available post-treatment periods are used.}

\item{alpha}{Significance level for confidence intervals (default 0.05).}
}
\value{
An object of class \code{"ssc"}, a list containing:
\describe{
  \item{att_event}{Numeric vector of length \eqn{S}: event-time ATT
    estimates (averaged across units at each event time).}
  \item{ci_lower_event, ci_upper_event}{Numeric vectors of length
    \eqn{S}: lower and upper bounds of
    \eqn{(1 - \alpha)} placebo-in-time confidence intervals.
    \code{NA} when \eqn{T < S} (too few pre-treatment periods).}
  \item{att_overall}{Scalar: overall ATT (simple average of all
    heterogeneous effects).}
  \item{ci_lower_overall, ci_upper_overall}{Scalar CI bounds for
    the overall ATT.  \code{NA} when \eqn{T < S}.}
  \item{p_value}{Two-sided p-value for \eqn{H_0: ATT = 0} based on
    the placebo distribution.  \code{NA} when \eqn{T < S}.}
  \item{gamma_hat}{Numeric vector of length \eqn{K}: heterogeneous
    treatment effects for every treated (unit, post-period) pair.}
  \item{te_mat_hat}{Numeric \eqn{N \times S} matrix of
    unit-level treatment effects at each post-treatment period.}
  \item{B_hat}{Numeric \eqn{N \times N} SC weight matrix.}
  \item{a_hat}{Numeric vector of length \eqn{N}: SC intercepts.}
  \item{u_hat}{Numeric \eqn{N \times T} matrix of pre-treatment
    SC residuals.}
  \item{min_eigenvalue}{Smallest eigenvalue of the sample analogue of
    the design matrix \eqn{\sum_s A_s' \hat M A_s}.
    Must be positive for the estimator to be well-defined.}
  \item{index_mat}{Integer \eqn{K \times 3} matrix.  Each row
    \eqn{(s, i, e)} records the post-treatment period \eqn{s},
    unit \eqn{i}, and event time \eqn{e} for one element of
    \eqn{\hat\gamma}.}
  \item{N, T, S, K}{Panel dimensions.}
  \item{alpha}{Significance level used.}
}
}
\description{
Estimate treatment effects in a panel with staggered adoption using
the Staggered Synthetic Control (SSC) method of Cao, Lu, and Wu (2020).
Returns event-time ATT, overall ATT, heterogeneous treatment effects,
and placebo-in-time confidence intervals.
}
\details{
The SSC method proceeds in four steps:
\enumerate{
  \item \strong{SC weights.}
    For every unit, estimate synthetic control weights from
    pre-treatment data.
  \item \strong{Treatment structure.}
    Build the treatment assignment matrices \eqn{A_s} that map
    heterogeneous effects \eqn{\gamma} to unit-level outcomes at
    each post-treatment period.
  \item \strong{Estimation.}
    Solve a GLS-type system to recover \eqn{\hat\gamma}, then
    aggregate to event-time or overall ATT via a linear map \eqn{L}.
  \item \strong{Inference.}
    Construct a null distribution by applying the same estimator to
    rolling windows of pre-treatment residuals (placebo-in-time).
    Confidence intervals are the \eqn{\alpha/2} and
    \eqn{1 - \alpha/2} quantiles of this distribution, shifted by
    the point estimate.
}
}
\examples{
set.seed(1)
N <- 5; Ttot <- 15
Y <- matrix(rnorm(N * Ttot), N, Ttot)
D <- matrix(0L, N, Ttot)
D[1, 8:15] <- 1L
D[2, 10:15] <- 1L
result <- ssc(Y, D)
print(result)
summary(result)

}
\references{
Cao, J., Lu, C., and Wu, Y. (2020).
"Synthetic Control Inference for Staggered Adoption."
}
