opt.ssm.GRW: Fit evolutionary models using state-space models (SSM)

View source: R/ssm.R

opt.ssm.GRWR Documentation

Fit evolutionary models using state-space models (SSM)

Description

Fit evolutionary models using state-space models (SSM)

Usage

opt.ssm.GRW(y, pool = TRUE, cl = list(fnscale = -1), hess = FALSE)

opt.ssm.URW(y, pool = TRUE, cl = list(fnscale = -1), hess = FALSE)

opt.ssm.Stasis(y, pool = TRUE, cl = list(fnscale = -1), hess = FALSE)

opt.ssm.StrictStasis(y, pool = TRUE, cl = list(fnscale = -1), hess = FALSE)

opt.ssm.OU(y, pool = TRUE, cl = list(fnscale = -1), hess = FALSE)

opt.ssm.ACDC(y, pool = TRUE, cl = list(fnscale = -1), hess = FALSE)

opt.ssm.covOU(y, z, pool = TRUE, cl = list(fnscale = -1), hess = FALSE)

opt.ssm.URWshift(y, gg, pool = TRUE, cl = list(fnscale = -1), hess = FALSE)

opt.ssm.covOU_vshift(
  y,
  z,
  gg,
  pool = TRUE,
  cl = list(fnscale = -1),
  hess = FALSE
)

Arguments

y

a paleoTS object

pool

if TRUE, sample variances are substituted with their pooled estimate

cl

optional control list, passed to optim()

hess

if TRUE, return standard errors of parameter estimates from the hessian matrix

z

a covariate vector, used only for the covOU models

gg

a grouping vector, used only for the URWshift and covOU_vshift models

Details

These functions use a state space model formulation to compute likelihoods and fit models.

Functions to fit the OU covariate tracking models (covOU, covOU_vshift) require a covariate argument, z. At present, only the OU covariate tracking with a shift in the step variance (covOU_vshift) requires the grouping vector argument (gg).

Value

a paleoTSfit object with the model fitting results

Note

For GRW, URW, Stasis, StrictStasis, ACDC and OU models, it will likely be easier to use the convenience function fitSimple with argument method = "SSM".
The grouping vector, gg, is a vector of length equal to the number of samples. It has one element for each sample and takes integer value from 1 to the number of sample groups separated by shiftpoints. See the example below.

See Also

fitSimple, opt.joint.GRW

Examples

y <- sim.GRW(ns = 30, vs = 2)
w1 <- opt.ssm.URW(y)
gg <- rep(1:2, each = 15) # shift occurs immediately after sample 15
w2 <- opt.ssm.URWshift(y, gg = gg) # test model in which the step variance shifts
compareModels(w1, w2)

paleoTS documentation built on Sept. 11, 2024, 9:18 p.m.