diff options
author | Suraj Yerramilli | 2015-06-09 14:09:34 +0530 |
---|---|---|
committer | Suraj Yerramilli | 2015-06-09 14:09:34 +0530 |
commit | 699acc508b46bd7606d6c7feffc9b95cf9d0d5aa (patch) | |
tree | 4f63202236b1ee2aa71215406d65a9e683d4d2f8 /R | |
parent | 2bf1b001bf28c1203ee9988dd97473e2cc9ad602 (diff) | |
download | SysID-R-code-699acc508b46bd7606d6c7feffc9b95cf9d0d5aa.tar.gz SysID-R-code-699acc508b46bd7606d6c7feffc9b95cf9d0d5aa.tar.bz2 SysID-R-code-699acc508b46bd7606d6c7feffc9b95cf9d0d5aa.zip |
Minor Plot Changes
Diffstat (limited to 'R')
-rw-r--r-- | R/estpoly.R | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/R/estpoly.R b/R/estpoly.R index eca1a5f..01bdd71 100644 --- a/R/estpoly.R +++ b/R/estpoly.R @@ -1,22 +1,22 @@ #' @export plot.estPoly <- function(model,newdata=NULL){ require(ggplot2) - require(reshape2) if(is.null(newdata)){ ypred <- fitted(model) yact <- fitted(model) + resid(model) time <- model$time + titstr <- "Predictions of Model on Training Set" } else{ if(class(newdata)!="idframe") stop("Only idframe objects allowed") ypred <- sim(coef(model),newdata$input[,1,drop=F]) yact <- newdata$output[,1,drop=F] time <- seq(from=newdata$t.start,to=newdata$t.end,by=newdata$Ts) + titstr <- "Predictions of Model on Test Set" } df <- data.frame(Predicted=ypred,Actual=yact,Time=time) - meltdf <- melt(df,id="Time") - ggplot(meltdf, aes(x = Time,y=value,colour=variable,group=variable)) + - geom_line() + theme_bw() + ggplot(df, aes(x = Actual,y=Predicted)) + ggtitle(titstr) + + geom_abline(intercept=0,slope=1,colour="red4") + geom_point() } #' @export @@ -30,7 +30,7 @@ residplot <- function(model,newdata=NULL){ } acorr <- acf(e,plot = F); ccorr <- ccf(as.numeric(u),e,plot = F) - par(mfrow=c(2,1),mar=c(3,4,4,2)) + par(mfrow=c(2,1),mar=c(3,4,3,2)) plot(acorr,main="ACF of residuals") plot(ccorr,main="CCF between the input and residuals",ylab="CCF") } |