plotBeta: plotBeta

View source: R/plotBeta.R

plotBetaR Documentation

plotBeta

Description

Plots heatmaps of parameter estimates or posterior support values of species' environmental responses, i.e. how species in Y responds to covariates in X

Usage

plotBeta(
  hM,
  post,
  param = "Support",
  plotTree = FALSE,
  SpeciesOrder = "Original",
  SpVector = NULL,
  covOrder = "Original",
  covVector = NULL,
  spNamesNumbers = c(TRUE, TRUE),
  covNamesNumbers = c(TRUE, TRUE),
  supportLevel = 0.9,
  split = 0.3,
  cex = c(0.7, 0.7, 0.8),
  colors = colorRampPalette(c("blue", "white", "red")),
  colorLevels = NULL,
  mar = NULL,
  marTree = c(6, 0, 2, 0),
  mgp = c(3, 2, 0),
  main = NULL,
  smallplot = NULL,
  bigplot = NULL,
  newplot = TRUE
)

Arguments

hM

a fitted Hmsc model object

post

posterior summary of Beta parameters obtained from getPostEstimate

param

controls which parameter is plotted, current options include "Mean" for posterior mean estimate, "Support" for the level of statistical support measured by posterior probability for a positive or negative response, and "Sign" to indicate whether the response is positive, negative, or neither of these given the chosen supportLevel

plotTree

logical. Whether species' environmental responses is to be mapped onto the phylogeny used in model fitting

SpeciesOrder

controls the ordering of species, current options are "Original", "Tree", and "Vector". If SpeciesOrder = "Vector", an ordering vector must be provided (see SpVector). If plotTree = TRUE, SpeciesOrder is ignored

SpVector

controls the ordering of species if SpeciesOrder = "Vector". If a subset of species are listed, only those will be plotted. For alphabetic ordering, try match(1:hM$ns, as.numeric(as.factor(colnames(hM$Y))))

covOrder

controls the ordering of covariates, current options are "Original" and "Vector". If covOrder = "Vector", an ordering vector must be provided (see covVector)

covVector

controls the ordering of covariates if covOrder = "Vector". If a subset of covariates are listed, only those will be plotted

spNamesNumbers

logical of length 2, where first entry controls whether species names are added to axes, and second entry controls whether species numbers are added

covNamesNumbers

logical of length 2, where first entry controls whether covariate names are added to axes, and second entry controls whether covariate numbers are added

supportLevel

controls threshold posterior support for plotting

split

if plotTree = TRUE, controls the division of the plotting window between the tree and the heatmap.

cex

controls character expansion (font size). Three values, controlling covariate names, species names, and color legend axis labels

colors

controls the colors of the heatmap, default value colorRampPalette(c("blue","white","red"))

colorLevels

number of color levels used in the heatmap

mar

plotting margins

marTree

plotting margins for phylogenetic tree

mgp

can be used to set the location of the scale bar

main

main title for the plot.

smallplot

passed to image.plot

bigplot

passed to image.plot

newplot

set to false if the plot will be part of multi-panel plot initialized with par(mfrow)

Examples

# Plot posterior support values of species' environmental responses
betaPost=getPostEstimate(TD$m, "Beta")
plotBeta(TD$m, post=betaPost, param="Support")

# Plot parameter estimates of species' environmental responses together with the phylogenetic tree
betaPost=getPostEstimate(TD$m, "Beta")
plotBeta(TD$m, post=betaPost, param="Mean", plotTree=TRUE)


Hmsc documentation built on Aug. 11, 2022, 5:11 p.m.