The function generates the regressors of the mean equation in an arx model. The returned value is a matrix with the regressors and, by default, the regressand in column one. By default, observations (rows) with missing values are removed in the beginning and the end with na.trim, and the returned matrix is a zoo object.
regressorsMean(y, mc =FALSE, ar =NULL, ewma =NULL, mxreg =NULL, prefix="m", return.regressand =TRUE, return.as.zoo =TRUE, na.trim =TRUE, na.omit=FALSE)
Arguments
y: numeric vector, time-series or zoo object.
mc: logical. TRUE includes an intercept, whereas FALSE (default) does not.
ar: either NULL (default) or an integer vector, say, c(2,4) or 1:4 with the AR-lags to include in the mean specification. If NULL, then no lags are included.
ewma: either NULL (default) or a list with arguments sent to the eqwma function. In the latter case a lagged moving average of y is included as a regressor.
mxreg: either NULL (default), numeric vector or matrix, say, a zoo object, or data.frame containing conditioning variables (covariates). Note that, if both y and mxreg are zoo objects, then their samples are matched.
prefix: character, possibly of length zero, e.g. "" or character(0). The prefix added to the constant and covariate labels. The default is "m", so that the default labels are "mconst" and "mxreg".
return.regressand: logical. TRUE, the default, includes the regressand as column one in the returned matrix.
return.as.zoo: TRUE, the default, returns the matrix as a zoo object.
na.trim: TRUE, the default, removes observations with NA-values in the beginning and the end with na.trim.
na.omit: TRUE, the non-default, removes observations with NA-values, not necessarily in the beginning or in the end, with na.omit.
Returns
A matrix, by default of class zoo, with the regressand as column one (the default).
References
Pretis, Felix, Reade, James and Sucarrat, Genaro (2018): 'Automated General-to-Specific (GETS) Regression Modeling and Indicator Saturation for Outliers and Structural Breaks'. Journal of Statistical Software 86, Number 3, pp. 1-44. DOI: https://www.jstatsoft.org/article/view/v086i03