Home > . > mgnldnsty.m

mgnldnsty

PURPOSE ^

function w=mgnldnsty(ydata,lags,xdata,breaks,lambda,mu,mnprior,vprior,train,flat)

SYNOPSIS ^

function w=mgnldnsty(ydata,lags,xdata,breaks,lambda,mu,mnprior,vprior,train,flat)

DESCRIPTION ^

function w=mgnldnsty(ydata,lags,xdata,breaks,lambda,mu,mnprior,vprior,train,flat)
 ydata:        endogenous variable data matrix, including initial condition dates.
 xdata:        exogenous variable data matrix, including initial condition dates.
 breaks:       breaks in the data.  The first lags data points after a break are used
               as new initial conditions, not data points for the fit.
 lambda:       weight on the co-persistence prior dummy observation.  (5 is reasonable)
               lambda>0 => x variables included; lambda<0 => x variables excluded;
 mu:           weight on variable-by-variable sum of coeffs dummy obs. (1 is reasonable)
 mnprior.tight:weight on the Minnesota prior dummies.  Prior std dev on first lag is
               1/mnprior.tight
 mnprior.decay:prior std dev on lag j is 1/j^decay
 vprior.sig:   vector of nv prior std dev's of equation shocks
 vprior.w:     weight on vcv dummies.  (1 is reasonable; higher values tighten up.)
 train:        If present and non-zero, this is the point in the sample at which the
               "training sample" ends.  Prior x likelihood to this point is weighted to
               integrate to 1, and therefore is treated as if it were itself the prior.
               To do a pure training sample prior, set lambda=mu=0, mnprior=vprior=[],
               train>lags.  

flat:          Even with lambda=mu=0, vprior=mnprior=[], det(Sigma)^(-(nv+1)/2) is used
               as a "prior", unless flat=1.  flat, if present, must be 1 or 0.
               flat=1 is likely not to work unless train is reasonably large.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function w=mgnldnsty(ydata,lags,xdata,breaks,lambda,mu,mnprior,vprior,train,flat)
0002 %function w=mgnldnsty(ydata,lags,xdata,breaks,lambda,mu,mnprior,vprior,train,flat)
0003 % ydata:        endogenous variable data matrix, including initial condition dates.
0004 % xdata:        exogenous variable data matrix, including initial condition dates.
0005 % breaks:       breaks in the data.  The first lags data points after a break are used
0006 %               as new initial conditions, not data points for the fit.
0007 % lambda:       weight on the co-persistence prior dummy observation.  (5 is reasonable)
0008 %               lambda>0 => x variables included; lambda<0 => x variables excluded;
0009 % mu:           weight on variable-by-variable sum of coeffs dummy obs. (1 is reasonable)
0010 % mnprior.tight:weight on the Minnesota prior dummies.  Prior std dev on first lag is
0011 %               1/mnprior.tight
0012 % mnprior.decay:prior std dev on lag j is 1/j^decay
0013 % vprior.sig:   vector of nv prior std dev's of equation shocks
0014 % vprior.w:     weight on vcv dummies.  (1 is reasonable; higher values tighten up.)
0015 % train:        If present and non-zero, this is the point in the sample at which the
0016 %               "training sample" ends.  Prior x likelihood to this point is weighted to
0017 %               integrate to 1, and therefore is treated as if it were itself the prior.
0018 %               To do a pure training sample prior, set lambda=mu=0, mnprior=vprior=[],
0019 %               train>lags.
0020 %
0021 %flat:          Even with lambda=mu=0, vprior=mnprior=[], det(Sigma)^(-(nv+1)/2) is used
0022 %               as a "prior", unless flat=1.  flat, if present, must be 1 or 0.
0023 %               flat=1 is likely not to work unless train is reasonably large.
0024 if nargin<10,flat=0;end
0025 [T,nv]=size(ydata);
0026 [Tx,nx]=size(xdata);
0027 if Tx ~= T, error('ydata and xdata length mismatch'),end
0028 [ydum,xdum,pbreaks]=varprior(nv,nx,lags,mnprior,vprior);
0029 var=rfvar3([ydata;ydum],lags,[xdata;xdum],[breaks;T;T+pbreaks],lambda,mu);
0030 Tu=size(var.u,1);
0031 w=matrictint(var.u'*var.u,var.xxi,Tu-flat*(nv+1))-flat*.5*nv*(nv+1)*log(2*pi);
0032 if nargin>8
0033     if ~isempty(train) & train>0
0034         if train <= lags
0035             error('end of training sample <= # of lags')
0036         end
0037         Tp=train;
0038         tbreaks=breaks(find(breaks<train));
0039     else
0040         Tp=lags;
0041         tbreaks=[];
0042     end
0043 else
0044     Tp=lags;
0045     tbreaks=[];
0046 end
0047 varp=rfvar3([ydata(1:Tp,:);ydum],lags,[xdata(1:Tp);xdum],[tbreaks;Tp;Tp+pbreaks],lambda,mu);
0048 Tup=size(varp.u,1);
0049 wp=matrictint(varp.u'*varp.u,varp.xxi,Tup-flat*(nv+1)/2)-flat*.5*nv*(nv+1)*log(2*pi);
0050 w=w-wp;

Generated on Fri 16-Jun-2006 09:09:06 by m2html © 2003