Learn R Programming

evoTS (version 1.0.3)

loglik.surface.OU: 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.

Usage

loglik.surface.OU(
  y,
  stat.var.vec,
  h.vec,
  anc = NULL,
  theta = NULL,
  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

the optimum

pool

indicating whether to pool variances across samples

Author

Kjetil Lysne Voje

Examples

Run this code

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

## Fit the model to the data.
x1<-paleoTS::opt.joint.OU(x)

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

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

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

Run the code above in your browser using DataLab