summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSuraj Yerramilli2016-03-22 16:06:37 +0530
committerSuraj Yerramilli2016-03-22 16:06:37 +0530
commit42e6b36e1b8f1648f3b2735f2b4092953d4d43a6 (patch)
treecaafd94117018198d0d5d62cf881dfa4e262ceac
parent0ea4b417f4bf59760c5b96419be12b70dd5bd586 (diff)
downloadSysID-R-code-42e6b36e1b8f1648f3b2735f2b4092953d4d43a6.tar.gz
SysID-R-code-42e6b36e1b8f1648f3b2735f2b4092953d4d43a6.tar.bz2
SysID-R-code-42e6b36e1b8f1648f3b2735f2b4092953d4d43a6.zip
support for centering data
-rw-r--r--R/preprocess.R10
1 files changed, 7 insertions, 3 deletions
diff --git a/R/preprocess.R b/R/preprocess.R
index 36c4281..ad9df75 100644
--- a/R/preprocess.R
+++ b/R/preprocess.R
@@ -30,15 +30,19 @@ detrend <- function(x,type=0){
reg <- time(x)
if(class(type)=="trendInfo"){
- tinfo = type
+ tinfo <- type
} else if(type == 0){
tinfo <- trendInfo()
if(nOutputSeries(x)!=0){
-
+ outputData(z) <- apply(outputData(x),2,scale,T,F)
+ tinfo$OutputOffset <- colMeans(z$output)
+ tinfo$OutputSlope <- t(rep(0,nOutputSeries(x)))
}
if(nInputSeries(x)!=0){
-
+ inputData(z) <- apply(inputData(x),2,scale,T,F)
+ tinfo$InputOffset <- colMeans(z$input)
+ tinfo$InputSlope <- t(rep(0,nInputSeries(x)))
}
} else if(type==1){
formula <- X ~ reg