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

    %% Plot Recursive Residuals and Critical Lines
% Determine whether an explanatory model of real gross national product
% (GNP) is stable by plotting recursive residuals.
%%
% Load the Nelosson-Plosser data set. 
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);
%%
% Consider the multiple linear regression model
%
% $$\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
% response as the last variable.
Mdl = DataTable(span,[4,5,10,1]);
%%
% Plot the test statistics. 
cusumtest(Mdl);
%%
% The cusum series crosses the upper critical line after the
% 45th recursive regression, which indicates model instability.