From f995715a8525d9e01528a60ed1a718b3aeff3111 Mon Sep 17 00:00:00 2001 From: Suraj Yerramilli Date: Sun, 22 Mar 2015 23:55:38 +0530 Subject: Added skeleton for impulse response models --- R/impulse.R | 24 ++++++++++++++++++++++++ R/tf.R | 1 + 2 files changed, 25 insertions(+) create mode 100644 R/impulse.R (limited to 'R') diff --git a/R/impulse.R b/R/impulse.R new file mode 100644 index 0000000..834a42d --- /dev/null +++ b/R/impulse.R @@ -0,0 +1,24 @@ +# Estimate Impulse Response Models +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 <- list() + class(out) <- "impulseest" + return(out) +} + +# Impulse Response Plots +impulse <- function(model){ + +} + + +# Step Response Plots +step <- function(model){ + +} diff --git a/R/tf.R b/R/tf.R index 2338778..350f4bd 100644 --- a/R/tf.R +++ b/R/tf.R @@ -19,6 +19,7 @@ tf <- function(num=c(1),den=c(1),Ts=1){ #' Printing method for objects inheriting from class \code{tf} #' #' @param G an object of class \code{tf} +#' @export print.tf <- function(G){ cat("Transfer Function \nG(q^{-1}) = B(q^{-1})/A(q^{-1}) \n\n") cat("A(q^{-1}) = ") -- cgit