tslarsP {robustHD} | R Documentation |
(Robust) least angle regression for time series data with fixed lag length
Description
(Robustly) sequence groups of candidate predictors and their respective lagged values according to their predictive content and find the optimal model along the sequence. Note that lagged values of the response are included as a predictor group as well.
Usage
tslarsP(x, ...)
## S3 method for class 'formula'
tslarsP(formula, data, ...)
## Default S3 method:
tslarsP(
x,
y,
h = 1,
p = 2,
sMax = NA,
fit = TRUE,
s = c(0, sMax),
crit = "BIC",
ncores = 1,
cl = NULL,
model = TRUE,
...
)
rtslarsP(x, ...)
## S3 method for class 'formula'
rtslarsP(formula, data, ...)
## Default S3 method:
rtslarsP(
x,
y,
h = 1,
p = 2,
sMax = NA,
centerFun = median,
scaleFun = mad,
regFun = lmrob,
regArgs = list(),
combine = c("min", "euclidean", "mahalanobis"),
winsorize = FALSE,
const = 2,
prob = 0.95,
fit = TRUE,
s = c(0, sMax),
crit = "BIC",
ncores = 1,
cl = NULL,
seed = NULL,
model = TRUE,
...
)
Arguments
x |
a numeric matrix or data frame containing the candidate predictor series. |
... |
additional arguments to be passed down. |
formula |
a formula describing the full model. |
data |
an optional data frame, list or environment (or object coercible
to a data frame by |
y |
a numeric vector containing the response series. |
h |
an integer giving the forecast horizon (defaults to 1). |
p |
an integer giving the number of lags in the model (defaults to 2). |
sMax |
an integer giving the number of predictor series to be
sequenced. If it is |
fit |
a logical indicating whether to fit submodels along the sequence
( |
s |
an integer vector of length two giving the first and last
step along the sequence for which to compute submodels. The default
is to start with a model containing only an intercept (step 0) and
iteratively add all series along the sequence (step |
crit |
a character string specifying the optimality criterion to be
used for selecting the final model. Currently, only |
ncores |
a positive integer giving the number of processor cores to be
used for parallel computing (the default is 1 for no parallelization). If
this is set to |
cl |
a parallel cluster for parallel computing as generated by
|
model |
a logical indicating whether the model data should be included in the returned object. |
centerFun |
a function to compute a robust estimate for the center
(defaults to |
scaleFun |
a function to compute a robust estimate for the scale
(defaults to |
regFun |
a function to compute robust linear regressions that can be
interpreted as weighted least squares (defaults to
|
regArgs |
a list of arguments to be passed to |
combine |
a character string specifying how to combine the data
cleaning weights from the robust regressions with each predictor group.
Possible values are |
winsorize |
a logical indicating whether to clean the data by multivariate winsorization. |
const |
numeric; tuning constant for multivariate winsorization to be used in the initial corralation estimates based on adjusted univariate winsorization (defaults to 2). |
prob |
numeric; probability for the quantile of the
|
seed |
optional initial seed for the random number generator
(see |
Value
If fit
is FALSE
, an integer vector containing the indices of
the sequenced predictor series.
Otherwise an object of class "tslarsP"
(inheriting from classes
"grplars"
and "seqModel"
) with the following components:
active
an integer vector containing the sequence of predictor series.
s
an integer vector containing the steps for which submodels along the sequence have been computed.
coefficients
a numeric matrix in which each column contains the regression coefficients of the corresponding submodel along the sequence.
fitted.values
a numeric matrix in which each column contains the fitted values of the corresponding submodel along the sequence.
residuals
a numeric matrix in which each column contains the residuals of the corresponding submodel along the sequence.
df
an integer vector containing the degrees of freedom of the submodels along the sequence (i.e., the number of estimated coefficients).
robust
a logical indicating whether a robust fit was computed.
scale
a numeric vector giving the robust residual scale estimates for the submodels along the sequence (only returned for a robust fit).
crit
an object of class
"bicSelect"
containing the BIC values and indicating the final model (only returned if argumentcrit
is"BIC"
and arguments
indicates more than one step along the sequence).muX
a numeric vector containing the center estimates of the predictor variables.
sigmaX
a numeric vector containing the scale estimates of the predictor variables.
muY
numeric; the center estimate of the response.
sigmaY
numeric; the scale estimate of the response.
x
the matrix of candidate predictor series (if
model
isTRUE
).y
the response series (if
model
isTRUE
).assign
an integer vector giving the predictor group to which each predictor variable belongs.
w
a numeric vector giving the data cleaning weights (only returned for a robust fit).
h
the forecast horizon.
p
the number of lags in the model.
call
the matched function call.
Note
The predictor group of lagged values of the response is indicated by the index 0.
Author(s)
Andreas Alfons, based on code by Sarah Gelper
References
Alfons, A., Croux, C. and Gelper, S. (2016) Robust groupwise least angle regression. Computational Statistics & Data Analysis, 93, 421–435. doi:10.1016/j.csda.2015.02.007
See Also
coef
,
fitted
,
plot
,
predict
,
residuals
,
rstandard
,
tslars
, lmrob