% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/moderated_regression.R
\name{moderated_regression}
\alias{moderated_regression}
\title{Moderated Regression Model}
\usage{
moderated_regression(
  data,
  iv,
  moderator,
  dv,
  covariates = NULL,
  center = TRUE,
  quadratic = FALSE,
  robust_se = FALSE
)
}
\arguments{
\item{data}{A data frame}

\item{iv}{Independent variable}

\item{moderator}{Moderator variable}

\item{dv}{Dependent variable}

\item{covariates}{Optional character vector of covariate names.
Defaults to NULL (no covariates).}

\item{center}{Logical; whether to center variables}

\item{quadratic}{Logical; include quadratic terms}

\item{robust_se}{Logical; use HC3 robust standard errors}
}
\value{
A fitted model object
}
\description{
Fits a moderated regression model with optional extensions.
}
\examples{
set.seed(123)

n <- 100
x <- rnorm(n)
w1 <- rnorm(n)
w2 <- rnorm(n)
z <- 0.5 * x + sqrt(1 - 0.5^2) * rnorm(n)

y <- 0.3 * x + 0.3 * z + 0.8 * x * z + rnorm(n)

data <- data.frame(w1, w2, x, z, y)

result <- moderated_regression(
 data,
 iv = "x",
 moderator = "z",
 dv = "y",
 covariates = c("w1", "w2")
 )


}
