Learn R Programming

evoTS (version 1.0.3)

loglik.surface.OUBM: Calculate the log-likelihood surface for a part of parameter space

Description

Function to calculate the log-likelihood surface for a part of parameter space for a Ornstein-Uhlenbeck model where the optimum changes according to an Unbiased Random Walk.

Usage

loglik.surface.OUBM(
  y,
  stat.var.vec,
  h.vec,
  anc = NULL,
  theta.0 = NULL,
  vo = NULL,
  opt.anc = TRUE,
  pool = TRUE
)

Value

the function returns the range of parameter values that are within two log-likelihood units from the best (maximum) parameter estimate and a log-likelihood surface.

Arguments

y

an univariate paleoTS object.

stat.var.vec

vector containing the parameter values of the stationary variance to be evaluated

h.vec

vector containing the parameter values of the half life to be evaluated

anc

the ancestral state

theta.0

the optimum

vo

the variance (vstep) parameter for the optimum

opt.anc

logical, indicating whether the the ancestral trait state is at the optimum.

pool

indicating whether to pool variances across samples

Author

Kjetil Lysne Voje

Examples

Run this code

## Generate a paleoTS objects
x <- sim.OUBM(40)

## Fit the model.
x1<-opt.joint.OUBM(x)

##calculate half-life from model output
log(2)/x1$parameters[3]

##calculate stationary variance from model output
x1$parameters[2]/(2*x1$parameters[3])

# \donttest{
## Create log-likelihood surface (the example may take > 5 seconds to run)
loglik.surface.OUBM(x, stat.var.vec=seq(0,4,0.01), h.vec=seq(0.0,5, 0.1))
# }

Run the code above in your browser using DataLab