/
PCMMeanAtTime.Rd
53 lines (47 loc) · 1.69 KB
/
PCMMeanAtTime.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/PCM.R
\name{PCMMeanAtTime}
\alias{PCMMeanAtTime}
\title{Calculate the mean at time t, given X0, under a PCM model}
\usage{
PCMMeanAtTime(
t,
model,
X0 = model$X0,
regime = PCMRegimes(model)[1L],
verbose = FALSE
)
}
\arguments{
\item{t}{positive numeric denoting time}
\item{model}{a PCM model object}
\item{X0}{a numeric vector of length k, where k is the number of traits in the model (Defaults to model$X0).}
\item{regime}{an integer or a character denoting the regime in model for
which to do the calculation; Defaults to PCMRegimes(model)[1L], meaning the
first regime in the model.}
\item{verbose}{a logical indicating if (debug) messages should be written on the console (Defaults to FALSE).}
}
\value{
A numeric vector of length k
}
\description{
Calculate the mean at time t, given X0, under a PCM model
}
\examples{
# a Brownian motion model with one regime
modelBM <- PCM(model = "BM", k = 2)
# print the model
modelBM
# assign the model parameters at random: this will use uniform distribution
# with boundaries specified by PCMParamLowerLimit and PCMParamUpperLimit
# We do this in two steps:
# 1. First we generate a random vector. Note the length of the vector equals PCMParamCount(modelBM)
randomParams <- PCMParamRandomVecParams(modelBM, PCMNumTraits(modelBM), PCMNumRegimes(modelBM))
randomParams
# 2. Then we load this random vector into the model.
PCMParamLoadOrStore(modelBM, randomParams, 0, PCMNumTraits(modelBM), PCMNumRegimes(modelBM), TRUE)
# PCMMeanAtTime(1, modelBM)
# note that the variance at time 0 is not the 0 matrix because the model has a non-zero
# environmental deviation
PCMMeanAtTime(0, modelBM)
}