MCMCglmm.subsets: MCMCglmm.subsets

View source: R/MCMCglmm.subsets.R

MCMCglmm.subsetsR Documentation

MCMCglmm.subsets

Description

Creating a dispRity object from a MCMCglmm posterior output

Usage

MCMCglmm.subsets(
  data,
  posteriors,
  group,
  tree,
  rename.groups,
  set.loc = TRUE,
  ...
)

Arguments

data

The data.frame or matrix used for the MCMCglmm model.

posteriors

A MCMCglmm object, the posteriors of the model.

group

Optional, a named vector of which group to include from the posteriors (if left empty the random and residual terms are used). See details.

tree

Optional, the tree(s) used in the MCMCglmm analyses.

rename.groups

Optional, a vector of group names for renaming them. See details.

set.loc

Optional, if no location is available for a subset ($Sol = 0), set the location of the subset from data (the centroid of the group) (default is TRUE).

...

Optional arguments to be passed to MCMCglmm.covars.

Details

  • For the group option, the group names must be ones found in the posteriors formula in the format <Type = Term:FactorLevel> as returned by MCMCglmm.levels(posteriors). For example, for returning two random effect, the phylogenetic one ("animal") and one for a specific clade (say the 2nd clade) as well as two residual terms for a specific factor (say level 1 and 4) you can use group = c(random = "animal", random = "animal:clade2", residual = "units:myfactor1", residual = "units:myfactor4").

  • For the rename.groups option, the vector must be of class "character" and must of the same length as the number of random and residual terms in posteriors or of group argument (if used). If the group argument is left empty, the groups are extracted from the posteriors in the following order: the random terms first then the residual terms as specified in the posteriors object formulas (respectively posteriors$Random$formula and posteriors$Residual$formula).

NOTE that the output dispRity inherits the dimensions used in the posteriors argument. You can always check the selected dimensions using: data$call$dimensions

Author(s)

Thomas Guillerme

See Also

dispRity covar.plot

Examples

data(charadriiformes)

## Creating a dispRity object from the charadriiformes model
MCMCglmm.subsets(data       = charadriiformes$data,
                 posteriors = charadriiformes$posteriors)

## Same but selecting only the three first random terms
MCMCglmm.subsets(data       = charadriiformes$data,
                 posteriors = charadriiformes$posteriors,
                 tree       = charadriiformes$tree,
                 group      = MCMCglmm.levels(
                                 charadriiformes$posteriors)[1:3],
                 rename.groups = c("gulls", "plovers", "sandpipers"))



TGuillerme/dispRity documentation built on Dec. 21, 2024, 4:05 a.m.