Learn R Programming

paleoTS (version 0.3-1)

opt.GRW: Numerically find maximum likelihood solutions to evolutionary models

Description

Functions to find maximum likelihood solutions to general random walk (opt.GRW), unbiased random walk opt.URW, and stasis models opt.Stasis.

Usage

opt.GRW(y, pool = TRUE, cl = list(fnscale = -1), meth = "L-BFGS-B", hess = FALSE)
opt.URW(y, pool = TRUE, cl = list(fnscale=-1), meth = "L-BFGS-B", hess = FALSE)
opt.Stasis(y, pool = TRUE, cl = list(fnscale=-1), meth = "L-BFGS-B", hess = FALSE)

Arguments

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

Value

  • A list including:
  • parparameter estimates
  • valuethe log-likelihood of the optimal solution
  • countsreturned by optim
  • convergencereturned by optim
  • messagereturned by optim
  • p0initial guess for parameter values at start of optimization
  • Knumber of parameters in the model
  • nthe number of observations, equal to the number of evoltuionary transistions
  • AICAkaike information criterion
  • AICcmodified Akaike information criterion
  • BICBayes (or Schwarz) information criterion
  • sestandard errors for parameter estimates, computed from the curvature of the log-likelihood surface (only if hess = TRUE)
  • ...other output from call to optim

Details

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; the defaults seem to work well for most, but not all sequences. For meth="L-BFGS-B", some parameters are constrained to be non-negative, which is 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.GRW, mle.URW and mle.Stasis).

References

Hunt, G. 2006. Fitting and comparing models of phyletic evolution: random walks and beyond. Paleobiology32:578--601.

See Also

logL.GRW, fit3models, opt.RW.Mult, sim.GRW

Examples

Run this code
## generate data for a directional sequence
 y <- sim.GRW(ns=30, ms=1, vs=1)
 plot(y)
 m.rw<- opt.GRW(y)
 m.rwu<- opt.URW(y)
 m.sta<- opt.Stasis(y)

 ## print log-likelihoods; easier to use function fit3models()
 cat(m.rw$value, m.rwu$value, m.sta$value, "")

Run the code above in your browser using DataLab