Linear hypothesis test on generalized linear regression model coefficients
p = coefTest(mdl)
p = coefTest(mdl,H)
p = coefTest(mdl,H,C)
[p,F] = coefTest(mdl,...)
[p,F,r] = coefTest(mdl,...)
Numeric matrix having one column for each coefficient in the
Numeric vector with the same number of rows as
p-value of the F test (see Definitions).
Value of the test statistic for the F test (see Definitions).
Numerator degrees of freedom for the F test
(see Definitions). The F statistic
Test a generalized linear model to see if its coefficients differ from zero.
Create a generalized linear regression model of Poisson data.
X = 2 + randn(100,1); mu = exp(1 + X/2); y = poissrnd(mu); mdl = fitglm(X,y,'y ~ x1','distr','poisson');
Test whether the fitted model has coefficients that differ significantly from zero.
p = coefTest(mdl)
p = 3.1394e-36
There is no doubt that the coefficient of
x1 is nonzero.
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 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:
Here is the estimate of the coefficient vector β, stored in
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
The values of commonly used test statistics are available in