% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/causalsim_covar.R
\name{causalsim_covar}
\alias{causalsim_covar}
\title{Define a covariate for a causal DGP}
\usage{
causalsim_covar(dist = "normal", role = "confounder", ...)
}
\arguments{
\item{dist}{Character. Distribution family. One of \code{"normal"}, \code{"binary"},
\code{"uniform"}.}

\item{role}{Character vector. Causal role(s). One or more of:
\describe{
\item{\code{"confounder"}}{Enters both the propensity model and the outcome
baseline; creates confounding bias in naive estimators.}
\item{\code{"effect_modifier"}}{Available for use in the \code{effect} function;
excluded from the propensity model unless also a \code{"confounder"}.}
\item{\code{"noise"}}{Independent of both treatment and outcome; adds
variance without confounding.}
}
Roles are not mutually exclusive: \code{role = c("confounder", "effect_modifier")}
specifies a variable that both confounds and moderates the effect.}

\item{...}{Distribution parameters.
\itemize{
\item \code{"normal"}: \code{mean} (default 0), \code{sd} (default 1)
\item \code{"binary"}: \code{prob} (default 0.5)
\item \code{"uniform"}: \code{min} (default 0), \code{max} (default 1)
}}
}
\value{
An S3 object of class \code{causalsim_covar}.
}
\description{
Constructs a fully-specified covariate descriptor for use in
\code{\link[=causalsim_dgp]{causalsim_dgp()}}. Every covariate has a distribution family, optional
distribution parameters, and one or more causal roles that control how it
enters the automatically-generated treatment and outcome models.
}
\examples{
# Standard normal confounder
causalsim_covar("normal", role = "confounder", mean = 0, sd = 1)

# Binary effect modifier
causalsim_covar("binary", role = "effect_modifier", prob = 0.4)

# Variable that both confounds and moderates the effect
causalsim_covar("normal", role = c("confounder", "effect_modifier"))

}
