[Robkalman-commits] r31 - pkg/robKalman/man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Jun 10 12:45:14 CEST 2009


Author: ruckdeschel
Date: 2009-06-10 12:45:12 +0200 (Wed, 10 Jun 2009)
New Revision: 31

Added:
   pkg/robKalman/man/0robKalman-package.Rd
   pkg/robKalman/man/ACMfilt.Rd
   pkg/robKalman/man/arGM.Rd
   pkg/robKalman/man/calibrateRLS.Rd
   pkg/robKalman/man/internalACM.Rd
   pkg/robKalman/man/internalKalman.Rd
   pkg/robKalman/man/internalarGM.Rd
   pkg/robKalman/man/internalpsi.Rd
   pkg/robKalman/man/internalrLS.Rd
   pkg/robKalman/man/recFilter.Rd
   pkg/robKalman/man/simulateSScont.Rd
   pkg/robKalman/man/util.Rd
Log:
somehow I had missed the Rd files when arranging intermediate robKalman folder... 

Added: pkg/robKalman/man/0robKalman-package.Rd
===================================================================
--- pkg/robKalman/man/0robKalman-package.Rd	                        (rev 0)
+++ pkg/robKalman/man/0robKalman-package.Rd	2009-06-10 10:45:12 UTC (rev 31)
@@ -0,0 +1,114 @@
+\name{robKalman-package}
+\alias{robKalman-package}
+\alias{robKalman}
+\docType{package}
+\title{
+robKalman -- routines for robust Kalman filtering
+}
+\description{
+\pkg{robKalman } provides routines for robust Kalman filtering. 
+Currently, the ACM-filter and the rLS-Filter are provided.
+}
+\details{
+\tabular{ll}{
+Package: \tab robKalman\cr
+Version: \tab 0.2.1 \cr
+Date: \tab 2009-03-18 \cr
+Depends: \tab R(>= 2.3.0), methods, graphics, startupmsg, dse1, dse2, MASS\cr 
+Imports: \tab stats\cr
+LazyLoad: \tab yes\cr
+License: \tab LGPL-3\cr
+URL: \tab http://distr.r-forge.r-project.org/\cr
+}}
+
+\section{Setup}{
+We work in the setup of the time-invariant, linear, Gaussian state space model (ti-l-G-SSM)
+with \eqn{p} dimensional states \eqn{x_t} and \eqn{q} dimensional observations \eqn{y_t},
+with \strong{initial condition}
+\deqn{x_0 \sim {\cal N}_p(a,S),}{x_0 ~ N_p(a,S),}
+
+\strong{state equation}
+\deqn{x_t = F x_{t-1} +  v_t, \qquad v_t \sim {\cal N}_p(0,Q),\qquad t\ge 1,}{x_t = F x_{t-1} +  v_t,          v_t ~ N_p(0,Q),  t>=1,}
+
+\strong{observation equation}
+\deqn{y_t = Z x_{t}   +  \varepsilon_t, \qquad \varepsilon_t \sim {\cal N}_q(0,V),\qquad t\ge 1,}{y_t = Z x_t   +  e_t,      e_t ~ N_q(0,V),  t>=1,}
+and where all random variable \eqn{x_0}, \eqn{v_t}, \eqn{\varepsilon_t}{e_t} are independent.
+}
+
+\section{Classes}{
+yet to be filled}
+
+\section{Methods}{
+yet to be filled}
+\section{Functions}{
+\preformatted{
+
+general recursive filters
++recursiveFilter
+ -KalmanFilter 
+ -rLSFilter
+ -ACMfilter
+
+ACMfilter:
++ACMfilt
+
+GM-estimators for AR models
++arGM
+
+utilities:
++Euclidnorm,  
++rcvmvnorm,      
++Huberize,       
++limitS
+
+simulation of AO contaminated state space models       
++simulateState,
++simulateObs,
+}}
+
+\section{Acknowledgement}{
+We thank Paul Gilbert for their help
+in preparing this package.}
+
+\author{
+Peter Ruckdeschel (Maintainer) \email{Peter.Ruckdeschel at itwm.fraunhofer.de},\cr 
+Bernhard Spangl \email{bernhard.spangl at boku.ac.at},\cr 
+}
+
+\references{
+Martin, R.D. and Zeh, J.E. (1978): Generalized M-estimates for  Autoregression Including Small-sample Efficiency Robustness \cr
+Martin, R.D. (1979): Approximate Conditional-mean Type Smoothers and Interpolators.\cr
+Martin, R.D. (1980): Robust Estimation of Autoregressive Models.  \cr
+Martin, R.D. (1981): Robust Methods for Time Series\cr
+Martin, R.D. and Thomson, D.J. (1982): Robust-resistent Spectrum Estimation. \cr
+Ruckdeschel, P. (2001) \emph{Ans\"atze zur Robustifizierung des
+Kalman Filters.} Bayreuther Mathematische Schriften, Vol. 64. \cr
+Spangl, B. (2008): On Robust Spectral Density
+Estimation. PhD Thesis at Technical University, Vienna. \cr
+Stockinger, N. and Dutter, R. (1987): Robust Time Series Analysis: A Survey.  \cr
+}
+
+\section{Start-up-Banner}{
+You may suppress the start-up banner/message completely by setting \code{options("StartupBanner"="off")}
+somewhere before loading this package by \code{library} or \code{require} in your R-code / R-session.
+
+If option \code{"StartupBanner"} is not defined (default) or setting    
+\code{options("StartupBanner"=NULL)} or  \code{options("StartupBanner"="complete")} 
+the complete start-up banner is displayed.
+
+For any other value of option \code{"StartupBanner"} (i.e., not in \code{c(NULL,"off","complete")})
+only the version information is displayed.
+
+The same can be achieved by wrapping the \code{library} or \code{require}  call into
+either \code{suppressStartupMessages()} or \code{onlytypeStartupMessages(.,atypes="version")}. 
+
+As for general \code{packageStartupMessage}'s, you may also suppress all
+ the start-up banner by wrapping the \code{library} or \code{require} 
+ call into \code{suppressPackageStartupMessages()} from 
+ \pkg{startupmsg}-version 0.5 on.
+ }
+
+\section{Demos}{
+Demos are available --- see \code{demo(package="robKalman")}}
+\keyword{robust}
+\keyword{ts}

