mastPriors: Obtain prior parameter values for mastif from file

View source: R/mastifFunctions.R

mastPriorsR Documentation

Obtain prior parameter values for mastif from file

Description

Prior parameter values may be saved in a file by species or by genus. mastPriors looks for a species-level prior first. If not found, it can substutitute a genus-level prior.

Usage

  mastPriors(file, specNames, code, genus = 'NULL')

Arguments

file

character giving the path and file name where parameters are stored (see Details).

specNames

character vector if names in treeData$species.

code

character name of column holding specNames in parameter file.

genus

character name of genus held in "genus" column of parameter file.

Details

The file includes rows with genera, given in column "genus", or "species". Species rows also have an entry for genus, with the species code given in the column named code. Additional columns are names of prior parameters, including:

priorDist: mean parameter for dispersal kernel (m), related to kernel parameter u as d <- pi*sqrt(u)/2. The estimated values for these parameters are found in output$parameters$upars and output$parameters$dpars, where output is an object fitted by mastif.

minDist: the lower bound for the mean parameter d of the dispersal kernel (m).

maxDist: the upper bound for the mean parameter d of the dispersal kernel (m).

priorVDist: variance on the mean parameter for dispersal kernel (m^2). For large values, the prior distribution of d (and by variable change, u) becomes dunif(d, minDist, maxDist).

minDiam: below this diameter trees of unknown status are assumed immature (cm).

maxDiam: above this diameter trees of unknown status are assumed mature (cm).

maxFec: maximum seeds per tree per year

More detailed vignettes can be obtained with: browseVignettes('mastif')

Value

A data.frame with a row for each specNames and columns for prior parameter values. Where file contains species-level parameter values, they will be used. If a separate row in file holds genus-level parameters, with the entry for code == 'NA', then genus-level parameters will be substituted. In other words, these genus rows are default values.

Author(s)

James S Clark, jimclark@duke.edu

References

Clark, J.S., C. Nunes, and B. Tomasek. 2019. Foodwebs based on unreliable foundations: spatio-temporal masting merged with consumer movement, storage, and diet. Ecological Monographs, e01381.

See Also

mastFillCensus to fill tree census

mastif for analysis

A more detailed vignette is can be obtained with:

browseVignettes('mastif')

website 'http://sites.nicholas.duke.edu/clarklab/code/'.

Examples


d <- "https://github.com/jimclarkatduke/mast/blob/master/pinusExample.rdata?raw=True"
repmis::source_data(d)

# prior parameter values
pfile <- tempfile(fileext = '.txt')
d <- "https://github.com/jimclarkatduke/mast/blob/master/priorParameters.txt?raw=True"
download.file(d, destfile = pfile)

specNames <- c("pinuEchi","pinuRigi","pinuStro","pinuTaed","pinuVirg")
seedNames <- c(specNames, "pinuUNKN")

priorTable <- mastPriors(file = pfile, specNames, 
                         code = 'code4', genus = 'pinus')

inputs   <- list( specNames = specNames, seedNames = seedNames, 
                  treeData = treeData, seedData = seedData, 
                  xytree = xytree, xytrap = xytrap, 
                  priorTable = priorTable, seedTraits = seedTraits)

formulaRep <- as.formula( ~ diam )
formulaFec <- as.formula( ~ diam )        
  
output <- mastif(inputs = inputs, formulaFec, formulaRep,
                 ng = 1000, burnin = 400)


mastif documentation built on Feb. 16, 2023, 5:30 p.m.