Learn R Programming

mastif (version 2.3)

mastVolatility: Volatility and period for mast data, combining trees in populations

Description

Synthesis of volatility and period at the population scale.

Usage

mastVolatility( treeID, year, fec, minLength = 6, minFrequency = 1/20 )

Value

Returns a list that includes stats, which holds the period- and fecundity-weighted estimates of volatility and period at the population scale. The matrix statsDensity holds the means and standard deviations by period (1/frequency). The matrix mastMatrix holds for each tree the number of years, mean log fecundity, variance, volatility, and period mean and standard deviation. Returned as tree by frequency are density and frequency.

Arguments

treeID

vector of labels for individual trees

year

numeric vector for year

fec

numeric vector for fecundity values

minLength

determines the minimum number of years to a tree to be included in population estimates

minFrequency

lowest frequency to include in volatility, period evaluation

Author

James S Clark, jimclark@duke.edu

Details

The three vectors treeID, year, fec are aligned by tree and year and, thus, of the same length. Tree fecundity values in the numeric vector fec can differ in number of years due to maturation times, deaths, and observation years. Trees having fewer than minLength observations are omitted from the analysis. minFrequency is high enough to omit low frequencies that are missing in the shortest series to be compared.

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

References

Qiu, T, ..., and J.S. Clark. 2023. Mutualist dispersers and the global distribution of masting: mediation by climate and fertility. in review.

See Also

mastif for analysis

A more detailed vignette is can be obtained with:

browseVignettes('mastif')

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

Examples

Run this code
# \donttest{
d <- "https://github.com/jimclarkatduke/mast/blob/master/outputAbies.rdata?raw=True"
repmis::source_data( d )

# all trees in a plot:

wi  <- which( fecPred$plotSpec == 'BERK28 abiesGrandis' ) # tree-years in plot-species group
tmp <- mastVolatility( treeID = fecPred$treeID[wi], year = fecPred$year[wi], 
                       fec = fecPred$fecEstMu[wi], minLength = 10 )
period  <- 1/tmp$frequency
density <- tmp$density

plot( NA, xlim = range( period, na.rm = TRUE ), ylim = range( density, na.rm = TRUE ),
      xlab = 'Period (yr)', ylab = 'Density', log = 'xy' )
      
for( i in 1:nrow(density) )lines( period[i,], density[i, ], col = 'grey' )
  lines( tmp$statsDensity['Period', ], tmp$statsDensity['Mean', ], lwd = 2 )
# }

Run the code above in your browser using DataLab