R/artransform.R

Defines functions artransform

Documented in artransform

#' Mapping real valued parameters to stationary region
#'
#' Function \code{artransform} transforms \eqn{p} real valued parameters to
#' stationary region of \eqn{p}th order autoregressive process using
#' parametrization suggested by Jones (1980). Fortran code is a converted from
#' \code{stats} package's C-function \code{partrans}.
#' 
#' @note This should in theory always work, but in practice the initial transformation 
#' by \code{tanh} can produce values numerically identical to 1, leading to AR coefficients 
#' which do not satisfy the stationarity constraints. See example in \code{logLik.SSModel} on how
#' to scope with those issues.
#' 
#' @export
#' @param param Real valued parameters for the transformation.
#' @return transformed The parameters satisfying the stationary constrains.
#' @references Jones, R. H (1980). Maximum likelihood fitting
#' of ARMA models to time series with missing observations, Technometrics
#' Vol 22. p. 389--395.
#' @examples
#' artransform(1:3)
artransform <- function(param) {
  .Fortran("fartransform", phi = tanh(param), length(param))$phi
}

Try the KFAS package in your browser

Any scripts or data that you put into this service are public.

KFAS documentation built on Sept. 8, 2023, 5:56 p.m.