| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Econometrics Toolbox |
| Contents | Index |
| Learn more about Econometrics Toolbox |
[h,pValue,stat,cValue] = lmtest(score,EstCov,dof)
[h,pValue,stat,cValue] = lmtest(score,EstCov,dof,alpha)
[h,pValue,stat,cValue] = lmtest(score,EstCov,dof) performs the Lagrange multiplier hypothesis test at a default 5% significance level.
[h,pValue,stat,cValue] = lmtest(score,EstCov,dof,alpha) performs the Lagrange multiplier hypothesis test at significance level alpha.
The Lagrange multiplier test compares specifications of nested models by assessing the significance of restrictions to an extended model with unrestricted parameters. The test requires:
The gradient of the unrestricted loglikelihood function, evaluated at the restricted parameter estimates (score)
A covariance estimator for the unrestricted model parameters, evaluated at the restricted parameter estimates (EstCov)
The test statistic is:
stat = score' * EstCov * score.
When the test statistic exceeds a critical value in its asymptotic distribution, lmtest rejects the null, restricted model in favor of the alternative, unrestricted model. The asymptotic distribution is chi-square, with degree-of-freedom parameter (dof) equal to the number of restrictions. The nominal significance level of the test (alpha) determines the critical value.
| score | A scalar, vector, or cell array of vectors representing the gradients of the unrestricted loglikelihood functions of the models to be tested, evaluated at the restricted parameter estimates. The number of elements in a gradient vector is the number of parameters in an unrestricted model.
If the input parameter score is a row vector, the output arguments of lmtest are also row vectors. |
| EstCov | A matrix or cell array of matrices representing covariance matrix estimates for the unrestricted parameters in the models, evaluated at the restricted parameter estimates. The size of a covariance matrix is p-by-p, where p is the number of parameters in the corresponding unrestricted model.
|
| dof | A scalar or vector of positive integers representing the number of degrees of freedom for the asymptotic chi-square distribution of the test statistics. The elements of dof are integers equal to the number of restrictions in the corresponding model comparison. They must be less than the number of parameters in the unrestricted model. If dof is a scalar, it is expanded to be a vector with length equal to the number of tests. |
| alpha | Significance levels for the tests. Elements of alpha must be greater than zero and less than one. If alpha is a scalar, lmtest expands it to a vector with length equal to the number of tests. If alpha is a vector, it must have length equal to the number of tests. The default value of alpha is 0.05. |
| h | Vector of Booleans, representing decisions for the tests. The length of h is the number of tests. A 1 indicates rejection of the null (restricted) model for the corresponding test. A 0 represents failure to reject the restricted model. |
| pValue | Vector of probability values of the test statistics. The length of pValue is the number of tests. |
| stat | Vector of test statistics. The length of stat is the number of tests. |
| cValue | Vector of critical values for the tests. The length of cValue is the number of tests. |
lmtest performs multiple, independent tests when inputs are cell- vectors. If the gradients and covariance estimators are the same for all tests, but the restricted parameter estimates vary, lmtest "tests down" against multiple restricted models. If the gradients and covariance estimators vary, but the restricted parameter estimates do not, lmtest "tests up" against multiple unrestricted models. Otherwise, lmtest compares model specifications pairwise.
Fitting functions such as garchfit return gradient and covariance estimators evaluated at parameter estimates for the fitted model. lmtest requires estimators for the unrestricted model evaluated at parameter estimates for the restricted model. To perform a Lagrange multiplier test, compute unrestricted estimators analytically, then evaluate them at the restricted parameter estimates produced by functions such as garchfit.
The significance level alpha of lmtest is nominal, in that it specifies a rejection probability in the asymptotic distribution. The actual rejection probability can differ from the nominal significance. Lagrange multiplier tests tend to under-reject for small alpha; over-reject for large alpha. The rejection error is typically less than for likelihood ratio and Wald tests.
Use lmtest when unrestricted parameter estimates are difficult to compute. By comparison, waldtest requires only unrestricted parameter estimates, and lratiotest requires both unrestricted and restricted parameter estimates.
This example fits a Gamma distribution to simulated education and income data. The example is explained in more detail in Example: Specifying Distribution Parameters. Load the data:
load IncomeData x = education; y = income;
The unrestricted model has loglikelihood:
![]()
Here
![]()
The restricted model is ρ = 1. In other words, the restricted model has an exponential distribution.
The restricted maximum likelihood occurs at:
rbeta = 15.6027; % Restricted beta estimate rrho = 1; % Restricted rho dof = 1; % Number of restrictions
This example uses the OPG covariance estimate formed by the outer products of the gradients at the restricted maximum; see Covariance Estimators.
RCG = [-rrho./(rbeta+x)+y.*(rbeta+x).^(-2),...
-log(rbeta+x)-psi(rrho)+log(y)];
Rscore = sum(RCG)';
REstCov1 = inv(RCG'*RCG);Test the unrestricted model against the restricted model:
[LMh,LMp,LMstat,LMcv] = lmtest(Rscore,REstCov1,dof)
LMh =
1
LMp =
7.4744e-005
LMstat =
15.6868
LMcv =
3.8415LMh = 1 means lmtest rejects the restricted hypothesis.
[1] Davidson, R. and J. G. MacKinnon. Econometric Theory and Methods. Oxford, UK: Oxford University Press, 2004.
[2] Godfrey, L. G. Misspecification Tests in Econometrics. Cambridge, UK: Cambridge University Press, 1997.
[3] Greene, W. H. Econometric Analysis. 6th ed. Upper Saddle River, NJ: Pearson Prentice Hall, 2008.
[4] Hamilton, J. D. Time Series Analysis. Princeton, NJ: Princeton University Press, 1994.
garchfit, lratiotest, vgxvarx, waldtest
![]() | lbqtest | lratiotest | ![]() |
View demos and recorded presentations led by industry experts.
Now On Demand
Network with industry peers and learn the latest applications of the leading software product for computational finance.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |