| MCMCglmm.utilities | R Documentation |
Different utility functions to extract aspects of a MCMCglmm object.
MCMCglmm.traits(MCMCglmm)
MCMCglmm.levels(MCMCglmm, convert)
MCMCglmm.sample(MCMCglmm, n)
MCMCglmm.covars(MCMCglmm, n, sample)
MCMCglmm.variance(MCMCglmm, n, sample, levels, scale)
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 ( |
MCMCglmm.levels returns the different random and residual terms levels of a MCMCglmm object. This function uses the default option convert = TRUE to convert the names into something more readable. Toggle to convert = FALSE for the raw names.
MCMCglmm.traits returns the column names of the different traits of a MCMCglmm formula object.
MCMCglmm.sample returns a vector of sample IDs present in the MCMCglmm object. If n 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 a MCMCglmm object (respectively from MCMCglmm$VCV and MCMCglmm$Sol). By default, all the covariance matrices and intercepts are returned but you can use either of the arguments sample to return specific samples (e.g. MCMCglmm.covars(data, sample = c(1, 42)) for returning the first and 42nd samples) or n 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 a MCMCglmm object (respectively from MCMCglmm$VCV and MCMCglmm$Sol). By default, all the covariance matrices and intercepts are returned but you can use either of the arguments sample to return specific samples (e.g. MCMCglmm.covars(data, sample = c(1, 42)) for returning the first and 42nd samples) or n to return a specific number of random samples (e.g. MCMCglmm.covars(data, n = 42) for returning 42 random samples).
Thomas Guillerme
MCMCglmm.subsets
## 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)
## Get the variance for each terms in the model
terms_variance <- MCMCglmm.variance(model)
boxplot(terms_variance, horizontal = TRUE, las = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.