www.gusucode.com > econ 案例源码程序 matlab代码 > econ/ConductAChowTestExample.m

    %% Test Model of Real U.S. GNP for Structural Change
% Using the Chow test, assess the stability of an explanatory model of U.S.
% real gross national product (GNP) using the end of World War II as a
% break point.
%%
% Load the Nelson-Plosser data set.

% Copyright 2015 The MathWorks, Inc.

load Data_NelsonPlosser
%%
% The time series in the data set contain annual, macroeconomic
% measurements from 1860 to 1970. For more details, a list of variables,
% and descriptions, enter |Description| in the command line.  
%%
% Several series have missing data.  Focus the sample to measurements from
% 1915 to 1970.
span = (1915 <= dates) & (dates <= 1970);
%%
% Assume that an appropriate multiple regression model to describe real GNP
% is
%
% $$\texttt{GNPR}_t=\beta_0+\beta_1\texttt{IPI}_t+\beta_2\texttt{E}_t+\beta_3\texttt{WR}_t.$$
%
%%
% Collect the model variables into a tabular array. Position the predictors
% in the first three columns, and the response in the last column.
Mdl = DataTable(span,[4,5,10,1]);
%%
% Select the index corresponding to 1945, the end of World War II.
bp = find(strcmp(Mdl.Properties.RowNames,'1945'));
%%
% Using 1945 as a break point, conduct a break point test to assess whether
% all regression coefficients are stable.
h = chowtest(Mdl,bp)
%%
% |h = 1| indicates to reject the null hypothesis that the regression
% coefficients between the subsamples are equivalent.  
%%
% In addition to returning a test decision, you can request that a test
% summary display in the Command Window.
h = chowtest(Mdl,bp,'Display','summary');