Dynamic model averaging
r=DMA1(y,z,x,lamda,alpha,nxmax,PRM,PRV,prefix_db)
* y = a (nobs x 1) vector of endogenous variables
* z = a (nobs x nZ) vector of compulsory exogenous variables
* x = a (nobs x nx) vector of potential exogenous variables
* lamda = a scalar, the forgetting factor for past observations in the calculation of the time-varying coefficients
* alpha = a scalar, the forgetting factor of past performance (a forecast k periods old have a weight equal to k^alpha)
* nxmax = the maximum # of non zero optional coefficients in any model
* PRM = a (nx+nz x 1) vector of prior expectation for the coefficents of the x exogenous variables
* PRV = a (nx+nz x 1) vector of prior values for the variancce of these priors
* prefix_db = the prefix of the database where big volume data will be stored
* rdma = a results tlist with:
- rdma('meth') = 'DMA'
- rdma('y') = (nobs x 1) vector of endogenous variables
- rdma('x fixed') = (nobs x nZ) matrix of compulsory exogenous variables
- rdma('x variable') = (nobs x nZ) matrix of potential exogenous variables
- rdma('lamda') = a scalar, the forgetting factor for past observations in the calculation of the time-varying coefficients
- rdma('alpha') = a scalar, the forgetting factor of past performance (a forecast k periods old have a weight equal to k^alpha)
- rdma('nx max') = the maximum # of non zero coefficients in any model
- rdma('vars proba') = a (nx x nobs) matrix giving the probability assigned to each variable at each date
- rdma('global forecast') = a (nobs x 1) vector giving the weighted forecast of all possible models
- rdma('best model') = a (nobs x 1) vector giving the index of the the best model at each date
- rdma('best model forecast') = a (nobs x 1) vector giving the forecast by the best model at each date
- rdma('combinations') = a (K x (nZ+nx)) matrix indicating for each model which variables are in the model (1 value in corresponding column) and which variables are not in the model (0 value in corresponding column)
- rdma('library') = name of the library where big volume results are stored
- rdma('n db') = # of corresponding databases
- rdma('exp # of models') = (nobs x 1) vector of # of expected models at each date
- rdma('exp theta') = (nobs x (N+nZ)) vector of expected values at each date for each variable
load(GROCERDIR+'\data\us_modinf.dat') bounds('1960q3','2008q2') // recover the endogenous, compulsory and optional arguments matrices from selected variables in database us_modinf.dat [mats,names]=explon(list('100*lagts(-1,delts(log(GDPDEFL)))',['const';'100*delts(log(GDPDEFL))';'100*lagts(delts(log(GDPDEFL)))'],... ['UNRATE';'100*delts(log(PCECC96))';'100*delts(log(PRFI))';'100*delts(log(GDPC96))';'log(HOUST)']),... ['endogenous' 'fixed exogenous' 'variable exogenous'],[],%t,%t); y=mats(1); zf=mats(2); zv=mats(3); // run a DMA1 estimation with matrices y, zf,zv, maximum number of optional argument set to 5 (i.e the number // of optional variables), forgetting factor for past observations in the calculation of the time-varying coefficients set to 0.99, // forgetting factor of past performance set to 0.99 and default values for other parameters, // prior values set to 0 for all coefficients, prior variances set to 100 for all coefficients, // and big volume information saved into files gdpdefl1.dat, gdpdefl2.dat,... in folder 'c:/mydma' resdma=DMA1(y,zf,zv,0.99,0.99,5,zeros(1,8),100*ones(1,8),'c:/mydma/gdpdefl') | ![]() | ![]() |