summaryrefslogtreecommitdiff
path: root/R/estpoly.R
diff options
context:
space:
mode:
Diffstat (limited to 'R/estpoly.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"