| 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.levelsreturns the different random and residual terms levels of aMCMCglmmobject. This function uses the default optionconvert = TRUEto convert the names into something more readable. Toggle toconvert = FALSEfor the raw names. -
MCMCglmm.traitsreturns the column names of the different traits of aMCMCglmmformula object. -
MCMCglmm.samplereturns a vector of sample IDs present in theMCMCglmmobject. Ifnis 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.covarsreturns a list of covariance matrices and intercepts from aMCMCglmmobject (respectively fromMCMCglmm$VCVandMCMCglmm$Sol). By default, all the covariance matrices and intercepts are returned but you can use either of the argumentssampleto return specific samples (e.g.MCMCglmm.covars(data, sample = c(1, 42))for returning the first and 42nd samples) ornto return a specific number of random samples (e.g.MCMCglmm.covars(data, n = 42)for returning 42 random samples). -
MCMCglmm.variancereturns a list of covariance matrices and intercepts from aMCMCglmmobject (respectively fromMCMCglmm$VCVandMCMCglmm$Sol). By default, all the covariance matrices and intercepts are returned but you can use either of the argumentssampleto return specific samples (e.g.MCMCglmm.covars(data, sample = c(1, 42))for returning the first and 42nd samples) ornto 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)