www.gusucode.com > econ 案例源码程序 matlab代码 > econ/AssessWhetherASeriesIsTrendStationaryAndARpExample.m
%% Assess Whether a Series Is Trend Stationary and AR(p) % Test the growth of the U.S. unemployment rate using the data in Schwert, % 1987. %% % Load Schwert's macroeconomic data set. % Copyright 2015 The MathWorks, Inc. load Data_SchwertMacro %% % Focus on the unemployment rate growth over the dates condsidered in % Leybourne and McCabe, 1999. UN = DataTableMth.UN; t1 = find(datesMth == datenum([1948 01 01])); t2 = find(datesMth == datenum([1985 12 01])); dUN = diff(UN(t1:t2)); % Unemployment rate growth %% % Assess the null hypothesis that the unemployment rate growth is a trend % stationary, AR(1) process using the estimated variance from OLS % regression. [h1,~,stat1,cValue] = lmctest(dUN,'lags',1,'test','var1') %% % The warning indicates that the pvalue is below 0.1. |h1| = 0 indicates % that there is not enough evidence to reject that the unemployment rate % growth is a trend stationary, AR(1) process. %% % Assess the null hypothesis that the unemployment rate growth is a trend % stationary, AR(1) process using the estimated variance from the maximum % liklihood of the reduced-form regression model. [h2,~,stat2,cValue] = lmctest(dUN,'lags',1,'test','var2') %% % |h2| = 1 indicates that the there is enough evidence to asuggest that the % unemployment rate growth is nonstationary. %% % Leybourne and McCabe, 1999 report that the original LMC statistic fails % to reject stationarity, while the modified LMC statistic does reject it.