summaryrefslogtreecommitdiff
path: root/R
diff options
context:
space:
mode:
authorSuraj Yerramilli2015-11-02 12:59:58 +0530
committerSuraj Yerramilli2015-11-02 12:59:58 +0530
commite4c6a6edcdf7a7dfbf8c93c3619ad3172aee3125 (patch)
treed0c77b0d066e79cd63767cb2e4fd7373542be9cd /R
parentb5a9ab0b91227a2987c9c026999ca463c195052c (diff)
downloadSysID-R-code-e4c6a6edcdf7a7dfbf8c93c3619ad3172aee3125.tar.gz
SysID-R-code-e4c6a6edcdf7a7dfbf8c93c3619ad3172aee3125.tar.bz2
SysID-R-code-e4c6a6edcdf7a7dfbf8c93c3619ad3172aee3125.zip
Modified prediction function
Diffstat (limited to 'R')
-rw-r--r--R/estpoly.R11
1 files changed, 9 insertions, 2 deletions
diff --git a/R/estpoly.R b/R/estpoly.R
index fbb77cf..8c7494c 100644
--- a/R/estpoly.R
+++ b/R/estpoly.R
@@ -84,7 +84,14 @@ predict.estPoly <- function(model,newdata=NULL){
if(is.null(newdata)){
return(fitted(model))
} else{
- return(sim(coef(model),newdata$input))
+ mod <- coef(model)
+ y <- outputData(newdata); u <- inputData(newdata)
+ if(mod$type=="arx"){
+ f1 <- Ma(c(rep(0,mod$ioDelay),mod$B))
+ f2 <- Ma(c(0,-mod$A[-1]))
+ ypred <- filter(f1,u) + filter(f2,y)
+ }
+ return(ypred)
}
}
@@ -99,7 +106,7 @@ plot.estPoly <- function(model,newdata=NULL){
titstr <- "Predictions of Model on Training Set"
} else{
if(class(newdata)!="idframe") stop("Only idframe objects allowed")
- ypred <- sim(coef(model),inputData(newdata))
+ ypred <- predict(model,newdata)
yact <- outputData(newdata)[,1]
time <- time(newdata)
titstr <- "Predictions of Model on Test Set"