Added: pkg/robKalman/man/ACMfilt.Rd
===================================================================
--- pkg/robKalman/man/ACMfilt.Rd	                        (rev 0)
+++ pkg/robKalman/man/ACMfilt.Rd	2009-06-10 10:45:12 UTC (rev 31)
@@ -0,0 +1,78 @@
+\name{ACMfilt}
+\alias{ACMfilt}
+
+\title{ACM filter - S-Plus type arguments}
+
+\description{
+This function realizes the ACM filter with a S-Plus type signature.
+}
+
+\usage{
+ACMfilt(x, gm, s0=0, psi="Hampel", a=2.5, b=a, c=5.0, flag="weights", lagsmo=TRUE)
+}
+
+\arguments{
+\item{x}{univarite time series (vector)}
+\item{gm}{list as produced by function \code{arGM}, with elements
+           \code{ar} containing the AR(p) coefficient estimates, \code{sinnov} containing 
+           innovation scale estiamtes from AR(p) fits of orders 1 through p;
+           \code{Cx} containing an estimate of the p by p autocovariance matrix, and       
+           \code{mu}, the estimated mean of \code{x}} 
+  \item{s0}{scale of nominal Gaussian component of additive noise}
+  \item{psi}{influence function to be used (default: Hampel's \eqn{\psi} function, which is the only one available at the moment)}
+  \item{a,b,c}{tuning constants for Hampel's \eqn{\psi}-function}
+  \item{flag}{character, if "weights", use \eqn{\psi(t)/t} to calculate the weights; if "deriv", use \eqn{\psi'(t)}}
+  \item{lagsmo}{logical, if \code{TRUE}, lag p-1 smoothing is performed; else filtering from the top of \eqn{\hat X_t} is performed}
+}
+
+\details{
+to be filled}
+
+
+\value{a list with elements 
+\item{filt.ck}{the classical Kalman filter}
+\item{filt}{the ACM filter}
+\item{st}{time-dependent scale parameter estimate}
+\item{r}{AR-residuals}
+}    
+
+
+\author{
+Bernhard Spangl \email{bernhard.spangl at boku.ac.at},\cr 
+  }
+
+
+\seealso{
+\code{\link{internalarGM}}, \code{\link{internalpsi}}, \code{\link{internalACM}},
+\code{\link{arGM}}, \code{\link{recFilter}}
+}
+
+\examples{
+require(robKalman)
+
+##  AO model:
+set.seed(361)
+Eps <- as.ts(rnorm(100))
+ar2 <- arima.sim(list(ar = c(1, -0.9)), 100, innov = Eps)
+Binom <- rbinom(100, 1, 0.1)
+Noise <- rnorm(100,sd = 10)
+y <- ar2 + as.ts(Binom*Noise)
+
+y.arGM <- arGM(y, 3)
+y.ACMfilt <- ACMfilt(y, y.arGM)
+
+plot(y)
+lines(y.ACMfilt$filt, col=2)
+lines(ar2,col="green")
+
+}
+
+\references{
+Martin, R.D. and Zeh, J.E. (1978): Generalized M-estimates for  Autoregression Including Small-sample Efficiency Robustness \cr 
+Martin, R.D. (1980): Robust Estimation of Autoregressive Models.\cr 
+Martin, R.D. and Thomson, D.J. (1982): Robust-resistent Spectrum Estimation. \cr 
+Stockinger, N. and Dutter, R. (1987): Robust Time Series Analysis: A Survey.\cr 
+}
+
+\keyword{robust}
+\keyword{ts}

Added: pkg/robKalman/man/arGM.Rd
===================================================================
--- pkg/robKalman/man/arGM.Rd	                        (rev 0)
+++ pkg/robKalman/man/arGM.Rd	2009-06-10 10:45:12 UTC (rev 31)
@@ -0,0 +1,71 @@
+\name{arGM}
+\alias{arGM}
+
+\title{GM-estimates for AR parameters}
+
+\description{
+This function realizes Martin's GM-estimates for AR parameters.
+}
+
+\usage{
+arGM(x, order=1, chr=1.5, iterh=maxiter, cbr=5.0, iterb=maxiter, 
+     psi2="Tukey", c=4.0, type="Mallows", k=1.5, maxiter=100, 
+     tol=1e-08, equal.LS=FALSE, ...) 
+}
+
+\arguments{
+\item{x}{univarite time series (vector)}
+\item{order}{order of AR(p) process}
+\item{chr}{tuning constant for Huber's \eqn{\psi} function}
+\item{iterh}{number of iterations for IWLS-alogrithm using  Huber's \eqn{\psi} function}
+\item{cbr}{tuning constant for Tukey's \eqn{\psi} function}
+\item{iterb}{number of iterations for IWLS-alogrithm using Tukey's \eqn{\psi} function}
+\item{psi2}{influence function to determine the 'size of \eqn{z_i}',  either "Ident", "Huber" or "Tukey"}
+\item{c}{tuning constant for psi2}
+\item{type}{type of GM-estimates, either "Mallows" or "Schweppe"}
+\item{k}{tuning constant for centering}
+\item{maxiter}{maximal number of iteration}
+\item{tol}{tolerance level}
+\item{equal.LS}{logical, for testing purpose only}
+\item{...}{further parameters to be passed to the functions \code{HuberM} or \code{hubers}}  
+}
+
+\details{
+to be filled}
+           
+\value{a list with elements
+\item{ar}{parameter estimate}
+\item{sinnov}{scale estimate for the innovations from AR(p) fits of orders 1 through p}
+\item{Cx}{an estimate of the \eqn{p \times p}{p x p} autocovariance matrix}
+\item{mu}{ location estimate of \code{x}}
+\item{sx}{Huber scale estimate}
+\item{u,v}{weights for  Mallows- or Schweppe-type GM-estimates}
+\item{w}{weights from IWLS algorithm}
+\item{BH}{consistency constant for \eqn{\sigma} when using Huber's \eqn{\psi} function}
+\item{BB}{consistency constant for \eqn{\sigma} when using Tukey's \eqn{\psi} function}
+\item{niterh}{number of iterations for IWLS-alogrithm using  Huber's \eqn{\psi} function}
+\item{niterb}{number of iterations for IWLS-alogrithm using  Tukey's \eqn{\psi} function}
+\item{niter.testing}{for testing purposes only}   
+}
+
+\author{
+Bernhard Spangl \email{bernhard.spangl at boku.ac.at},\cr 
+  }
+
+
+\seealso{
+\code{\link{internalarGM}}, \code{\link{internalpsi}}
+}
+
+\examples{
+}
+
+\references{
+Martin, R.D. and Zeh, J.E. (1978): Generalized M-estimates for  Autoregression Including Small-sample Efficiency Robustness \cr
+Martin, R.D. (1980): Robust Estimation of Autoregressive Models.  \cr
+Martin, R.D. and Thomson, D.J. (1982): Robust-resistent Spectrum Estimation.  \cr
+Stockinger, N. and Dutter, R. (1987): Robust Time Series Analysis: A Survey.  \cr
+}
+
+\keyword{robust}
+\keyword{ts}

Added: pkg/robKalman/man/calibrateRLS.Rd
===================================================================
--- pkg/robKalman/man/calibrateRLS.Rd	                        (rev 0)
+++ pkg/robKalman/man/calibrateRLS.Rd	2009-06-10 10:45:12 UTC (rev 31)
@@ -0,0 +1,71 @@
+\name{calibrateRLS}
+\alias{rLScalibrateB}
+\alias{calibrateRLS}
+\title{Calibration of clipping height b}
+
+\description{
+calibrates the clipping height \code{b} of the rLS-filter in a time-invariant, linear, Gaussian state space model
+}
+\usage{
+rLScalibrateB(Z, S, V, repl = 100000, eff, r, upto=20)
+}
+\arguments{
+  \item{Z}{observation matrix in the (ti-l-G-SSM); see below}
+  \item{S}{prediction error covariance matrix (of the classical Kalman filter) in the (ti-l-G-SSM); see below}
+  \item{V}{observation error covariance matrix in the (ti-l-G-SSM); see below}
+  \item{r}{SO-contamination radius}
+  \item{eff}{efficiency w.r.t. classical Kalman filter in the ideal model}
+  \item{repl}{number of replicates used for a LLN-approximation of the expectations needed in this calibration}
+  \item{upto}{an upper bound to \code{b} used in the zero-search of \code{uniroot} within \code{rLScalibrateB}}
+}
+\details{
+We work in the setup of the time-invariant, linear, Gaussian state space model (ti-l-G-SSM)
+with \eqn{p} dimensional states \eqn{x_t} and \eqn{q} dimensional observations \eqn{y_t},
+with \strong{initial condition}
+\deqn{x_0 \sim {\cal N}_p(a,S),}{x_0 ~ N_p(a,S),}
+
+\strong{state equation}
+\deqn{x_t = F x_{t-1} +  v_t, \qquad v_t \sim {\cal N}_p(0,Q),\qquad t\ge 1,}{x_t = F x_{t-1} +  v_t,          v_t ~ N_p(0,Q),  t>=1,}
+
+\strong{observation equation}
+\deqn{y_t = Z x_{t}   +  \varepsilon_t, \qquad \varepsilon_t \sim {\cal N}_q(0,V),\qquad t\ge 1,}{y_t = Z x_t   +  e_t,      e_t ~ N_q(0,V),  t>=1,}
+and where all random variable \eqn{x_0}, \eqn{v_t}, \eqn{\varepsilon_t}{e_t} are independent.
+
+The clipping height \code{b} given \eqn{Z}, \eqn{V}, and prediction error covariance \eqn{S_{t|t-1}} 
+(of the classical Kalman filter) is either calibrated to a given efficiency \code{eff} in the ideal model or to given 
+(SO)-radius \code{r} about the ideal model. 
+
+The expectations needed for this calibration are calculated by a LLN 
+approximation with \code{repl} replicates;
+}
+
+\value{a clipping height \code{b} for the rLS filter}
+\author{
+  Peter Ruckdeschel \email{Peter.Ruckdeschel at itwm.fraunhofer.de},\cr 
+  }
+
+
+\examples{
+require(robKalman)
+
+##Hyper parameter of a lin. time-inv. Gaussian SSM
+SS0  <- matrix(0, 2, 2)
+F0   <- matrix(c(.7, 0.5, 0.2, 0), 2, 2)
+Q0   <- matrix(c(2, 0.5, 0.5, 1), 2, 2)
+Z0   <- matrix(c(1, -0.5), 1, 2)
+V0i  <- 1
+
+### limiting prediction error covariance
+SS <- limitS(S = SS0, F = F0, Q = Q0, Z = Z0, V = V0i)
+
+### calibration b
+# by efficiency in the ideal model
+# efficiency  =  0.9
+(B1 <- rLScalibrateB(eff = 0.9, S = SS, Z = Z0, V = V0i))
+# by contamination radius
+# r  =  0.1
+(B2 <- rLScalibrateB(r = 0.1, S = SS, Z = Z0, V = V0i))
+}
+
+\keyword{robust}
+\keyword{ts}

Added: pkg/robKalman/man/internalACM.Rd
===================================================================
--- pkg/robKalman/man/internalACM.Rd	                        (rev 0)
+++ pkg/robKalman/man/internalACM.Rd	2009-06-10 10:45:12 UTC (rev 31)
@@ -0,0 +1,104 @@
+\name{internalACM}
+\alias{internalACM}
+\alias{.getcorrCovACM}
+\alias{.ACMinitstep}
+\alias{.ACMpredstep}
+\alias{.ACMcorrstep}
+
+\title{Internal functions of package robKalman for the ACM filter}
+
+\description{
+These functions are used internally by package robKalman for the ACM filter
+}
+
+\usage{
+.getcorrCovACM(S1, K,  Z, W=diag(nrow(Z)))
+.ACMinitstep(a, S, ...) 
+.ACMpredstep(x0, S0, F, Q, rob0, s0, ...) 
+.ACMcorrstep(y, x1, S1, Z, V, rob1, dum, psi, apsi, bpsi, cpsi, flag, ...) 
+}
+
+
+\arguments{
+  \item{a}{mean of the initial state}
+  \item{S}{initial state covariance (see below)}
+  \item{Z}{observation matrix (see below)}
+  \item{V}{observation error covariance (see below)}
+  \item{F}{innovation transition matrix (see below)}
+  \item{Q}{innovation covariance (see below)}
+  \item{K}{Kalman gain \eqn{K_t}}
+  \item{W}{weight matrix}
+  \item{dum}{dummy variable for compatibility with \dots argument of calling function}
+  \item{s0}{scale of nominal Gaussian component of additive noise}
+  \item{S1}{prediction error covariance \eqn{S_{t|t-1}} of the ACM filter}
+  \item{S0}{filter error covariance \eqn{S_{t-1|t-1}} of the ACM filter}
+  \item{rob0}{not used here; included for compatibility reasons; set to \code{NULL}}
+  \item{rob1}{used to pass on information recursively; here: \code{st} time-dependent scale parameter}
+  \item{psi}{influence function to be used (default: Hampel's \eqn{\psi} function, which is the only one available at the moment)}
+  \item{a,b,c}{tuning constants for Hampel's \eqn{\psi}-function, (default: \code{a=b=2.5}, \code{c=5.0})}
+  \item{flag}{character, if "weights" (default), use \eqn{\psi(t)/t} to calculate the weights; if "deriv", use \eqn{\psi'(t)}}
+  \item{y}{observation \code{y_t}}
+  \item{x0}{(ACM)- filtered state \eqn{x_{t-1|t-1}}}
+  \item{x1}{(ACM)- predicted state \eqn{x_{t|t-1}}}
+  \item{...}{not used here; for compatibility with signatures of other "step"-functions}
+}
+
+\details{
+
+We work in the setup of the time-invariant, linear, Gaussian state space model (ti-l-G-SSM)
+with \eqn{p} dimensional states \eqn{x_t} and \eqn{q} dimensional observations \eqn{y_t},
+with \strong{initial condition}
+\deqn{x_0 \sim {\cal N}_p(a,S),}{x_0 ~ N_p(a,S),}
+
+\strong{state equation}
+\deqn{x_t = F x_{t-1} +  v_t, \qquad v_t \sim {\cal N}_p(0,Q),\qquad t\ge 1,}{x_t = F x_{t-1} +  v_t,          v_t ~ N_p(0,Q),  t>=1,}
+
+\strong{observation equation}
+\deqn{y_t = Z x_{t}   +  \varepsilon_t, \qquad \varepsilon_t \sim {\cal N}_q(0,V),\qquad t\ge 1,}{y_t = Z x_t   +  e_t,      e_t ~ N_q(0,V),  t>=1,}
+and where all random variable \eqn{x_0}, \eqn{v_t}, \eqn{\varepsilon_t}{e_t} are independent.
+
+For notation, let us formulate the classical Kalman filter in this context:
+
+\strong{(0) ininitial step}          \deqn{x_{0|0}   = a} 
+\eqn{\qquad}{\code{      }} with error covariance      
+\deqn{S_{0|0}   = {\rm Cov}(x_0-x_{0|0})   = \code{S}}{S_{0|0}   = Cov(x_0-x_{0|0})   = S}%
+
+\strong{(1) prediction step}       
+\deqn{x_{t|t-1} = F x_{t-1|t-1},\qquad t\ge 1}{x_{t|t-1} = F x_{t-1|t-1},         t>=1}
+\eqn{\qquad}{\code{      }} with error covariance      
+\deqn{S_{t|t-1} = {\rm Cov}(x_t-x_{t|t-1}) = F S_{t-1|t-1} F' + Q}{S_{t|t-1} = Cov(x_t-x_{t|t-1}) = F S_{t-1|t-1} F' + Q} 
+
+\strong{(2) correction step}       
+\deqn{x_{t|t}   = x_{t|t-1} + K_t (y_t - Z x_{t|t-1}),\qquad        t\ge 1}{x_{t|t}   = x_{t|t-1} + K_t (y_t - Z x_{t|t-1}),        t>=1}
+\eqn{\qquad}{\code{      }} for Kalman Gain   
+\deqn{K_t = S_{t|t-1} Z' (Z S_{t|t-1} Z' + V )^-}
+\eqn{\qquad}{\code{      }} with error covariance 
+\deqn{S_{t|t}   = {\rm Cov}(x_t-x_{t|t}) = S_{t|t-1} - K_t Z S_{t|t-1}}{S_{t|t}   = Cov(x_t-x_{t|t}) = S_{t|t-1} - K_t Z S_{t|t-1}}
+FURTHER DETAILS TO BE FILLED
+}
+
+
+\value{
+\code{.getcorrCovACM} determines filter error covariance \eqn{S_{t-1|t-1}} of the ACM filter. \cr
+\code{.ACMinitstep}  calculates \eqn{x_{0|0}}.  \cr
+\code{.ACMpredstep}  calculates the ACM-\eqn{x_{t|t-1}}.  \cr
+\code{.ACMcorrstep}  calculates the ACM-\eqn{x_{t|t}}.  \cr
+}
+
+
+\author{
+  Peter Ruckdeschel \email{Peter.Ruckdeschel at itwm.fraunhofer.de},\cr 
+  Bernhard Spangl \email{bernhard.spangl at boku.ac.at},\cr 
+}
+
+\seealso{
+\code{\link{internalKalman}}, \code{\link{internalrLS}}, \code{\link{recFilter}}
+}
+
+\references{
+Martin, R.D. (1979): Approximate Conditional-mean Type Smoothers and Interpolators.\cr
+Martin, R.D. (1981): Robust Methods for Time Series. \cr
+Martin, R.D. and Thomson, D.J. (1982): Robust-resistent Spectrum Estimation. \cr
+}
+
+\keyword{internal}

Added: pkg/robKalman/man/internalKalman.Rd
===================================================================
--- pkg/robKalman/man/internalKalman.Rd	                        (rev 0)
+++ pkg/robKalman/man/internalKalman.Rd	2009-06-10 10:45:12 UTC (rev 31)
@@ -0,0 +1,95 @@
+\name{internalKalman}
+\alias{internalKalman}
+\alias{.getKG}
+\alias{.getcorrCov}
+\alias{.getpredCov}
+\alias{.cKpredstep}
+\alias{.cKScorrstep}
+
+\title{Internal functions of package robKalman for the classical Kalman filter}
+
+\description{
+These functions are used internally by package robKalman
+}
+\usage{
+.getKG(S1, Z, V)
+.getcorrCov(S1, K, Z)
+.getpredCov(S0, F, Q)
+.cKinitstep(a, S, ...) 
+.cKpredstep(x0, S0, F, Q, ...) 
+.cKcorrstep(y, x1, S1, Z, V, ...) 
+}
+
+\arguments{
+  \item{a}{mean of the initial state}
+  \item{S}{initial state covariance (see below)}
+  \item{Z}{observation matrix (see below)}
+  \item{V}{observation error covariance (see below)}
+  \item{F}{innovation transition matrix (see below)}
+  \item{Q}{innovation covariance (see below)}
+  \item{K}{Kalman gain \eqn{K_t}}
+  \item{S1}{prediction error covariance \eqn{S_{t|t-1}} of the classical Kalman filter}
+  \item{S0}{filter error covariance \eqn{S_{t-1|t-1}} of the classical Kalman filter}
+  \item{y}{observation \eqn{y_t}}
+  \item{x0}{(classical Kalman)- filtered state \eqn{x_{t-1|t-1}}}
+  \item{x1}{(classical Kalman)- predicted state \eqn{x_{t|t-1}}}
+  \item{...}{not used here; for compatibility with signatures of other "step"-functions}
+}
+
+\details{
+We work in the setup of the time-invariant, linear, Gaussian state space model (ti-l-G-SSM)
+with \eqn{p} dimensional states \eqn{x_t} and \eqn{q} dimensional observations \eqn{y_t},
+with \strong{initial condition}
+\deqn{x_0 \sim {\cal N}_p(a,S),}{x_0 ~ N_p(a,S),}
+
+\strong{state equation}
+\deqn{x_t = F x_{t-1} +  v_t, \qquad v_t \sim {\cal N}_p(0,Q),\qquad t\ge 1,}{x_t = F x_{t-1} +  v_t,          v_t ~ N_p(0,Q),  t>=1,}
+
+\strong{observation equation}
+\deqn{y_t = Z x_{t}   +  \varepsilon_t, \qquad \varepsilon_t \sim {\cal N}_q(0,V),\qquad t\ge 1,}{y_t = Z x_t   +  e_t,      e_t ~ N_q(0,V),  t>=1,}
+and where all random variable \eqn{x_0}, \eqn{v_t}, \eqn{\varepsilon_t}{e_t} are independent.
+
+For notation, let us formulate the classical Kalman filter in this context:
+
+\strong{(0) ininitial step}          \deqn{x_{0|0}   = a} 
+\eqn{\qquad}{\code{      }} with error covariance      
+\deqn{S_{0|0}   = {\rm Cov}(x_0-x_{0|0})   = \code{S}}{S_{0|0}   = Cov(x_0-x_{0|0})   = S}%
+
+\strong{(1) prediction step}       
+\deqn{x_{t|t-1} = F x_{t-1|t-1},\qquad t\ge 1}{x_{t|t-1} = F x_{t-1|t-1},         t>=1}
+\eqn{\qquad}{\code{      }} with error covariance      
+\deqn{S_{t|t-1} = {\rm Cov}(x_t-x_{t|t-1}) = F S_{t-1|t-1} F' + Q}{S_{t|t-1} = Cov(x_t-x_{t|t-1}) = F S_{t-1|t-1} F' + Q} 
+
+\strong{(2) correction step}       
+\deqn{x_{t|t}   = x_{t|t-1} + K_t (y_t - Z x_{t|t-1}),\qquad        t\ge 1}{x_{t|t}   = x_{t|t-1} + K_t (y_t - Z x_{t|t-1}),        t>=1}
+\eqn{\qquad}{\code{      }} for Kalman Gain   
+\deqn{K_t = S_{t|t-1} Z' (Z S_{t|t-1} Z' + V )^-}
+\eqn{\qquad}{\code{      }} with error covariance 
+\deqn{S_{t|t}   = {\rm Cov}(x_t-x_{t|t}) = S_{t|t-1} - K_t Z S_{t|t-1}}{S_{t|t}   = Cov(x_t-x_{t|t}) = S_{t|t-1} - K_t Z S_{t|t-1}}
+}
+
+
+\value{
+\code{.getKG} calculates the Kalman Gain for \code{S1 =}\eqn{S_{t|t-1}}, \code{Z}, \code{V} as above \cr
+\code{.getcorrCov}  calculates \eqn{S_{t|t}} for \code{S1 =} \eqn{S_{t|t-1}}, \code{K =}\eqn{K_t} and \code{Z} as above \cr
+\code{.getpredCov} calculates \eqn{S_{t|t-1}} for \code{S0 =} \eqn{S_{t-1|t-1}}, \code{F}, and \code{Q} as above\cr
+\code{.cKinitstep}  calculates \eqn{x_{0|0}} for \code{a}, \code{S} as above\cr
+
+\code{.cKpredstep}  calculates \eqn{x_{t|t-1}} for \code{x0 =}\eqn{x_{t-1|t-1}}, \code{S0 =}\eqn{S_{t-1|t-1}}, and \code{F}, \code{Q}\cr
+
+\code{.cKcorrstep}  calculates \eqn{x_{t|t}} for \code{x1 =}\eqn{x_{t|t-1}}, \code{y =}\eqn{y_{t}}, 
+\code{S1 =}\eqn{S_{t|t-1}}, and \code{Z}, \code{V} \cr
+
+}
+
+\author{
+  Peter Ruckdeschel \email{Peter.Ruckdeschel at itwm.fraunhofer.de},\cr 
+  }
+
+
+\seealso{
+\code{\link{internalrLS}}
+}
+
+
+\keyword{internal}

Added: pkg/robKalman/man/internalarGM.Rd
===================================================================
--- pkg/robKalman/man/internalarGM.Rd	                        (rev 0)
+++ pkg/robKalman/man/internalarGM.Rd	2009-06-10 10:45:12 UTC (rev 31)
@@ -0,0 +1,77 @@
+\name{internalarGM}
+\alias{internalarGM}
+\alias{.ARmodel}
+\alias{.invCp}
+\alias{.Weights}
+\alias{.startval}
+\alias{.BH}
+\alias{.BB}
+\alias{.weights}
+\alias{.IWLS}
+
+\title{Internal functions of package robKalman --- psi functions}
+
+\description{
+These functions are used internally by package robKalman for the ACM filter --- \eqn{\psi}-functions
+}
+
+\usage{
+.ARmodel(x, p)
+.invCp(p, s, Phi)
+.Weights(p, Z, invCp, type, psi2, c)
+.startval(y, Z, tol)
+.BH(k=1.345) 
+.BB(c=4.685)
+.weights(r, s, u, v, psi1, ...)
+.IWLS(y, Z, phi.ini, s.ini, u, v, psi1, niter, tol, ...)
+}
+
+\arguments{
+  \item{x}{univarite time series (vector)}
+  \item{p}{order of AR(p) process}
+  \item{s}{vector of \code{sx} and innovation scale estimates for AR(p-1) models of order \eqn{1} to \eqn{(p-1)}}
+  \item{Phi}{\eqn{(p-1)\times(p-1)}{(p-1)x(p-1)} matrix of AR(p-1) model parameters}
+  \item{Z}{AR(p) model matrix} 
+  \item{invCp}{matrix from function \code{.invCp} to compute metric}
+  \item{type}{type of GM-estimates --- character: currently:  "Mallows" or "Schweppe"}
+  \item{psi1, psi2}{type of \eqn{\psi} function; current possibilities: "Huber", "Tukey", "Hampel", "Ident"}
+  \item{c, k}{tuning constants}
+  \item{y}{response vector of AR(p) model}
+  \item{tol}{tolerance level} 
+  \item{r}{residuals}
+  \item{s}{innovations scale parameter}
+  \item{u, v}{weights}
+  \item{...}{additional arguments (tuning constants) for influence functions}
+  \item{phi.ini}{initial AR(p) model parameters}
+  \item{s.ini}{initial innovations scale parameter}
+  \item{niter}{maximal number of iterations}
+}
+
+\details{
+to be filled
+}
+
+
+\value{
+\code{.ARmodel(x, p)} returns design matrix \code{Z} and response vector \code{y} of an AR(p) model (as list with corresponding elements).\cr
+\code{.invCp(p, s, Phi)} computes the inverse \eqn{p \times p}{p x p} covariance matrix.\cr
+\code{.Weights} computes weights for  Mallows- or Schweppe-type GM-estimates; returns a list with elements \code{u}, \code{v}.\cr
+\code{.startval} computes appropriate starting values; returns a list with elements \code{phi}, \code{s}.\cr
+\code{.BH} computes appropriate constant to obtain a consistent estimate for \eqn{\sigma} when using Huber's \eqn{\psi} function.\cr
+\code{.BB} computes appropriate constant to obtain a consistent estimate for \eqn{\sigma} when using Tukey's \eqn{\psi} function.\cr
+\code{.weights} computes appropriate weights for reweighting --- returns a vector.\cr
+\code{.IWLS}  iteratively reweighted least squares algorithm; returns a list with elements 
+ \code{phi}, \code{s},  \code{w}, \code{B}, \code{niter}.\cr
+}
+
+\author{
+Bernhard Spangl \email{bernhard.spangl at boku.ac.at},\cr 
+}
+
+
+\seealso{
+\code{\link{internalpsi}}
+}
+
+
+\keyword{internal}

Added: pkg/robKalman/man/internalpsi.Rd
===================================================================
--- pkg/robKalman/man/internalpsi.Rd	                        (rev 0)
+++ pkg/robKalman/man/internalpsi.Rd	2009-06-10 10:45:12 UTC (rev 31)
@@ -0,0 +1,55 @@
+\name{internalpsi}
+\alias{internalpsi}
+\alias{psiLS}
+\alias{psiHuber}
+\alias{psiTukey}
+\alias{psiHampel}
+\alias{.psi}
+
+\title{Internal functions of package robKalman --- psi functions}
+
+\description{
+These functions are used internally by package robKalman for the ACM filter --- psi functions
+}
+
+\usage{
+psiLS(t, rho=FALSE)
+psiHuber(t, k=1.345, rho=FALSE) 
+psiTukey(t, c=4.685, rho=FALSE)
+psiHampel(t, a=2, b=4, c=8, flag="psi")
+.psi(type)
+}
+
+\arguments{
+  \item{t}{numerical vector to be modified}
+  \item{rho}{logical: whether the \eqn{\psi}- (default) or \eqn{\rho}-function is used}
+  \item{k}{tuning constant for \code{psiHuber}}
+  \item{a}{tuning constant for \code{psiHampel}}
+  \item{b}{tuning constant for \code{psiHampel}}
+  \item{c}{tuning constant for \code{psiTukey} and \code{psiHampel}}
+  \item{flag}{character: either "psi", "weights" or "deriv" to use  \eqn{\psi}-function (default), 
+              weight function \eqn{\psi(t)/t} or  its derivative respectively}
+  \item{type}{character: which \eqn{\psi}-function; current possibilities: "Huber", "Tukey", "Hampel", "Ident"}
+}
+
+\details{
+Several possibilities are available as \eqn{\psi}-function to modify the correction step: "Huber", "Tukey", "Hampel", "Ident";
+the can all be used through one interface --- \code{.psi}, returning the corresponding \eqn{\psi}-function
+}
+
+
+\value{Each  of the functions \code{psiLS}, \code{psiHuber}, \code{psiHampel}, and \code{psiTukey} return the value
+of the corresponding \eqn{\psi}-function evaluated at \code{t}. \code{.psi} returns the corresponding \eqn{\psi}-function.
+}
+
+\author{
+Bernhard Spangl \email{bernhard.spangl at boku.ac.at},\cr 
+}
+
+
+\seealso{
+\code{\link{internalarGM}}
+}
+
+
+\keyword{internal}

Added: pkg/robKalman/man/internalrLS.Rd
===================================================================
--- pkg/robKalman/man/internalrLS.Rd	                        (rev 0)
+++ pkg/robKalman/man/internalrLS.Rd	2009-06-10 10:45:12 UTC (rev 31)
@@ -0,0 +1,84 @@
+\name{internalrLS}
+\alias{internalrLS}
+\alias{.rLSinitstep}
+\alias{.rLSpredstep}
+\alias{.rLScorrstep}
+
+\title{Internal functions of package robKalman for the rLS filter}
+
+\description{
+This function is used internally by package robKalman for the rLS filter
+}
+
+\usage{
+.rLScorrstep(y, x1, S1, Z, V,  rob1=NULL, b, norm=Euclideannorm, ...) 
+}
+
+\arguments{
+  \item{Z}{observation matrix (see below)}
+  \item{V}{observation error covariance (see below)}
+  \item{b}{clipping height \code{b} for the rLS filter}
+  \item{norm}{a function with a numeric vector \code{x} as first argument, 
+              returning a norm of \code{x} - not necessarily, but defaulting to, Euclidean norm; 
+              used by rLS filter to determine "too" large corrections}
+  \item{S1}{prediction error covariance \eqn{S_{t|t-1}} of the classical Kalman filter}
+  \item{rob1}{not used here; included for compatibility reasons; set to \code{NULL}}
+  \item{y}{observation \eqn{y_t}}
+  \item{x1}{(rLS Kalman)- predicted state \eqn{x_{t|t-1}}}
+  \item{...}{not used here; for compatibility with signatures of other "step"-functions}
+}
+
+\details{
+We work in the setup of the time-invariant, linear, Gaussian state space model (ti-l-G-SSM)
+with \eqn{p} dimensional states \eqn{x_t} and \eqn{q} dimensional observations \eqn{y_t},
+with \strong{initial condition}
+\deqn{x_0 \sim {\cal N}_p(a,S),}{x_0 ~ N_p(a,S),}
+
+\strong{state equation}
+\deqn{x_t = F x_{t-1} +  v_t, \qquad v_t \sim {\cal N}_p(0,Q),\qquad t\ge 1,}{x_t = F x_{t-1} +  v_t,          v_t ~ N_p(0,Q),  t>=1,}
+
+\strong{observation equation}
+\deqn{y_t = Z x_{t}   +  \varepsilon_t, \qquad \varepsilon_t \sim {\cal N}_q(0,V),\qquad t\ge 1,}{y_t = Z x_t   +  e_t,      e_t ~ N_q(0,V),  t>=1,}
+and where all random variable \eqn{x_0}, \eqn{v_t}, \eqn{\varepsilon_t}{e_t} are independent.
+
+For notation, let us formulate the classical Kalman filter in this context:
+
+\strong{(0) ininitial step}          \deqn{x_{0|0}   = a} 
+\eqn{\qquad}{\code{      }} with error covariance      
+\deqn{S_{0|0}   = {\rm Cov}(x_0-x_{0|0})   = \code{S}}{S_{0|0}   = Cov(x_0-x_{0|0})   = S}%
+
+\strong{(1) prediction step}       
+\deqn{x_{t|t-1} = F x_{t-1|t-1},\qquad t\ge 1}{x_{t|t-1} = F x_{t-1|t-1},         t>=1}
+\eqn{\qquad}{\code{      }} with error covariance      
+\deqn{S_{t|t-1} = {\rm Cov}(x_t-x_{t|t-1}) = F S_{t-1|t-1} F' + Q}{S_{t|t-1} = Cov(x_t-x_{t|t-1}) = F S_{t-1|t-1} F' + Q} 
+
+\strong{(2) correction step}       
+\deqn{x_{t|t}   = x_{t|t-1} + K_t (y_t - Z x_{t|t-1}),\qquad        t\ge 1}{x_{t|t}   = x_{t|t-1} + K_t (y_t - Z x_{t|t-1}),        t>=1}
+\eqn{\qquad}{\code{      }} for Kalman Gain   
+\deqn{K_t = S_{t|t-1} Z' (Z S_{t|t-1} Z' + V )^-}
+\eqn{\qquad}{\code{      }} with error covariance 
+\deqn{S_{t|t}   = {\rm Cov}(x_t-x_{t|t}) = S_{t|t-1} - K_t Z S_{t|t-1}}{S_{t|t}   = Cov(x_t-x_{t|t}) = S_{t|t-1} - K_t Z S_{t|t-1}}
+
+}
+
+
+\value{
+\code{.rLScorrstep(y, x1, S1, Z, V, b)}  calculates rLS-\eqn{x_{t|t}} for arguments \code{b}, \code{x1 =}\eqn{x_{t|t-1}} (from rLS-past), 
+\code{y =}\eqn{y_{t}},  \code{S1 =}\eqn{S_{t|t-1}}, \code{Z}, and  \code{V} as above\cr
+}
+
+
+\author{
+  Peter Ruckdeschel \email{Peter.Ruckdeschel at itwm.fraunhofer.de},\cr 
+  }
+
+\seealso{
+\code{\link{internalKalman}}
+}
+
+\references{
+Ruckdeschel, P. (2001) \emph{Ans\"atze zur Robustifizierung des
+Kalman Filters.} Bayreuther Mathematische Schriften, Vol. 64. 
+}
+
+\keyword{internal}

Added: pkg/robKalman/man/recFilter.Rd
===================================================================
--- pkg/robKalman/man/recFilter.Rd	                        (rev 0)
+++ pkg/robKalman/man/recFilter.Rd	2009-06-10 10:45:12 UTC (rev 31)
@@ -0,0 +1,197 @@
+\name{recFilter}
+\alias{recFilter}
+\alias{rLSFilter}
+\alias{KalmanFilter}
+\alias{ACMfilter}
+\alias{recursiveFilter}
+
+\title{Several recursive filters: the classical Kalman filter, the rLS filter, and the ACM filter}
+
+\description{
+These functions are (preliminary) interfaces producing recursive filters to a given series of observations from a 
+time-invariant, linear, Gaussian state space model (ti-l-G-SSM)
+}
+
+\usage{
+recursiveFilter(Y, a, S, F, Q, Z, V, 
+                initSc=.cKinitstep, predSc=.cKpredstep, corrSc=.cKcorrstep, 
+                initSr=NULL, predSr=NULL, corrSr=NULL, ...)
+KalmanFilter(Y, a, S, F, Q, Z, V)
+rLSFilter(Y, a, S, F, Q, Z, V, b, norm=Euclideannorm)
+ACMfilter(Y, a, S, F, Q, Z, V, s0, psi,  apsi, bpsi, cpsi, flag)
+}
+
+\arguments{
+  \item{a}{mean of the initial state}
+  \item{S}{initial state covariance (see below)}
+  \item{Z}{observation matrix (see below)}
+  \item{V}{observation error covariance (see below)}
+  \item{F}{innovation transition matrix (see below)}
+  \item{Q}{innovation covariance (see below)}
+  \item{b}{clipping height \code{b} for the rLS filter}
+  \item{norm}{a function with a numeric vector \code{x} as first argument, 
+              returning a norm of \code{x} - not necessarily, but defaulting to, Euclidean norm; 
+              used by rLS filter to determine "too" large corrections}
+  \item{Y}{observations \eqn{y_t}, in matrix form \eqn{q \times t}{q x t} for \code{t} 
+           the length of the observation series and \code{q} the observation dimension}
+  \item{s0}{scale of nominal Gaussian component of additive noise}
+  \item{psi}{influence function to be used (default: Hampel's \eqn{\psi} function, which is the only one available at the moment)}
+  \item{apsi,bpsi,cpsi}{tuning constants for Hampel's \eqn{\psi}-function, (default: \code{a=b=2.5}, \code{c=5.0})}
+  \item{flag}{character, if "weights" (default), use \eqn{\psi(t)/t} to calculate the weights; if "deriv", use \eqn{\psi'(t)}}
+  \item{initSc}{a function with first arguments \code{a} and \code{S} to produce 
+                the classical (non robust) initial filter value \eqn{x_{0|0}}}
+  \item{initSr}{either \code{NULL}  or a function with first arguments \code{a} and \code{S} to produce 
+                a robust initial filter value \eqn{x_{0|0}}}
+  \item{predSc}{a function with first arguments \code{x0}\eqn{=x_{t-1|t-1}} and \code{S0}\eqn{=S_{t-1|t-1}}, \code{F}, 
[TRUNCATED]

To get the complete diff run:
    svnlook diff /svnroot/robkalman -r 31


More information about the Robkalman-commits mailing list