summaryrefslogtreecommitdiff
path: root/R/nonparam.R
diff options
context:
space:
mode:
authorSuraj Yerramilli2017-01-06 11:46:16 -0600
committerSuraj Yerramilli2017-01-06 11:46:16 -0600
commit1fd2aeb8c4b8e884a69ecef170dfe6e09d7d7a11 (patch)
tree460368be7b5bd21630725e91c4df1bd724cc2792 /R/nonparam.R
parent9050aeb27452c9e8fe01a491512cb2a101a100ff (diff)
downloadSysID-R-code-1fd2aeb8c4b8e884a69ecef170dfe6e09d7d7a11.tar.gz
SysID-R-code-1fd2aeb8c4b8e884a69ecef170dfe6e09d7d7a11.tar.bz2
SysID-R-code-1fd2aeb8c4b8e884a69ecef170dfe6e09d7d7a11.zip
global binding part 1
Diffstat (limited to 'R/nonparam.R')
-rw-r--r--R/nonparam.R10
1 files changed, 5 insertions, 5 deletions
diff --git a/R/nonparam.R b/R/nonparam.R
index 55fb4fa..75b26b4 100644
--- a/R/nonparam.R
+++ b/R/nonparam.R
@@ -100,7 +100,7 @@ plot.impulseest <- function(model,sd=2){
lim <- z$se*sd
yindex <- (i-1)%/%model$nin + 1;uindex <- i-model$nin*(yindex-1)
df <- data.frame(x=z$lags,y=coef(z),lim=lim)
- g[[i]] <- ggplot(df,aes(x,y))+
+ g[[i]] <- with(df,ggplot(df,aes(x,y))+
geom_segment(aes(xend=x,yend=0))+geom_hline(yintercept = 0) +
geom_point(size=2) + ggtitle(paste("From",z$x,"to",z$y))+
geom_line(aes(y=lim),linetype="dashed",colour="steelblue") +
@@ -109,7 +109,7 @@ plot.impulseest <- function(model,sd=2){
xlab(ifelse(yindex==model$nout,"Lags","")) +
theme(axis.title=element_text(size=12,color = "black",face = "plain"),
title=element_text(size=9,color = "black",face="bold")) +
- scale_x_continuous(expand = c(0.01,0.01))
+ scale_x_continuous(expand = c(0.01,0.01)))
}
multiplot(plotlist=g,layout=plotseq)
}
@@ -141,12 +141,12 @@ step <- function(model){
stepResp <- cumsum(coef(z))
yindex <- (i-1)%/%model$nin + 1;uindex <- i-model$nin*(yindex-1)
df <- data.frame(x=z$lags,y=stepResp)
- g[[i]] <- ggplot(df,aes(x,y))+
+ g[[i]] <- with(df,ggplot(df,aes(x,y))+
geom_step() + ggtitle(paste("From",z$x,"to",z$y)) +
theme_bw(14) + ylab(ifelse(uindex==1,"Step Response","")) +
xlab(ifelse(yindex==model$nout,"Lags","")) +
theme(axis.title=element_text(size=12,color = "black",face = "plain"),
- title=element_text(size=9,,color = "black",face="bold"))
+ title=element_text(size=9,,color = "black",face="bold")))
}
multiplot(plotlist=g,layout=plotseq)
}
@@ -214,7 +214,7 @@ mult_ccf <- function(X,Y=NULL,lag.max=30){
N <- dim(X)[1]; nx <- dim(X)[2]
ny <- ifelse(is.null(Y),nx,dim(Y)[2])
- ccvfij <- function(i,j,lag=30) ccf(X[,i],Y[,j],plot=F,lag=lag,
+ ccvfij <- function(i,j,lag=30) ccf(X[,i],Y[,j],plot=F,lag.max =lag,
type="covariance")
Xindex <- matrix(sapply(1:nx,rep,nx),ncol=1)[,1]
temp <- mapply(ccvfij,i=Xindex,j=rep(1:ny,ny),