regressorsMean {gets} | R Documentation |
Create the regressors of the mean equation
Description
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.
Usage
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 |
mc |
logical. |
ar |
either |
ewma |
either |
mxreg |
either |
prefix |
character, possibly of length zero, e.g. |
return.regressand |
logical. |
return.as.zoo |
|
na.trim |
|
na.omit |
|
Value
A matrix, by default of class zoo
, with the regressand as column one (the default).
Author(s)
Genaro Sucarrat, http://www.sucarrat.net/
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
See Also
arx
, isat
, regressorsVariance
, zoo
, eqwma
, na.trim
and na.trim
.
Examples
##generate some data:
y <- rnorm(10) #regressand
x <- matrix(rnorm(10*5), 10, 5) #regressors
##create regressors (examples):
regressorsMean(y, mxreg=x)
regressorsMean(y, mxreg=x, return.regressand=FALSE)
regressorsMean(y, mc=TRUE, ar=1:3, mxreg=x)
regressorsMean(log(y^2), mc=TRUE, ar=c(2,4))
##let y and x be time-series:
y <- ts(y, frequency=4, end=c(2018,4))
x <- ts(x, frequency=4, end=c(2018,4))
regressorsMean(y, mxreg=x)
regressorsMean(y, mc=TRUE, ar=1:3, mxreg=x)
regressorsMean(log(y^2), mc=TRUE, ar=c(2,4))
##missing values (NA):
y[1] <- NA
x[10,3] <- NA
regressorsMean(y, mxreg=x)
regressorsMean(y, mxreg=x, na.trim=FALSE)