opt.RW {paleoTS} | R Documentation |
Functions to find maximum likelihood solutions to general random walk (opt.RW
), unbiased random walk opt.RWu
, and stasis models opt.stasis
.
opt.RW(y, cl = list(fnscale = -1), pool = TRUE, meth = "L-BFGS-B", hess = FALSE) opt.RWu(y, cl=list(fnscale=-1), pool=TRUE, meth="L-BFGS-B", hess=FALSE) opt.stasis(y, cl=list(fnscale=-1), pool=TRUE, meth="L-BFGS-B", hess=FALSE)
y |
a paleoTS object |
cl |
control list, passed to function optim |
pool |
logical indicating whether to pool variances across samples |
meth |
optimization method, passed to function optim |
hess |
logical, indicating whether to calculate standard errors from the Hessian matrix |
These functions numerically search a log-likelihood surface for its optimum–they are a convenient wrapper to optim
. Arguments meth
, cl
, and hess
are passed to optim
; see that function's help for details. These are included to allow sophisticated users greater control over the optimization; most users will just use the defaults. For meth
, only meth="L-BFGS-B"
and meth="BFGS"
are implemented. The former constrains estimates of the step variance to be non-negative, which can be useful paramters which cannot truly be negative, such as vstep (random walk) and omega (stasis model).
Initial estimates to start the optimization come from analytical solutions based on assuming equal sampling error across samples and evenly spaced samples in time (functions mle.rw
and mle.stasis
).
A list including:
par |
parameter estimates |
value |
the log-likelihood of the optimal solution |
counts |
returned by optim |
convergence |
returned by optim |
message |
returned by optim |
p0 |
initial guess for parameter values at start of optimization |
K |
number of parameters in the model |
AIC |
Akaike information criterion |
AICc |
modified Akaike information criterion |
BIC |
Bayes (or Schwarz) information criterion |
Standard errors computed from the Hessian matrix are reasonably accurate for mstep
and theta
, but not useful for the vstep and omega because of the asymmetry of the log-likelihood surfaces.
Gene Hunt
Hunt, G. 2007. Fitting and comparing models of phyletic evolution: random walks and beyond. Paleobiology32:578–601.
logL.RW
, fit3models
, opt.RW.mult
, sim.rw
## generate data for a directional sequence y <- sim.rw(30, sm=1, sv=1) plot(y) m.rw<- opt.RW(y) m.rwu<- opt.RWu(y) m.sta<- opt.stasis(y) ## print log-likelihoods, easier to use function fit3models() cat(m.rw$value, m.rwu$value, m.sta$value, "\n")