% Drifting Coefficients VAR for cattle cycle % % Based on T.Cogley and T.J. Sargent, "Evolving Post-World War II % U.S. Inflation Dynamics". NBER Macroeconomics Annual. % %---------------------------------------------------------------- % 0. Housekeeping %---------------------------------------------------------------- clear all tic %---------------------------------------------------------------- % 1. Reading the data %---------------------------------------------------------------- % first column # of beef, second column # slaughtered beef, third column is the index load data %---------------------------------------------------------------- % 2. Priors %---------------------------------------------------------------- n_variables=3; n_lags=1; % theta 1|0 definition theta = zeros(12,1); theta(2,1) = 1; theta(7,1) = 1; theta(12,1) = 1; %P 1|0 definition p=1000*eye(12); c = zeros(12,3); r=10*eye(3); q = ((0.01)^2)*p; v = [r, c';c q]; %---------------------------------------------------------------- % 3. Likelihood %---------------------------------------------------------------- % Given theta 1|0, P 1|0 and V, we can calculate the likelihood function.... logl = kalmanforward(y,theta,p,v) save output_drifting_coefficients