Learn R Programming

paleoTS (version 0.3-1)

fitGpunc: Analyze evolutionary models with unsampled punctuations

Description

Functions required to fit evolutionary models with puntuations that are rapid relative to the temporal spacing of samples (so-called unsampled punctuations).

Usage

fitGpunc(y, ng = 2, minb = 5, pool = TRUE, oshare = TRUE, silent = FALSE, hess=FALSE, ...)
opt.punc(y, gg, cl = list(fnscale = -1), pool = TRUE, meth = "L-BFGS-B", hess = FALSE, oshare)
logL.punc(p, y, gg)
logL.punc.omega(p, y, gg)

Arguments

y
a paleoTS object
ng
the number of separate segments in the sequence
minb
the minimum number of samples within a segment to consider
pool
logical indicating whether to pool variances across samples
oshare
logical, if TRUE, the same variance (omega) is assumed across all segments. If FAlSE, separate variances are assumd for each segment
silent
if TRUE, less information is printed to the screen as the model is fit
hess
if TRUE, standard errors are computed from the Hessian matrix
...
other arguments to send to opt.punc
p
parameters of the punctuation model to be optimized
gg
numeric vector indicating membership of each sample in segments 1, 2, .. ng
cl
control list to be passed to optim
meth
optimization method, to be passed to optim

Value

  • The log-likelihood functions return the log-likelihood of the model for a given set of parameter values (p), assuming that the periods of Stasis have the same variance (logL.punc.omega) or different variances (logL.punc). Functions fitGpunc and opt.punc return a list with the following elements:
  • 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
  • In addition, function fitGpunc also returns the following elements:
  • shift.startindex of each sample that starts a new segment
  • all.logllog-likelihoods for all tested partitions of the series into segments
  • GGmatrix of indices of initial samples of each tested segment configuration; each column of GG corresponds to the elements of all.logl

Details

These functions are used to fit a model with an unsampled punctuation. It is equivalent to a Stasis model in which the optimum instantaneously shifts at one or more points in time; see refereces below for details. Users are likely only to use fitGpunc, which will calls the other functions in order to find the best parameter estimates and shift points for the segments.

References

Hunt, G. 2006. Fitting and comparing models of phyletic evolution: random walks and beyond. Paleobiology32:578--601. Hunt, G. 2008. Gradual or pulsed evolution: when should punctuational explanations be preferred? Paleobiology34:In press.

See Also

sim.punc, opt.GRW, fit.sgs

Examples

Run this code
x<- sim.punc(theta=c(0,5), ns=c(20,20), omega=c(1,1), vp=c(0.2,0.2))
plot(x)
w<- fitGpunc(x, ng=2, minb=7, pool=TRUE, oshare=TRUE)
print (w$par)
## add lines to show the solution
segments(x$tt[1], w$par[1], x$tt[w$shift.start-1], w$par[1], lty=3, col="red", lwd=5)
segments(x$tt[w$shift.start], w$par[2], x$tt[length(x$tt)], w$par[2], lty=3, col="red", lwd=5)

Run the code above in your browser using DataLab