% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/scm.R
\name{mspe_ratio_pval}
\alias{mspe_ratio_pval}
\title{Permutation Inference via MSPE Ratio for SCM}
\usage{
mspe_ratio_pval(
  fit,
  mspe_threshold = 0,
  max_iter = 100L,
  tol = 1e-04,
  use_covariates = FALSE,
  alternative = c("two.sided", "greater", "less")
)
}
\arguments{
\item{fit}{A \code{coresynth} object from \code{\link[=scm_fit]{scm_fit()}} with \code{method = "scm"}.}

\item{mspe_threshold}{Minimum pre-treatment MSPE for including a control
unit in the two-sided test. Ignored for one-sided tests.
Default: 0 (no filtering).}

\item{max_iter}{Passed to \code{\link[=scm_placebo_cpp]{scm_placebo_cpp()}}. Default 100L.}

\item{tol}{Passed to \code{\link[=scm_placebo_cpp]{scm_placebo_cpp()}}. Default 1e-4.}

\item{use_covariates}{If \code{TRUE} and the fit used predictor covariates,
applies the same covariate spec to each placebo unit (R-level loop).
Default \code{FALSE} (faster C++ outcomes-only placebos).}

\item{alternative}{Direction of the alternative hypothesis:
\code{"two.sided"} (default) uses the MSPE ratio statistic;
\code{"greater"} tests whether the treatment increased the outcome;
\code{"less"} tests whether the treatment decreased the outcome.
One-sided tests use the signed ATT as the test statistic.}
}
\value{
A list with:
\itemize{
\item \code{p_value}: Permutation p-value between 0 and 1
\item \code{mspe_ratio_treated}: MSPE_post / MSPE_pre for the treated unit (two.sided only)
\item \code{mspe_ratios_all}: Named numeric vector (treated first, then controls); two.sided only
\item \code{placebo_effects}: Named N_co-vector of placebo ATT estimates
\item \code{treated_effect}: ATT estimate for the treated unit
\item \code{n_placebo_used}: Number of control units used
}
}
\description{
Computes the Abadie et al. (2010) / Abadie (2021) permutation p-value.
For each control unit, a leave-one-out synthetic control is fitted.
}
\details{
When \code{alternative = "two.sided"} (default), the test statistic is the
post/pre MSPE ratio, following Abadie et al. (2010). When
\code{alternative = "greater"} or \code{"less"}, the test statistic is the signed
average post-treatment gap (ATT), giving a one-sided permutation test as
recommended by Abadie (2021) S.3.5 for improved power when the direction
of the treatment effect is known.
}
