quadVAR {quadVAR}R Documentation

Estimate lag-1 quadratic vector autoregression models

Description

This function estimate regularized nonlinear quadratic vector autoregression models with strong hierarchy using the RAMP::RAMP() algorithm, and also compare it with the linear AR, regularized VAR, and unregularized (full) VAR and quadratic VAR models.

Usage

quadVAR(
  data,
  vars,
  dayvar = NULL,
  beepvar = NULL,
  penalty = "LASSO",
  tune = "EBIC",
  donotestimate = NULL,
  SIS_options = list(),
  RAMP_options = list()
)

## S3 method for class 'quadVAR'
print(x, ...)

## S3 method for class 'quadVAR'
summary(object, ...)

## S3 method for class 'quadVAR'
coef(object, ...)

## S3 method for class 'coef_quadVAR'
print(
  x,
  use_actual_names = TRUE,
  abbr = FALSE,
  minlength = 3,
  omit_zero = TRUE,
  digits = 2,
  row.names = FALSE,
  ...
)

## S3 method for class 'quadVAR'
plot(x, value = NULL, value_standardized = TRUE, interactive = FALSE, ...)

Arguments

data

A tibble, data.frame, or matrix that represents a time series of vectors, with each row as a time step.

vars

A character vector of the variable names used in the model.

dayvar

String indicating assessment day. Adding this argument makes sure that the first measurement of a day is not regressed on the last measurement of the previous day. IMPORTANT: only add this if the data has multiple observations per day.

beepvar

Optional string indicating assessment beep per day. Adding this argument will cause non-consecutive beeps to be treated as missing!

penalty

The penalty used for the linear and regularized VAR models. Possible options include "LASSO", "SCAD", "MCP", with "LASSO" as the default.

tune

Tuning parameter selection method. Possible options include "AIC", "BIC", "EBIC", with "EBIC" as the default.

donotestimate

A character vector of the model names that are not estimated. Possible options include, "NULL_model", "AR", "VAR", "VAR_full", "quadVAR_full", "all_others", with NULL as the default. If set "all_others", then only a quadVAR model will be estimated. For datasets with large number of variables, you may set this parameter to "quadVAR_full" to save time.

SIS_options

A list of other parameters for the SIS::tune.fit() function. This is used for the regularized VAR models.

RAMP_options

A list of other parameters for the RAMP::RAMP() function. This is used for the nonlinear quadratic VAR model.

...

For print.quadVAR, additional arguments passed to print.coef_quadVAR(). For print.coef_quadVAR, additional arguments passed to print.data.frame().

object, x

An quadVAR object. (For print.coef_quadVAR, an coef_quadVAR object returned by coef.quadVAR().)

use_actual_names

Logical. If TRUE, the actual variable names are used in the output. If FALSE, the names "X1", "X2", etc., are used in the output. Default is TRUE.

abbr

Logical. If TRUE, the output is abbreviated. Default is FALSE.

minlength

the minimum length of the abbreviations.

omit_zero

Logical. If TRUE, the coefficients that are zero are omitted. Default is FALSE.

digits

the minimum number of significant digits to be used: see print.default.

row.names

logical (or character vector), indicating whether (or what) row names should be printed.

value

A numeric vector of length 1 or the same as the number of nodes, that specifies the values of the variables that the linearized model will be based on. If the length is 1, the same value will be used for all variables. The default value is NULL, in which case the value will be set to 0 in calculation, which means (if value_standardized = TRUE) the linearized model will be based on the mean values of all variables.

value_standardized

A logical value that specifies whether the input value is standardized or not. If TRUE, the input value will be regarded as standardized value, i.e., mean + value * sd (e.g., 0 is the mean, 1 is mean + sd, ...). If FALSE, the input value will regarded as in the raw scale of the input data. If the raw dataset was already standardized, this parameter does not have an effect. The default value is TRUE.

interactive

Whether to produce an interactive plot using shiny (in which the user can change the values of variables interactively) or a static plot using qgraph::qgraph(). Default is FALSE.

Value

An quadVAR object that contains the following elements:

Methods (by generic)

Functions

See Also

linear_quadVAR_network()

Examples

set.seed(1614)
data <- sim_4_emo(time = 200, sd = 1)
plot(data[, "x1"])
qV1 <- quadVAR(data, vars = c("x1", "x2", "x3", "x4"))
summary(qV1)
coef(qV1)
plot(qV1)
# Compare the estimation with the true model
plot(true_model_4_emo())
plot(qV1, value = 0, value_standardized = FALSE, layout = plot(true_model_4_emo())$layout)


[Package quadVAR version 0.1.2 Index]