Learn R Programming

glinvci (version 1.2.4)

set_tips: Set trait values at the tip for a glinv_gauss model.

Description

If a glinv_gauss or glinv object were initalised with X=NULL, methods like lik will not work because it lacks actual data. In this case, the user should set the trait values using this method. If trait values were already set before, they will be replaced with the new trait values.

Usage

set_tips(mod, X)

# S3 method for glinv_gauss set_tips(mod, X)

# S3 method for glinv set_tips(mod, X)

Value

A model whose tip trait values are set.

Arguments

mod

A glinv_gauss or glinv object.

X

A matrix of trait values, in which X[p,n] stores the p-th dimension of the multivariate trait of the n-th tip of the phylogeny.

Details

X can contain any NA nor NaN if set_tips is called on a glinv model but this is will result in error if the method were called on a glinv_gauss model.

This method alters an underlying C structure, therefore has a mutable-object semantic. (See example).

Examples

Run this code
tr = ape::rtree(10)
model  = glinv_gauss(tr, x0=c(0,0))  # The `X` argument is implicitly NULL
model2 = model                       # This is not copied!
traits = matrix(rnorm(20), 2, 10)
set_tips(model, traits)

Run the code above in your browser using DataLab