bma: Bayesian Meta-analysis

Description Usage Arguments Details Value Examples

Description

Use a bayesian meta-analysis to create an indicator from species index values and standard error.

Usage

1
2
3
bma(data, plot = TRUE, model = "random_walk", parallel = FALSE,
  incl.model = TRUE, n.iter = 10000, m.scale = "loge",
  num.knots = 12, rescaleYr = 1, n.thin = 5, save.spindex = TRUE)

Arguments

data

a data.frame with 4 columns in this order: species, year, index, se (standard error)

plot

Logical, should a trace plot be plotted?

model

The type of model to be used. See details.

parallel

if TRUE the model chains will be run in parallel using one fewer cores than are available on the computer. NOTE: this will typically not work for parallel use on cluster PCs.

incl.model

if TRUE the model is added as an attribute of the object returned

n.iter

The number of iterations of the model to run. Defaults to 10,000 to avoid long run times though much longer runs are usually required to reach convergence

m.scale

The measurement scale of the data. The scale of the data is assumed to be logarithmic. Here you specify which log scale the data is on ('loge', 'log10', or 'logit'). Defaults to 'loge'.

num.knots

If using either of the smooth models this specifies the number of knots.

rescaleYr1

Logical, should all iterations be scaled so that the first year is equal? If TRUE year one will have 0 error.

Details

There are a number of model to choose from:

Value

Returns a dataframe with 4 columns: Year, Index, lower2.5, upper97.5. The last two columns are the credible intervals

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# Create some example data in the format required
data <- data.frame(species = rep(letters, each = 50),
                   year = rep(1:50, length(letters)),
                   index = runif(n = 50 * length(letters), min = 0, max = 1),
                   se = runif(n = 50 * length(letters), min = 0.01, max = .1))

# Run the Bayesian meta-analysis
bma_indicator <- bma(data)

# Plot the resulting indicator
plot_indicator(indicator = bma_indicator[,'Index'],
               CIs = bma_indicator[,c(3,4)])

BiologicalRecordsCentre/BRCindicators documentation built on May 6, 2019, 7:55 a.m.