summaryrefslogtreecommitdiff
path: root/R/predict.R
diff options
context:
space:
mode:
authorSuraj Yerramilli2016-01-04 19:28:00 +0530
committerSuraj Yerramilli2016-01-04 19:28:00 +0530
commitd831fea9c22bb609a2c4d4131b666eb4a654bb51 (patch)
tree0a41ed36fe6f142e74933b995bff4c71b4f71d99 /R/predict.R
parent95f6c4a8eed9b192a956a609d3bbb2418e198574 (diff)
downloadSysID-R-code-d831fea9c22bb609a2c4d4131b666eb4a654bb51.tar.gz
SysID-R-code-d831fea9c22bb609a2c4d4131b666eb4a654bb51.tar.bz2
SysID-R-code-d831fea9c22bb609a2c4d4131b666eb4a654bb51.zip
minor changes
Diffstat (limited to 'R/predict.R')
-rw-r--r--R/predict.R33
1 files changed, 19 insertions, 14 deletions
diff --git a/R/predict.R b/R/predict.R
index 2cbcf20..a3a8083 100644
--- a/R/predict.R
+++ b/R/predict.R
@@ -1,4 +1,3 @@
-#' @export
predict.idpoly <- function(x,data,nahead=1){
y <- outputData(data); u<- inputData(data)
G <- signal::Arma(b=c(rep(0,x$ioDelay),x$B),
@@ -22,6 +21,22 @@ predict.idpoly <- function(x,data,nahead=1){
ts(ypred,start=start(data),deltat=deltat(data))
}
+polyinv <- function(x,k){
+ gamma <- 1/Re(polyroot(x))
+
+ inverse <- function(y,k){
+ sapply(1:k-1,function(i) y^i)
+ }
+ z <- lapply(lapply(gamma,inverse,k=2),polynom::polynomial)
+ temp = z[[1]]
+ if(length(z)>1){
+ for(i in 2:length(z)){
+ temp = temp*z[[i]]
+ }
+ }
+ temp
+}
+
#' @export
predict.estpoly <- function(x,newdata=NULL,nahead=1){
if(is.null(newdata)&& nahead==1){
@@ -39,18 +54,8 @@ predict.estpoly <- function(x,newdata=NULL,nahead=1){
}
}
-polyinv <- function(x,k){
- gamma <- 1/Re(polyroot(x))
+#' @import ggplot2 reshape
+#' @export
+compare <- function(){
- inverse <- function(y,k){
- sapply(1:k-1,function(i) y^i)
- }
- z <- lapply(lapply(gamma,inverse,k=2),polynom::polynomial)
- temp = z[[1]]
- if(length(z)>1){
- for(i in 2:length(z)){
- temp = temp*z[[i]]
- }
- }
- temp
} \ No newline at end of file