diff options
author | Suraj Yerramilli | 2015-05-25 20:04:09 +0530 |
---|---|---|
committer | Suraj Yerramilli | 2015-05-25 20:04:09 +0530 |
commit | 695e9bd5adbb83e6b8a2330d0a5c7c8a0c6ddc75 (patch) | |
tree | ec97ca0a8d22926cf9c6d8d7bfeb78dd9c44dc9b | |
parent | 4df3d6525b9253375877eaa48dbbe36a379f3499 (diff) | |
download | SysID-R-code-695e9bd5adbb83e6b8a2330d0a5c7c8a0c6ddc75.tar.gz SysID-R-code-695e9bd5adbb83e6b8a2330d0a5c7c8a0c6ddc75.tar.bz2 SysID-R-code-695e9bd5adbb83e6b8a2330d0a5c7c8a0c6ddc75.zip |
added code to compute standard errors
-rw-r--r-- | R/impulse.R | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/R/impulse.R b/R/impulse.R index 6980725..3dcbaae 100644 --- a/R/impulse.R +++ b/R/impulse.R @@ -19,10 +19,15 @@ impulseest <- function(data,M=30,K=0){ Z <- t(sapply(ind,z_reg)) Y <- data$output[ind,] + # Fit Linear Model and find standard errors fit <- lm(Y~Z-1) + df <- nrow(Z)-ncol(Z);sigma2 <- resid(fit)^2/df + vcov <- sigma2 * inv(t(Z)*Z) + se <- sqrt(diag(vcov)) + out <- list(coefficients=coef(fit),residuals=resid(fit),lags=K:M+K, - x=colnames(data$input),y=colnames(data$output)) + x=colnames(data$input),y=colnames(data$output),se=) class(out) <- "impulseest" return(out) } |