% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/mlmodel-tests.R
\name{waldtest}
\alias{waldtest}
\alias{waldtest.mlmodel}
\title{Wald Test for Linear Restrictions}
\usage{
waldtest(object, ...)

\method{waldtest}{mlmodel}(
  object,
  indices = NULL,
  coef_names = NULL,
  rest_matrix = NULL,
  rhs = 0,
  vcov = NULL,
  vcov.type = "oim",
  cl_var = NULL,
  repetitions = 999,
  seed = NULL,
  progress = FALSE,
  ...
)
}
\arguments{
\item{object}{An object of class \code{"mlmodel"}.}

\item{...}{Further arguments passed to methods.}

\item{indices}{Integer vector. Positions of the coefficients to be tested.}

\item{coef_names}{Character vector. Names of the coefficients to test.}

\item{rest_matrix}{Numeric matrix. A q × k restriction matrix (advanced use).}

\item{rhs}{Numeric vector. Value(s) the linear combination(s) should equal.
Default is 0.}

\item{vcov}{Optional user-supplied variance-covariance matrix.}

\item{vcov.type}{Character string. Type of variance-covariance matrix to use.
One of \code{"oim"} (default), \code{"opg"}, \code{"robust"}, \code{"boot"}, or \code{"jack"}.
See \code{\link[=vcov.mlmodel]{vcov.mlmodel()}} for details.}

\item{cl_var}{Character string or vector. Clustering variable when
\code{vcov.type = "robust"} or \code{"boot"}.}

\item{repetitions}{Integer. Number of bootstrap replications when
\code{vcov.type = "boot"}. Default is 999.}

\item{seed}{Integer. Random seed for bootstrap.}

\item{progress}{Logical. Show progress bar during bootstrapping? Default \code{FALSE}.}
}
\value{
An object of class \code{"waldtest.mlmodel"}.
}
\description{
Performs a Wald test of linear restrictions on the parameters of an
\code{mlmodel} object.
}
\details{
The Wald test evaluates linear restrictions of the form \eqn{R\beta = r}.

Three convenient interfaces are provided:
\itemize{
\item \code{indices} or \code{coef_names}: Test individual coefficients (or groups of
coefficients) against the value(s) in \code{rhs} (defaults to 0, which is
useful for joint significance tests).
\item \code{rest_matrix} + \code{rhs}: Test general linear combinations of coefficients
(advanced use).
}

The test statistic follows a \eqn{\chi^2} distribution with degrees of
freedom equal to the number of restrictions under the null hypothesis.
}
\examples{

data(mroz)
mroz$incthou <- mroz$faminc / 1000

fit <- ml_lm(incthou ~ age + I(age^2) + huswage + educ + unem, 
             data = mroz)

# 1. Test single coefficients using indices (default OIM)
waldtest(fit, indices = c(2, 5))

# 2. Test using coefficient names and robust standard errors
waldtest(fit, coef_names = c("value::educ", "value::unem"), 
         vcov.type = "robust")
         
# 3. Test explicit constraints
waldtest(fit, coef_names = "value::educ", rhs = 1, vcov.type = "robust")

# 4. Test a linear combination of two coefficients using a restriction matrix
# H0: educ + huswage = 3
R <- matrix(c(0, 0, 0, 1, 1, 0, 0), nrow = 1)
waldtest(fit, rest_matrix = R, rhs = 3, vcov.type = "boot", 
         repetitions = 100, seed = 123)

}
\seealso{
\code{\link[=lrtest]{lrtest()}}, \code{\link[=IMtest]{IMtest()}}, \code{\link[=confint.mlmodel]{confint.mlmodel()}}
}
\author{
Alfonso Sanchez-Penalver
}
