% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/WaldMult.R
\name{WaldMult}
\alias{WaldMult}
\title{WaldMult 
Performs multivariate Wald tests.}
\usage{
WaldMult(
  Mod,
  coef,
  vcov,
  pos = NULL,
  contrasts = NULL,
  A = NULL,
  name = NULL,
  value = 0
)
}
\arguments{
\item{Mod}{an object for which the \code{coef} and \code{vcov} methods are diefined.}

\item{coef}{if \code{Mod} is missing, the vector of estimated parameters}

\item{vcov}{if \code{Mod} is missing, the matrix of variance of coef}

\item{pos}{vector containing the indices of the parameters involved in
the test. Required if A is not specified.}

\item{contrasts}{optional vector containing the the c1, ..., cm value in
case 2 (see details). Should be of same lengtht as pos.}

\item{A}{matrix A of case 3 (see details). A should have as many columns as
parameters in coef.}

\item{name}{characters string giving the name of the test printed in the
output (the row names of the output). By default, the name's test is the
null hypothesis.}

\item{value}{the value against which to test. By default, value=0.}
}
\value{
If contrasts is NULL, the function returns a matrix with 1 row and
2 columns containing the value of the Wald test's statistic and
the associated p-value.

If contrasts is not NULL, the function returns a matrix with 1 row
and 4 columns containing the value of the coefficient (dot product
of pos and contrasts), his standard deviation, the value of the
Wald test's statistic and the associated p-value.

If A is specified, the function returns a matrix with m rows and
2 columns containing the value of the Wald test's statistic and
the associated p-value.
}
\description{
Given a vector of estimated parameters (coef = (theta_1, ... theta_n)') and
their associated variance matrix (vcov = Var(coef)), the WaldMult function
performs either the test of the null hypothesis :
}
\details{
1. H0 : theta_m = (theta_j1, ..., theta_jm)' = 0
   ie, tests if a subset of m parameters are simultaneously equal to zero.
   The Wald statistic is w = theta_m' * Var(theta_m)^(-1) * theta_m
   and the associated p-value is obtained by p = P(chi2_(dof=m) > w)

2. H0 : theta = c1*theta_j1 + ... + cm*theta_jm = 0
   ie, tests if a combination of m parameters is equal to zero.
   The Wald statistic is w = theta^2 / Var(theta)
                           = (c1*theta_j1 + ... + cm*theta_jm)^2 / Var(c1*theta_j1 + ... + cm*theta_jm)
   and the associated p-value is obtained by p = P(chi2_(dof=1) > w)

3. H0 : Theta = A*coef = 0 with A a matrix with m lines and n columns.
   ie, tests if multiple combinations of parameters are simultaneously equal to zero.
   The Wald statistic is w = Theta * Var(Theta)^(-1) * Theta'
                           = (A*coef)' * (A*vcov*A')^(-1) * (A*coef)
   and the associated p-value is obtained by p = P(chi2_(dof=m) > w)

The function can be applied to any object having a \code{coef}
}
\examples{
require(lcmm)
m <- hlme(Y ~ Time + X2, random = ~ 1, subject = "ID", data = data_hlme)
summary(m)

mm <- hlme(Y ~ -1 + Time + factor(X2), random = ~ 1, subject = "ID", data = data_hlme)
summary(mm)

## Retrieve from model mm the difference between X2 levels as in model m :
WaldMult(Mod = mm, pos = c(2, 3), contrasts = c(-1, 1))
## or
WaldMult(coef = coef(mm), vcov = vcov(mm), A = matrix(c(0, -1, 1, 0, 0), 1, 5))

}
