Learn R Programming

paleoTS (version 0.5-1)

fitModeShift: Fit models in which start in Stasis, and then shift to a random walk (or vice versa)

Description

This function fits to a paleoTS object a model that starts in Stasis and shifts to either a unbiased or general random walk (models URW or GRW), or vice versa.

Usage

fitModeShift(y, minb = 7, pool = TRUE, order = c("Stasis-RW", "RW-Stasis"),
             rw.model = c("URW", "GRW"), method = c("Joint", "AD"), 
             silent = FALSE, hess = FALSE, ...)

opt.joint.RW.Stasis(y, gg, rw.model=c("URW", "GRW"), cl=list(fnscale=-1), pool=TRUE, meth="L-BFGS-B", hess=FALSE) opt.AD.RW.Stasis(y, gg, rw.model=c("URW", "GRW"), cl=list(fnscale=-1), pool=TRUE, meth="L-BFGS-B", hess=FALSE) opt.joint.Stasis.RW(y, gg, rw.model=c("URW", "GRW"), cl=list(fnscale=-1), pool=TRUE, meth="L-BFGS-B", hess=FALSE) opt.AD.Stasis.RW(y, gg, rw.model=c("URW", "GRW"), cl=list(fnscale=-1), pool=TRUE, meth="L-BFGS-B", hess=FALSE) logL.joint.URW.Stasis(p, y, gg) logL.joint.GRW.Stasis(p, y, gg) logL.joint.Stasis.URW(p, y, gg) logL.joint.Stasis.GRW(p, y, gg)

Arguments

y

a paleoTS object

minb

the minimum number of samples to require before and after the mode shift

pool

logical, if TRUE, sample variances are replaced by their pooled estimate across all samples

order

either "Stasis-RW" or "RW-Stasis", setting the order of the two modes

rw.model

either "GRW" or "URW", setting the random walk model to be unbaised (URW) or general/biased/directional (GRW)

method

parameterization to use: see Details

silent

logical, if TRUE, results are not printed

hess

logical, if TRUE, standard errors are computed from the Hessian matrix

further arguments, to be passed to optimization functions

gg

vector of group membership, from shift2gg

cl

control list for optimization

meth

optimization method, can be "BFGS" or "L-BFGS-B"

p

parameter vectors for log-likelihood functions

Value

A paleoTSfit object, with additional elements:

all.logl

log-likelihoods for all tested partitions of the series into segments

GG

matrix of indices of initial samples of each tested segment configuration; each column of GG corresponds to the elements of all.logl

Details

Only the function fitStasisRW is likely to be used by the user. The other functions are called directly or indirectly by this one.

The method argument refers to different parameterizations of the model. See the documentation under opt.joint.GRW for more information about the differences between these parameterizations.

References

Hunt, G., M. J. Hopkins, and S. L. Lidgard 2015. Simple versus complex models of trait evolution and stasis as a response to environmental change. PNAS 112:4885--4890.

See Also

as.paleoTSfit, bootSimpleComplex, fit9models

Examples

Run this code
# NOT RUN {
	x<- sim.GRW(ns=30)
	m.urw<- fitSimple(x, model="URW")
	m.cplx<- fitModeShift(x, order="Stasis-RW", rw.model="URW", method="Joint")
	compareModels(m.urw, m.cplx)
# }

Run the code above in your browser using DataLab