summaryrefslogtreecommitdiff
path: root/R
diff options
context:
space:
mode:
authorSuraj Yerramilli2015-03-23 00:15:21 +0530
committerSuraj Yerramilli2015-03-23 00:15:21 +0530
commite1cc3dd25ff07f9eead3c40a24ffa29466232dff (patch)
treeea147ebae454e1b8fe89277c96e01818790a65cb /R
parentf995715a8525d9e01528a60ed1a718b3aeff3111 (diff)
downloadSysID-R-code-e1cc3dd25ff07f9eead3c40a24ffa29466232dff.tar.gz
SysID-R-code-e1cc3dd25ff07f9eead3c40a24ffa29466232dff.tar.bz2
SysID-R-code-e1cc3dd25ff07f9eead3c40a24ffa29466232dff.zip
added raw documentation for the impulseest function
Diffstat (limited to 'R')
-rw-r--r--R/impulse.R30
1 files changed, 28 insertions, 2 deletions
diff --git a/R/impulse.R b/R/impulse.R
index 834a42d..d248f88 100644
--- a/R/impulse.R
+++ b/R/impulse.R
@@ -1,4 +1,30 @@
-# Estimate Impulse Response Models
+#' 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)
@@ -7,7 +33,7 @@ impulseest <- function(data,lags=30,conf=0.95){
ir <- irf(fit.var,impulse=colnames(data$input),response=colnames(data$output),
n.ahead = lags,ci=conf)
- out <- list()
+ out <- ir
class(out) <- "impulseest"
return(out)
}