summaryrefslogtreecommitdiff
path: root/R/predict.R
diff options
context:
space:
mode:
authorSuraj Yerramilli2016-01-04 19:36:56 +0530
committerSuraj Yerramilli2016-01-04 19:36:56 +0530
commit26b6f9b837dac73f927a5ceed9442544191c2258 (patch)
tree3fbcb8f411f3b027a966719b55e48e3c3ee3df9b /R/predict.R
parentd831fea9c22bb609a2c4d4131b666eb4a654bb51 (diff)
downloadSysID-R-code-26b6f9b837dac73f927a5ceed9442544191c2258.tar.gz
SysID-R-code-26b6f9b837dac73f927a5ceed9442544191c2258.tar.bz2
SysID-R-code-26b6f9b837dac73f927a5ceed9442544191c2258.zip
added the compare routine
Diffstat (limited to 'R/predict.R')
-rw-r--r--R/predict.R12
1 files changed, 10 insertions, 2 deletions
diff --git a/R/predict.R b/R/predict.R
index a3a8083..d11578e 100644
--- a/R/predict.R
+++ b/R/predict.R
@@ -54,8 +54,16 @@ predict.estpoly <- function(x,newdata=NULL,nahead=1){
}
}
-#' @import ggplot2 reshape
+#' @import ggplot2 reshape2
#' @export
-compare <- function(){
+compare <- function(data,nahead=1,...){
+ # Input Validation
+ dots <- list(...)
+ if(is.null(dots)) stop("No model supplied")
+ Y <- sapply(dots,predict,newdata=data,nahead=nahead)
+ df <- data.frame(Time = time(data),Actual=outputData(data)[,1],Y)
+ meltdf <- melt(df,id="Time")
+
+ ggplot(meltdf,aes(x=Time,y=value,color=variable,group=variable))+geom_line()
} \ No newline at end of file