R/RcppExports.R

Defines functions kalman_rcpp smooth_rcpp

Documented in kalman_rcpp smooth_rcpp

# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

#' Kalman filter
#' 
#' This code is adapted from the package crawl (Johnson et al., 2008).
#' 
#' @param data Matrix of data, including (in that order) columns "x", "y", 
#' "time", and "state".
#' @param param Vector of movement parameters (beta and sigma)
#' @param Hmat Matrix of observation error variance (four columns, and one row 
#' for each row of data)
#' @param a0 Initial state estimate vector
#' @param P0 Initial estimate covariance matrix
#' 
#' @return Log-likelihood
#' 
#' @references
#' Johnson, D. S., London, J. M., Lea, M. A., & Durban, J. W. (2008).
#' Continuous-time correlated random walk model for animal telemetry data
#' Ecology, 89(5), 1208-1215.
#' 
#' @export
kalman_rcpp <- function(data, param, Hmat, a0, P0) {
    .Call('_MScrawl_kalman_rcpp', PACKAGE = 'MScrawl', data, param, Hmat, a0, P0)
}

#' Make T matrix
#' 
#' @param beta Parameter beta of OU velocity process
#' @param dt Length of time interval
NULL

#' Make Q matrix
#' 
#' @param beta Parameter beta of OU velocity process
#' @param sigma Parameter sigma of OU velocity process
#' @param dt Length of time interval
NULL

#' Kalman filter and smoother
#' 
#' This code is adapted from the package crawl (Johnson et al., 2008).
#' 
#' @param data Matrix of data, including (in that order) columns "x", "y", 
#' "time", and "state".
#' @param param Vector of movement parameters (beta and sigma)
#' @param Hmat Matrix of observation error variance (four columns, and one row 
#' for each row of data)
#' @param a0 Initial state estimate vector
#' @param P0 Initial estimate covariance matrix
#' 
#' @return List of: log-likelihood, state estimates, and state estimate covariance
#' 
#' @references
#' Johnson, D. S., London, J. M., Lea, M. A., & Durban, J. W. (2008).
#' Continuous-time correlated random walk model for animal telemetry data
#' Ecology, 89(5), 1208-1215.
#' 
#' @export
smooth_rcpp <- function(data, param, Hmat, a0, P0) {
    .Call('_MScrawl_smooth_rcpp', PACKAGE = 'MScrawl', data, param, Hmat, a0, P0)
}
TheoMichelot/MScrawl documentation built on Dec. 10, 2019, 10:44 a.m.