Note: This page has been translated by MathWorks. Click here to see

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Linear hypothesis test on linear regression model coefficients

`p = coefTest(mdl)`

`p = coefTest(mdl,H)`

`p = coefTest(mdl,H,C)`

```
[p,F] =
coefTest(___)
```

```
[p,F,r]
= coefTest(___)
```

The *p*-value, *F*-statistic, and numerator degrees of
freedom are valid under these assumptions:

The data comes from a model represented by the formula in the

`Formula`

property of the fitted model.The observations are independent, conditional on the predictor values.

Under these assumptions hold, let *β* represent the (unknown) coefficient
vector of the linear regression. Suppose *H* is a full-rank matrix of size
*r*-by-*s*, where `r`

is the number
of coefficients to include in an *F*-test, and `s`

is the
total number of coefficients. Let *c* be a vector the same size as
*β*. The following is a test statistic for the hypothesis that
*Hβ* = *c*:

$$F={\left(H\widehat{\beta}-v\right)}^{\prime}{\left(HC{H}^{\prime}\right)}^{-1}\left(H\widehat{\beta}-v\right).$$

Here $$\widehat{\beta}$$ is the estimate of the coefficient vector *β*, stored in
the `Coefficients`

property, and *V* is the estimated
covariance of the coefficient estimates, stored in the
`CoefficientCovariance`

property. When the hypothesis is true, the test
statistic *F* has an F Distribution with *r* and
*u* degrees of freedom, where *u* is the degrees of
freedom for error, stored in the `DFE`

property.

The values of commonly used test statistics are available in the

`Coefficients`

property of a fitted model.`anova`

provides tests for each model predictor and groups of predictors.

`CompactLinearModel`

| `LinearModel`

| `anova`

| `coefCI`

| `dwtest`

| `linhyptest`