summaryrefslogtreecommitdiff
path: root/R
diff options
context:
space:
mode:
authorSuraj Yerramilli2015-06-07 18:05:17 +0530
committerSuraj Yerramilli2015-06-07 18:05:17 +0530
commitb13406ccec1bea7dfbba4d4d5572eb69930e565a (patch)
tree2dead597a3226a6319dbbb686c6a43122b3510f3 /R
parentd6036ccc9963acf0903457e48150f608eb77dd8c (diff)
downloadSysID-R-code-b13406ccec1bea7dfbba4d4d5572eb69930e565a.tar.gz
SysID-R-code-b13406ccec1bea7dfbba4d4d5572eb69930e565a.tar.bz2
SysID-R-code-b13406ccec1bea7dfbba4d4d5572eb69930e565a.zip
Minor changes
Diffstat (limited to 'R')
-rw-r--r--R/estpoly.R13
1 files changed, 12 insertions, 1 deletions
diff --git a/R/estpoly.R b/R/estpoly.R
index 64cdb3e..b327c77 100644
--- a/R/estpoly.R
+++ b/R/estpoly.R
@@ -19,6 +19,17 @@ plot.estPoly <- function(model,newdata=NULL){
geom_line() + theme_bw()
}
+#' @export
+residplot <- function(model,newdata=NULL){
+ if(is.null(newdata)){
+ e <- resid(model); u <- model$input
+ } else{
+ if(class(newdata)!="idframe") stop("Only idframe objects allowed")
+ e <- newdata$output - predict(model,newdata)
+ }
+
+}
+
#' Estimate ARX Models
#'
#' Fit an ARX model of the specified order given the input-output data
@@ -108,7 +119,7 @@ predict.estARX <- function(model,newdata=NULL){
if(is.null(newdata)){
return(fitted(model))
} else{
- return(sim(coef(model),newdata))
+ return(sim(coef(model),as.numeric(newdata$input)))
}
}