From 624c5ecc8cfa62890a710bafacea4571f3433a21 Mon Sep 17 00:00:00 2001
From: Fredrik Bagge Carlsson <cont-frb@ulund.org>
Date: Fri, 4 Sep 2015 10:15:21 +0200
Subject: [PATCH] Add more methods

---
 src/armax.jl | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/armax.jl b/src/armax.jl
index 8e42534..a9dbf11 100644
--- a/src/armax.jl
+++ b/src/armax.jl
@@ -1,4 +1,4 @@
-"""`ar(y, na; λ = 0, doplot=false)`"""
+"""`ar(y, na; λ = 0, doplot=false, bias=false)`"""
 function ar(y, na; λ = 0, doplot=false, bias=false)
     y_train, A = getARRegressor(y,na;bias=bias)
     n_points = size(A,1)
@@ -18,7 +18,9 @@ function ar(y, na; λ = 0, doplot=false, bias=false)
     end
     return w, error
 end
+ar(iddata, na; λ = 0, doplot=false, bias=false) = ar(iddata.y, na; λ = 0, doplot=doplot, bias=bias)
 
+"""arx(y, u, na, nb; λ = 0, doplot=false, bias=false)"""
 function arx(y, u, na, nb; λ = 0, doplot=false, bias=false)
     y_train, A = getARXRegressor(y,u, na, nb; bias=bias)
     n_points = size(A,1)
@@ -38,6 +40,8 @@ function arx(y, u, na, nb; λ = 0, doplot=false, bias=false)
     end
     return w, error
 end
+arx(iddata, na, nb; λ = 0, doplot=false, bias=false) = arx(iddata.y, iddata.u, na, nb; λ = 0, doplot=doplot, bias=bias)
+
 
 
 function getARRegressor(y,na;bias=false)
@@ -50,6 +54,7 @@ function getARRegressor(y,na;bias=false)
     end
     return y,A
 end
+getARRegressor(iddata, na, bias=false) = getARXRegressor(iddatay, na, bias=bias)
 
 function getARXRegressor(y,u, na, nb; bias=false)
     assert(length(nb) == size(u,2))
@@ -70,6 +75,7 @@ function getARXRegressor(y,u, na, nb; bias=false)
     end
     return y,A
 end
+getARXRegressor(iddata, na, nb; bias=false) = getARXRegressor(iddatay,iddata.u, na, nb, bias=bias)
 
 
 """Plots the RMSE and AIC for model orders up to `n`. Useful for model selection"""
-- 
GitLab