Dynamic model averaging
rdma=DMA(namey,exof,exonf,lamda,alpha,arg1,...,argn)
* namey = a (nobs x 1) vector of endogenous variables
* exof = a (nobs x nz) vector of compulsory exogenous variables
* exonf = 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)
* arg1,...,argn: optional arguments that can be:
- 'prefix_db=xx' where xx is the prefix (folder and start of the file) of the database where data with a big volume (probabilities and coefficient updates, forecast of each model)
- 'dropna=%t' if the user wants to work with all dates with non NA values
- the string 'noprint' if the user doesn't want to print the results of the regression
- 'nxmax=xx' where xx is the the maximum # of variables allowed in a model (default: no constraint)
- 'PRM=xx' where xx is either a scalar or a (N x 1) vectors of a priori values for the coefficients
- 'PRV=' thewhere xx is either a scalar or a (N x 1) vectors of a priori values for their variance
* 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
- rdma('namey') = name of the y variable
- rdma('fixed namex') = name of the compulsory exogenous variables
- rdma('variable namex') = name of the potential exogenous variables
- rdma('dropna') = boolean indicating if NAs have been dropped
- rdma('prests') = boolean indicating the presence or absence of a time series in the regression
- rdma('bounds') = if there is a time series in the regression, the bounds of the regression
load(GROCERDIR+'\data\us_modinf.dat') bounds('1960q3','2008q2') // make a dynamic model averaging estimation with '100*lagts(-1,delts(log(GDPDEFL)))' as endogenous // variable, 'const', '100*delts(log(GDPDEFL))' and '100*lagts(delts(log(GDPDEFL)))' as imposed exogenous variables // 'UNRATE', '100*delts(log(PCECC96))', '100*delts(log(PRFI))', 100*delts(log(GDPC96))' and 'log(HOUST) as free // exogenous 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 resdma=DMA('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)'],0.99,0.99) // plot the number of expected variables pltdma_expnbvar(resdma) // plot the probabilities and expected coefficients // of all variables pltdma_probvar(resdma,'all') // display the best model at some dates prtdma_bestmodel(resdma,['1988q2';'1993q2';'1998q2';'2003q2';'2008q2'],%io(2)) // makes a dynamic model averaging estimation with the same variables, but with forgetting factors now set to 0.95 // and big volume information saved into files gdpdefl1.dat, gdpdefl2.dat,... in folder 'c:/mydma' resdma=DMA('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)'],0.95,0.95,'prefix_db=c:/mydma/gdpdefl') | ![]() | ![]() |