diff options
author | Suraj Yerramilli | 2015-06-05 15:21:46 +0530 |
---|---|---|
committer | Suraj Yerramilli | 2015-06-05 15:21:46 +0530 |
commit | 8761a70a824268922831314e4fafc722c7eb965f (patch) | |
tree | 2d223f54150870727cf4bf663c6713d90ca47250 | |
parent | 52b824adf38cbd40f7eedc1b6f0fdd4ea5f80437 (diff) | |
download | SysID-R-code-8761a70a824268922831314e4fafc722c7eb965f.tar.gz SysID-R-code-8761a70a824268922831314e4fafc722c7eb965f.tar.bz2 SysID-R-code-8761a70a824268922831314e4fafc722c7eb965f.zip |
Complete ARX est function
-rw-r--r-- | R/estpoly.R | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/R/estpoly.R b/R/estpoly.R index 8714ca7..aa7b510 100644 --- a/R/estpoly.R +++ b/R/estpoly.R @@ -1,3 +1,6 @@ +#' Estimate ARX Models +#' +#' @export estARX <- function(data,order=c(0,1,0)){ y <- as.matrix(data$output) u <- as.matrix(data$input); N <- dim(y)[1] @@ -18,8 +21,11 @@ estARX <- function(data,order=c(0,1,0)){ vcov <- sigma2 * chol2inv(qx$qr) colnames(vcov) <- rownames(vcov) <- colnames(X) - list(coefficients = coef, - vcov = vcov, - sigma = sqrt(sigma2), - df = df) + model <- arx(A = c(1,coef[1:na]),B = coef[na+1:nb1],ioDelay = nk) + + est <- list(coefficients = model,vcov = vcov, sigma = sqrt(sigma2), + df = df,fitted.values=X%*%coef,residuals=Y-X%*%coef, + call=match.call()) + class(est) <- "estARX" + est }
\ No newline at end of file |