diff options
author | Suraj Yerramilli | 2015-11-01 16:58:27 +0530 |
---|---|---|
committer | Suraj Yerramilli | 2015-11-01 16:58:27 +0530 |
commit | 839ab8c3cb6a260a4ad6904d00a332f52164b280 (patch) | |
tree | b0fa1bc8573d577e8aa146d45452201a73717b17 /R | |
parent | c80fbfc2f1cb1a07846f0c52e1a4625a427ea955 (diff) | |
download | SysID-R-code-839ab8c3cb6a260a4ad6904d00a332f52164b280.tar.gz SysID-R-code-839ab8c3cb6a260a4ad6904d00a332f52164b280.tar.bz2 SysID-R-code-839ab8c3cb6a260a4ad6904d00a332f52164b280.zip |
Corrections in ARX model
Diffstat (limited to 'R')
-rw-r--r-- | R/estpoly.R | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/R/estpoly.R b/R/estpoly.R index 84ff239..c95a1b3 100644 --- a/R/estpoly.R +++ b/R/estpoly.R @@ -167,8 +167,8 @@ residplot <- function(model,newdata=NULL){ #' @export arx <- function(x,order=c(0,1,0)){ y <- outputData(x); u <- inputData(x); N <- dim(y)[1] - na <- order[1];nb <- order[2]-1; nk <- order[3] - nb1 <- nb+nk ; n <- max(na,nb1); df <- N - na - nb - 1 + na <- order[1];nb <- order[2]; nk <- order[3] + nb1 <- nb+nk-1 ; n <- max(na,nb1); df <- N-na-nb padZeros <- function(x,n) c(rep(0,n),x,rep(0,n)) yout <- apply(y,2,padZeros,n=n); @@ -182,7 +182,7 @@ arx <- function(x,order=c(0,1,0)){ Y <- yout[n+1:(N+n),,drop=F] qx <- qr(X); coef <- qr.solve(qx,Y) - sigma2 <- sum((Y-X%*%coef)^2)/df + sigma2 <- sum((Y-X%*%coef)^2)/(df+n) vcov <- sigma2 * chol2inv(qx$qr) |