opt.GRW.shift {paleoTS} | R Documentation |
Fit random walk model with shift(s) in generating parameters
Description
Fit random walk model with shift(s) in generating parameters
Usage
opt.GRW.shift(y, ng = 2, minb = 7, model = 1, pool = TRUE, silent = FALSE)
Arguments
y |
a |
ng |
number of segments in the sequence |
minb |
minimum number of populations in each segment |
model |
numeric, specifies exact evolutionary model; see Details |
pool |
if TRUE, sample variances are substituted with their pooled estimate |
silent |
logical, if TRUE, progress updates are suppressed |
Details
Fits a model in which a sequence is divided into two or more segments and
trait evolution proceeds as a general random walk, with each segment (potentially)
getting its own generating parameters (mstep
, vstep
).
This function tests for shifts after each population, subject to the
constraint that the number of populations in each segment is always >= minb
. The
shiftpoint yielding the highest log-likelihood is returned as the solution, along with
the log-likelihoods (all.logl
of all tested shift points (GG
).
Different variants of the model can be specified by the model
argument:
-
model = 1:
mstep
is separate across segments;vstep
is shared -
model = 2:
mstep
is shared across segments;vstep
is separate -
model = 3:
mstep
is set to zero (unbiased random walk);vstep
is separate across segments -
model = 4:
mstep
andvstep
are both separate across segments
Value
a paleoTSfit
object
See Also
Examples
x <- sim.GRW.shift(ns = c(15,15), ms = c(0, 1), vs = c(0.1,0.1))
w.sep <- opt.GRW.shift(x, ng = 2, model = 4)
w.sameVs <- opt.GRW.shift(x, ng = 2, model = 1)
compareModels(w.sep, w.sameVs)
plot(x)
abline(v = x$tt[16], lwd = 3) # actual shift point
abline(v = x$tt[w.sameVs$par["shift1"]], lty = 3, col = "red", lwd = 2) # inferred shift point