From 699acc508b46bd7606d6c7feffc9b95cf9d0d5aa Mon Sep 17 00:00:00 2001 From: Suraj Yerramilli Date: Tue, 9 Jun 2015 14:09:34 +0530 Subject: Minor Plot Changes --- R/estpoly.R | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'R') 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") } -- cgit