1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
#' Estimate Impulse Response Models
#'
#' \code{impulseest} is used to estimate impulse response models given data
#'
#' @param data an object of class \code{idframe}
#' @param lags The number of lags upto which the estimate is to be
#' calculated. (Default:\code{30})
#' @param conf The confidence interval
#'
#' @details
#'
#' This function extends the \code{\link[vars]{irf}} function, which estimates the
#' impulse response coefficients given a VAR model for the data. The VAR model is fit
#' using the \code{\link[vars]{VAR}} function.
#'
#' @return An object of class \code{impulseest} containing the following elements
#' \tabular{ll}{
#' \code{coefs} \tab \code{list} containing the impulse response coefficients \cr
#' \code{lower} \tab \code{list} containing the lower confidence bounds of the
#' impulse response coefficients \cr
#' \code{upper} \tab \code{list} containing the upper confidence bounds of the
#' impulse response coefficients \cr
#' }
#'
#' @seealso \code{\link[vars]{irf}}, \code{\link[vars]{VAR}}, \code{\link{impulse}} ,
#' \code{\link{step}}
#' @export
impulseest <- function(data,lags=30,conf=0.95){
require(vars)
Z <- cbind(data$output,data$input)
fit.var <- VAR(Z,p=10)
ir <- irf(fit.var,impulse=colnames(data$input),response=colnames(data$output),
n.ahead = lags,ci=conf)
out <- ir
class(out) <- "impulseest"
return(out)
}
#' Impulse Response Plots
#'
#' Plots the estimated IR Coefficients
#'
#' @param model an object of class \code{impulseest}
#'
#' @seealso \code{\link{impulseest}},\code{\link{step}}
#' @export
impulse <- function(model){
}
#' Step Response Plots
#'
#' Plots the step response of a system, given the IR model
#'
#' @param model an object of class \code{impulseest}
#'
#' @seealso \code{\link{impulseest}},\code{\link{impulse}}
#' @export
step <- function(model){
}
|