% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ife.R
\name{.demean_panel}
\alias{.demean_panel}
\title{Demean Panel Matrices for Additive Fixed Effects}
\usage{
.demean_panel(Y_mat, X_arr, force)
}
\arguments{
\item{Y_mat}{T x N outcome matrix}

\item{X_arr}{T x N x p covariate array  (NULL if p = 0)}

\item{force}{character: "none" | "unit" | "time" | "two-way"}
}
\value{
list with:
Y_dm   T x N demeaned outcome
X_dm   T x N x p demeaned covariate array (or NULL)
mu_Y   grand mean of Y
alpha_Y  N x 1 unit means of Y (after grand mean removal)
xi_Y   T x 1 time means of Y  (after grand mean removal)
}
\description{
Removes additive unit and/or time fixed effects from a T x N
outcome matrix and a T x N x p covariate array using the within-group
transformation. Supports four specifications: no demeaning (\code{"none"}),
unit-only (\code{"unit"}), time-only (\code{"time"}), and two-way (\code{"two-way"}).
}
\keyword{internal}
