MCMCglmm.utilities {dispRity} | R Documentation |
MCMCglmm object utility functions
Description
Different utility functions to extract aspects of a MCMCglmm
object.
Usage
MCMCglmm.traits(MCMCglmm)
MCMCglmm.levels(MCMCglmm, convert)
MCMCglmm.sample(MCMCglmm, n)
MCMCglmm.covars(MCMCglmm, n, sample)
MCMCglmm.variance(MCMCglmm, n, sample, levels, scale)
Arguments
MCMCglmm |
A |
convert |
Logical, whether to return the raw term names names as expressed in the model column names ( |
n |
Optional, a number of random samples to extract. |
sample |
Optional, the specific samples to extract (is ignored if |
levels |
Optional, a vector |
scale |
Logical, whether to scale the variance relative to all the levels ( |
Details
-
MCMCglmm.levels
returns the different random and residual terms levels of aMCMCglmm
object. This function uses the default optionconvert = TRUE
to convert the names into something more readable. Toggle toconvert = FALSE
for the raw names. -
MCMCglmm.traits
returns the column names of the different traits of aMCMCglmm
formula object. -
MCMCglmm.sample
returns a vector of sample IDs present in theMCMCglmm
object. Ifn
is missing, all the samples IDs are returned. Else, a random series of sample IDs are returned (with replacement if n greater than the number of available samples). -
MCMCglmm.covars
returns a list of covariance matrices and intercepts from aMCMCglmm
object (respectively fromMCMCglmm$VCV
andMCMCglmm$Sol
). By default, all the covariance matrices and intercepts are returned but you can use either of the argumentssample
to return specific samples (e.g.MCMCglmm.covars(data, sample = c(1, 42))
for returning the first and 42nd samples) orn
to return a specific number of random samples (e.g.MCMCglmm.covars(data, n = 42)
for returning 42 random samples). -
MCMCglmm.variance
returns a list of covariance matrices and intercepts from aMCMCglmm
object (respectively fromMCMCglmm$VCV
andMCMCglmm$Sol
). By default, all the covariance matrices and intercepts are returned but you can use either of the argumentssample
to return specific samples (e.g.MCMCglmm.covars(data, sample = c(1, 42))
for returning the first and 42nd samples) orn
to return a specific number of random samples (e.g.MCMCglmm.covars(data, n = 42)
for returning 42 random samples).
Author(s)
Thomas Guillerme
See Also
Examples
## Loading the charadriiformes model
data(charadriiformes)
model <- charadriiformes$posteriors
class(model) # is MCMCglmm
## Get the list of levels from the model
MCMCglmm.levels(model)
## The raw levels names (as they appear in the MCMCglmm object)
MCMCglmm.levels(model, convert = FALSE)
## Get the traits names from the model
MCMCglmm.traits(model)
## Get all the available samples in the model
length(MCMCglmm.sample(model))
## Get 5 random sample IDs from the model
MCMCglmm.sample(model, n = 5)
## Get one specific samples from the model
MCMCglmm.covars(model, sample = 42)
## Get two random samples from the model
MCMCglmm.covars(model, n = 2)