| fitGpunc {paleoTS} | R Documentation |
Functions required to fit evolutionary models with puntuations that are rapid relative to the temporal spacing of samples (so-called unsampled punctuations).
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)
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 |
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.
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:
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 |
n |
the number of observations, equal to the number of evoltuionary transistions |
AIC |
Akaike information criterion |
AICc |
modified Akaike information criterion |
BIC |
Bayes (or Schwarz) information criterion |
se |
standard errors for parameter estimates, computed from the curvature of the log-likelihood surface (only if hess = TRUE) |
... |
other output from call to optim |
shift.start |
index of each sample that starts a new segment |
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 |
Gene Hunt
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.
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)