Learn R Programming

paleoTS (version 0.5-1)

opt.covTrack: Covariate-tracking model

Description

Functions to fit a model in which a phenotpyic trait tracks changes in a measured covariate (e.g., body size tracks temperature changes).

Usage

opt.covTrack(y, z, pool = TRUE, cl = list(fnscale = -1), meth = "L-BFGS-B", hess = FALSE)
opt.joint.covTrack(y, z, pool=TRUE, cl=list(fnscale=-1), meth="L-BFGS-B", hess=FALSE)
opt.covTrack.Mult(yl, zl, cl = list(fnscale = -1), pool = TRUE, hess = FALSE)
opt.joint.covTrack.Mult(yl, zl, cl=list(fnscale=-1), pool=TRUE, hess=FALSE)

logL.covTrack(p, y, z) logL.joint.covTrack(p, y, z) logL.Mult.covTrack(p, yl, zl) logL.Mult.joint.covTrack(p, yl, zl)

Arguments

y

a paleoTS object

z

a measured covariate. See Details about its required length.

pool

logical, if TRUE, variance are pooled across samples

cl

control list, passed to function optim

meth

optimization method, passed to function optim

hess

logical, indicating whether to calculate standard errors from the Hessian matrix

yl

a list of paleoTS objects

zl

a list of covariates, corresponding to yl

p

a vector of parameter values

Value

An object of class paleoTSfit

Warning

The "Joint" parameterization does not de-trend the series in any way, and so is vulnerable to type I error if both y and z are trended. If so, an warning message is given.

Details

These functions fit a model in trait evolution tracks a covariate (z) over time. There are two parameterizations: "Joint" and "AD"; all functions without "joint" in their names use the "AD" parameterization. The "joint" parameterization assumes the trait values are a linear function of the covariate, whereas the "AD" parameterization assumes that changes in the traits are a linear function of changes in the covariate.

For the "AD" parameterization, z can be equal in length to y, or have one fewer element. If the former, first differences are taken. If z is of length one less than the trait sequence, it is assumed that the user has already taken the appropriate difference. For the "Joint" parameterization, z must be of the same length as y.

For the Mult versions of these, the function estimates the model assuming the same relationship exists across all sequences.

References

Hunt, et al. 2010. Climate-driven body-size trends in the ostracod fauna of the deep Indian Ocean, Palaeontology 53:1255--1268.

See Also

as.paleoTSfit, opt.GRW, fitSimple

Examples

Run this code
# NOT RUN {
 z<- rnorm(20)
 x<- sim.covTrack(ns=20, b=2, evar=0.1, z=z)
 plot(diff(z), diff(x$mm), xlab="Change in covariate", ylab="Change in Trait")
 abline(h=0, lty=3)
 abline(v=0, lty=3)
 mct<- opt.covTrack(x, z)
 print(round(mct$parameters,2))  # should be close to generating values
 print(x$genpar)
# }

Run the code above in your browser using DataLab