summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSuraj Yerramilli2016-02-16 16:47:30 +0530
committerSuraj Yerramilli2016-02-16 16:47:30 +0530
commit2b17bae5c6d440c8c6217710feef3f9adc88dd82 (patch)
tree13c6cb1af10bd69b14a2c41743d630fc8c0e19a7
parent02b430c61fc21692f46db27c2cba298910f15749 (diff)
downloadSysID-R-code-2b17bae5c6d440c8c6217710feef3f9adc88dd82.tar.gz
SysID-R-code-2b17bae5c6d440c8c6217710feef3f9adc88dd82.tar.bz2
SysID-R-code-2b17bae5c6d440c8c6217710feef3f9adc88dd82.zip
added documentation for Box-Jenkins models
-rw-r--r--R/estpoly.R56
-rw-r--r--man/bj.Rd68
2 files changed, 124 insertions, 0 deletions
diff --git a/R/estpoly.R b/R/estpoly.R
index 7967cc2..96add69 100644
--- a/R/estpoly.R
+++ b/R/estpoly.R
@@ -368,6 +368,62 @@ oe <- function(x,order=c(1,1,0),options=optimOptions()){
options = options,termination = l$termination)
}
+#' Estimate Box-Jenkins Models
+#'
+#' Fit a box-jenkins model of the specified order from input-output data
+#'
+#' @param z an \code{idframe} object containing the data
+#' @param order Specification of the orders: the five integer components
+#' (nb,nc,nd,nf,nk) are order of polynomial B + 1, order of the polynomial C,
+#' order of the polynomial D, order of the polynomial F, and the
+#' input-output delay respectively
+#' @param options Estimation Options, setup using
+#' \code{\link{optimOptions}}
+#'
+#' @details
+#' SISO BJ models are of the form
+#' \deqn{
+#' y[k] + f_1 y[k-1] + \ldots + f_{nf} y[k-nf] = b_{nk} u[k-nk] +
+#' \ldots + b_{nk+nb} u[k-nk-nb] + f_{1} e[k-1] + \ldots f_{nf} e[k-nf]
+#' + e[k]
+#' }
+#' The function estimates the coefficients using non-linear least squares
+#' (Levenberg-Marquardt Algorithm)
+#' \\
+#' The data is expected to have no offsets or trends. They can be removed
+#' using the \code{\link{detrend}} function.
+#'
+#' @return
+#' An object of class \code{estpoly} containing the following elements:
+#' \item{sys}{an \code{idpoly} object containing the
+#' fitted BJ coefficients}
+#' \item{fitted.values}{the predicted response}
+#' \item{residuals}{the residuals}
+#' \item{input}{the input data used}
+#' \item{call}{the matched call}
+#' \item{stats}{A list containing the following fields: \cr
+#' \code{vcov} - the covariance matrix of the fitted coefficients \cr
+#' \code{sigma} - the standard deviation of the innovations}
+#' \item{options}{Option set used for estimation. If no
+#' custom options were configured, this is a set of default options}
+#' \item{termination}{Termination conditions for the iterative
+#' search used for prediction error minimization:
+#' \code{WhyStop} - Reason for termination \cr
+#' \code{iter} - Number of Iterations \cr
+#' \code{iter} - Number of Function Evaluations }
+#'
+#' @references
+#' Arun K. Tangirala (2015), \emph{Principles of System Identification:
+#' Theory and Practice}, CRC Press, Boca Raton. Sections 14.4.1, 17.5.2,
+#' 21.6.3
+#'
+#' @examples
+#' data(bjsim)
+#' z <- dataSlice(data,end=1500) # training set
+#' mod_bj <- bj(z,c(2,1,1,1,2))
+#' mod_bj
+#' residplot(mod_bj) # residual plots
+#'
#' @export
bj <- function(z,order=c(1,1,1,1,0),init_sys=NULL,
options=optimOptions()){
diff --git a/man/bj.Rd b/man/bj.Rd
new file mode 100644
index 0000000..24ec162
--- /dev/null
+++ b/man/bj.Rd
@@ -0,0 +1,68 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/estpoly.R
+\name{bj}
+\alias{bj}
+\title{Estimate Box-Jenkins Models}
+\usage{
+bj(z, order = c(1, 1, 1, 1, 0), init_sys = NULL, options = optimOptions())
+}
+\arguments{
+\item{z}{an \code{idframe} object containing the data}
+
+\item{order}{Specification of the orders: the five integer components
+(nb,nc,nd,nf,nk) are order of polynomial B + 1, order of the polynomial C,
+order of the polynomial D, order of the polynomial F, and the
+input-output delay respectively}
+
+\item{options}{Estimation Options, setup using
+\code{\link{optimOptions}}}
+}
+\value{
+An object of class \code{estpoly} containing the following elements:
+ \item{sys}{an \code{idpoly} object containing the
+ fitted BJ coefficients}
+ \item{fitted.values}{the predicted response}
+ \item{residuals}{the residuals}
+ \item{input}{the input data used}
+ \item{call}{the matched call}
+ \item{stats}{A list containing the following fields: \cr
+ \code{vcov} - the covariance matrix of the fitted coefficients \cr
+ \code{sigma} - the standard deviation of the innovations}
+ \item{options}{Option set used for estimation. If no
+ custom options were configured, this is a set of default options}
+ \item{termination}{Termination conditions for the iterative
+ search used for prediction error minimization:
+ \code{WhyStop} - Reason for termination \cr
+ \code{iter} - Number of Iterations \cr
+ \code{iter} - Number of Function Evaluations }
+}
+\description{
+Fit a box-jenkins model of the specified order from input-output data
+}
+\details{
+SISO BJ models are of the form
+\deqn{
+ y[k] + f_1 y[k-1] + \ldots + f_{nf} y[k-nf] = b_{nk} u[k-nk] +
+ \ldots + b_{nk+nb} u[k-nk-nb] + f_{1} e[k-1] + \ldots f_{nf} e[k-nf]
+ + e[k]
+}
+The function estimates the coefficients using non-linear least squares
+(Levenberg-Marquardt Algorithm)
+\\
+The data is expected to have no offsets or trends. They can be removed
+using the \code{\link{detrend}} function.
+}
+\examples{
+data(bjsim)
+z <- dataSlice(data,end=1500) # training set
+mod_bj <- bj(z,c(2,1,1,1,2))
+mod_bj
+residplot(mod_bj) # residual plots
+
+}
+\references{
+Arun K. Tangirala (2015), \emph{Principles of System Identification:
+Theory and Practice}, CRC Press, Boca Raton. Sections 14.4.1, 17.5.2,
+21.6.3
+}
+