Learn R Programming

tRophicPosition (version 0.7.5)

getPosteriorMode: Function to get mode from a posterior distribution

Description

This function is a wrapper of hdr, it returns one mode (if receives a vector), otherwise it returns a list of modes (if receives a list of vectors). If receives an mcmc object it returns the marginal parameter mode using Kernel density estimation (posterior.mode).

Usage

getPosteriorMode(df = NULL, round = 3)

Arguments

df

data frame, list or vector with posterior distribution(s).

round

numeric, number of decimals rounded.

Value

a vector or a list of modes

Examples

Run this code
# NOT RUN {
# List example
a <- list("First" = rnorm(100,1), "Second" = rnorm(100,2))
getPosteriorMode(a)

# vector example
getPosteriorMode(rnorm(100,5), round = 2)
# }

Run the code above in your browser using DataLab