Learn R Programming

paleoTS (version 0.5-1)

fit.sgs: Analyze evolutionary models with well-sampled punctuations

Description

Functions required to fit evolutionary models with sampled puntuations, i.e., where the transitional period is represented by at least several sampled populations.

Usage

fit.sgs(y, minb = 7, oshare = TRUE, pool = TRUE, silent = FALSE, hess = FALSE,
        meth = "L-BFGS-B", model = "GRW")

opt.sgs(y, gg, cl = list(fnscale = -1), meth = "L-BFGS-B", hess = FALSE, oshare = TRUE, model = "GRW") logL.sgs(p, y, gg, model = "GRW") logL.sgs.omega(p, y, gg, model = "GRW")

Arguments

y

a paleoTS object

minb

the minimum number of samples within a segment to consider

oshare

logical, if TRUE, the same variance (omega) is assumed across the starting and ending Stasis segments. If FALSE, separate variances are assumed

pool

logical indicating whether to pool variances across samples

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

meth

optimization method, to be passed to optim

model

either GRW or URW, indicating whether evolution during the transitional interval is directional (general random walk) or not (unbiased random walk)

p

parameters of the punctuation model for the log-likelihood functions

gg

numeric vector indicating membership of each sample in segments 1, 2, .. ng

cl

control list 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).

In addition to those specifying the dynamics of stasis and punctuation, parameters include shift1, the index of the last sample before the shit to GRW/URW, and shift2, the index of the last sample before the return to stasis.

Function opt.sgs returns a paleoTSfit object. Function fit.sgs does the same, but with the following additional elements:

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

Details

These functions are used to fit a model with a sampled punctuation. Formally, this is a three-segment model that starts as stasis, transitions to a period of directional evolution (general random walk) or unconstrained (unbiased random walk), and then returns to stasis. The name comes from an abbreviation of the three modes in the segments: Stasis - General Random Walk - Stasis, bearing in mind that the general random walk can be changed to an unbiased random walk. Users are likely only to use fit.sgs, 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. Paleobiology 32:578--601. Hunt, G. 2008. Gradual or pulsed evolution: when should punctuational explanations be preferred? Paleobiology 34:360--377.

See Also

sim.sgs, opt.GRW, fitGpunc, as.paleoTSfit

Examples

Run this code
# NOT RUN {
 x<- sim.sgs(ns=c(10, 10, 10), ms=0.5, vs=0.3, omega=0.1)
 plot(x)
 # compare sampled punctuation to uniform unbiased random walk
 w.sgs<- fit.sgs(x, minb=8, model="GRW")
 w.urw<- opt.URW(x)
 compareModels(w.urw, w.sgs)
 
# }

Run the code above in your browser using DataLab