Documentation

# linhyptest

Linear hypothesis test

## Syntax

```p = linhyptest(beta,COVB,c,H,dfe) [p,t,r] = linhyptest(...) ```

## Description

`p = linhyptest(beta,COVB,c,H,dfe)` returns the p value `p` of a hypothesis test on a vector of parameters. `beta` is a vector of k parameter estimates. `COVB` is the k-by-k estimated covariance matrix of the parameter estimates. `c` and `H` specify the null hypothesis in the form `H*b = c`, where `b` is the vector of unknown parameters estimated by `beta`. `dfe` is the degrees of freedom for the `COVB` estimate, or `Inf` if `COVB` is known rather than estimated.

`beta` is required. The remaining arguments have default values:

• `COVB = eye(k)`

• `c = zeros(k,1)`

• `H = eye(K)`

• `dfe = Inf`

If `H` is omitted, `c` must have k elements and it specifies the null hypothesis values for the entire parameter vector.

### Note

The following functions return outputs suitable for use as the `COVB` input argument to `linhyptest`: `nlinfit`, `coxphfit`, `glmfit`, `mnrfit`, `regstats`, `robustfit`. `nlinfit` returns `COVB` directly; the other functions return `COVB` in `stats.covb`.

`[p,t,r] = linhyptest(...)` also returns the test statistic `t` and the rank `r` of the hypothesis matrix `H`. If `dfe` is `Inf` or is not given, `t*r` is a chi-square statistic with `r` degrees of freedom . If `dfe` is specified as a finite value, `t` is an F statistic with `r` and `dfe` degrees of freedom.

`linhyptest` performs a test based on an asymptotic normal distribution for the parameter estimates. It can be used after any estimation procedure for which the parameter covariances are available, such as `regstats` or `glmfit`. For linear regression, the p-values are exact. For other procedures, the p-values are approximate, and may be less accurate than other procedures such as those based on a likelihood ratio.

## Examples

Fit a multiple linear model to the data in `hald.mat`:

```load hald stats = regstats(heat,ingredients,'linear'); beta = stats.beta beta = 62.4054 1.5511 0.5102 0.1019 -0.1441```

Perform an F-test that the last two coefficients are both 0:

```SIGMA = stats.covb; dfe = stats.fstat.dfe; H = [0 0 0 1 0;0 0 0 0 1]; c = [0;0]; [p,F] = linhyptest(beta,SIGMA,c,H,dfe) p = 0.4668 F = 0.8391```