var_lm {bvhar} | R Documentation |
Fitting Vector Autoregressive Model of Order p Model
Description
This function fits VAR(p) using OLS method.
Usage
var_lm(y, p = 1, include_mean = TRUE, method = c("nor", "chol", "qr"))
## S3 method for class 'varlse'
print(x, digits = max(3L, getOption("digits") - 3L), ...)
## S3 method for class 'varlse'
knit_print(x, ...)
Arguments
y |
Time series data of which columns indicate the variables |
p |
Lag of VAR (Default: 1) |
include_mean |
Add constant term (Default: |
method |
Method to solve linear equation system.
( |
x |
|
digits |
digit option to print |
... |
not used |
Details
This package specifies VAR(p) model as
If include_type = TRUE
, there is term.
Otherwise (
include_type = FALSE
), there is no term.
The function estimates every coefficient matrix
.
Response matrix,
in var_design_formulation
Design matrix,
in var_design_formulation
Coefficient matrix is the form of
.
Then perform least squares to the following multivariate regression model
which gives
Value
var_lm()
returns an object named varlse
class.
It is a list with the following components:
- coefficients
Coefficient Matrix
- fitted.values
Fitted response values
- residuals
Residuals
- covmat
LS estimate for covariance matrix
- df
Numer of Coefficients: mp + 1 or mp
- p
Lag of VAR
- m
Dimension of the data
- obs
Sample size used when training =
totobs
-p
- totobs
Total number of the observation
- call
Matched call
- process
Process: VAR
- type
include constant term (
"const"
) or not ("none"
)- y0
- design
- y
Raw input
It is also a bvharmod
class.
References
Lütkepohl, H. (2007). New Introduction to Multiple Time Series Analysis. Springer Publishing.
See Also
-
summary.varlse()
to summarize VAR model -
predict.varlse()
to forecast the VAR process -
var_design_formulation for the model design
Examples
# Perform the function using etf_vix dataset
fit <- var_lm(y = etf_vix, p = 2)
class(fit)
str(fit)
# Extract coef, fitted values, and residuals
coef(fit)
head(residuals(fit))
head(fitted(fit))