ranef.MCMCglmm: Extract random effects from an 'MCMCglmm' object

Description Usage Arguments Value See Also Examples

View source: R/extraction.R

Description

Function designed to extract the random effects from an MCMCglmm model object. Can either extract all samples from the random effects posteriors or return the posterior means.

Usage

1
2
3
  ## S3 method for class 'MCMCglmm'
 ranef(object, use = c("all", "mean"),
    ...)

Arguments

object

An MCMCglmm model object to extract the effects from

use

A character string indicating whether to extract all posterior samples or the mean of the posteriors. Defaults to "all".

...

Arguments passed on to the worker function.

Value

A matrix of the fixed effects

See Also

fixef.MCMCglmm

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Not run: 
  # a simple MCMCglmm model
  data(PlodiaPO)
  m <- MCMCglmm(PO ~ 1, random= ~ FSfamily, data=PlodiaPO, pr=TRUE, verbose=FALSE)

  # only extract average fixed effects
  head(ranef(m, use = "mean"))

  # histogram of posterior samples of fixed effects
  hist(ranef(m)[1, ])
  # matches the mean
  rowMeans(ranef(m)[1:6, ])

## End(Not run)

JWiley/postMCMCglmm documentation built on May 7, 2019, 10:15 a.m.