% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/DGP_X.R
\name{DGP_X_binary}
\alias{DGP_X_binary}
\title{Data Generating Process with a Binary Covariate}
\usage{
DGP_X_binary(n, p, q, mu_0, mu_1, Sigma_0, Sigma_1)
}
\arguments{
\item{n}{Integer. Total sample size.}

\item{p}{Numeric. Probability of being assigned to the treatment group \eqn{(Z=1)}.}

\item{q}{Numeric. Probability of the binary covariate X being 1.}

\item{mu_0}{Numeric vector. Mean vector for \eqn{P} when \eqn{X=0}.}

\item{mu_1}{Numeric vector. Mean vector for \eqn{P} when \eqn{X=1}.}

\item{Sigma_0}{Matrix. Covariance matrix for \eqn{P} when \eqn{X=0}.}

\item{Sigma_1}{Matrix. Covariance matrix for \eqn{P} when \eqn{X=1}.}
}
\value{
A list containing:
\itemize{
  \item \code{X}: The binary covariate vector.
  \item \code{n_X1}: Number of units with \eqn{X=1}.
  \item \code{n_X0}: Number of units with \eqn{X=0}.
  \item \code{Z}: Treatment assignment vector.
  \item \code{n1}: Number of treated units.
  \item \code{n0}: Number of control units.
  \item \code{P}: Full matrix of potential outcomes.
  \item \code{P_observed}: Observed outcomes \eqn{(Y, S)} corresponding to the assigned treatment \eqn{Z}.
  \item \code{P_unobserved}: Counterfactual outcomes under the opposite treatment.
}
This function is useful for generating synthetic data to test or explore
the method, for instance to verify the behavior of \code{BSET_X} under
known simulation settings.
}
\description{
This function generates potential outcomes from a data generating process
similar to the one described in \insertCite{parast2024rank;textual}{BSET}, but with the addition
of a binary covariate X. It creates a dataset of potential outcomes
\deqn{P = (Y_1, S_1, Y_0, S_0)} and observed outcomes
\deqn{P_{observed} = (Y, S)} based on a random treatment assignment \eqn{Z}.
}
\details{
The potential outcomes are generated from multivariate normal
distributions with different mean vectors and covariance matrices depending
on the value of \eqn{X}. Specifically:
\deqn{P \mid X = 0 \sim \mathcal{N}_{4}(\mu^{0}, \Sigma^{0}), \\
P \mid X = 1 \sim \mathcal{N}_{4}(\mu^{1}, \Sigma^{1}).}
}
\examples{
set.seed(123)
data <- DGP_X_binary(
  n = 100,
  p = 0.5,
  q = 0.5,
  mu_0 = c(5, 5, 0, 0),
  mu_1 = c(5, -5, 0, -10),
  Sigma_0 = kronecker(diag(2), matrix(c(1, 1, 1, 2), 2, 2)),
  Sigma_1 = kronecker(diag(2), matrix(c(1, 1, 1, 2), 2, 2))
)
}
\references{
\insertRef{carlotti2026bayesian}{BSET}
}
