Title: | Model Multivariate Abundance and Occurence Using the Dirichlet Process Prior |
---|---|
Description: | This package provides RJMCMC samplers to make Bayesian inference for Joint Species Distribution models (JSDM) using a Dirichlet Process clustering method. The DP clustering method allows species to be grouped into functional guilds for modeling between species associations in abundance or occurence values at surveyed sites. |
Authors: | Devin S. Johnson |
Maintainer: | Devin S. Johnson <[email protected]> |
License: | CC0 |
Version: | 0.03.9002 |
Built: | 2025-01-31 04:09:36 UTC |
Source: | https://github.com/dsjohnson/multAbund |
Functions for implementing the RJMCMC estimation of multivariate abundence and occurence. These functions model multivariate abundence with latent group designations for each species. The associations between species are functions of common group membership.
Package: | multAbund |
Type: | Package |
Version: | 0.03.9001 |
Date: | March 28, 2018 |
License: | CC0 |
LazyLoad: | yes |
Devin S. Johnson
Maintainer: Devin S. Johnson <[email protected]>
target
argumentThis function uses the method of Dorazio (2009) to calculate the parameters of a gamma prior on the Dirichlet process such that the induced distribution function of the number of clusters is equal to 1/k.
get_opt_alpha_prior(n, target = NULL)
get_opt_alpha_prior(n, target = NULL)
n |
An integer representing the maximum number of groups. Typically this is the number of individuals. |
target |
The desired prior probability mass function for the number of groups. This function must return a
vector of length |
Devin S. Johnson
Dorazio, R. M. (2009) On selecting a prior for the precision parameter of Dirichlet process mixture models. Journal of Statistical Planning and Inference 139:3384-3390.
Makes the necessary lists for imput into the RJMCMC fitting functions
make_data_list( counts = NULL, occur = NULL, z_col = NULL, delta_model, X_model, sigma_model = ~1, gamma_model = ~1, data )
make_data_list( counts = NULL, occur = NULL, z_col = NULL, delta_model, X_model, sigma_model = ~1, gamma_model = ~1, data )
counts |
A character string providing the name of the column in |
occur |
A character string providing the name of the column in |
z_col |
A character string providing the name of the column in |
delta_model |
A formula decribing the variables for which delta will be the coefficients. |
X_model |
A formula giveng additional variables to be used for all groups. |
sigma_model |
A formula describing the sigma vector. Must be of the form |
gamma_model |
A formula describing the gamma vector for ZIP models |
data |
Data.frame containing counts and environmental variables |
A list containing the following elements:
counts |
The column containing count data |
occur |
The column containing occurence data |
z_col |
The column containing Gaussian response data |
H |
The environmental variables from which the clustering is based |
X |
The design matrix for the global covariates |
D |
Design matrix defining sigma_ij |
M |
Design matrix defining the gamma_ij |
data |
Data frame containing the original data |
Devin S. Johnson
Fit a Dirichlet Process random effect model for joint species distribution inference of Gaussian abundance (typically resulting from a log transformation) data using a RJMCMC procedure. THIS IS CURRENTLY A TEST FUNCTION THAT IS NOT FULLY DEVELOPED YET! IT USES A DIFFERENT VARIANCE MODEL FOR DELTA PARAMETERS.
mult_abund_norm( data_list, initial_list, prior_list, block, begin_group_update, update_omega = T, burn, iter )
mult_abund_norm( data_list, initial_list, prior_list, block, begin_group_update, update_omega = T, burn, iter )
data_list |
A named list created of data items created from user data with the
function |
initial_list |
A named list of initial values for the parameters (see details).
The functions |
prior_list |
A named list of prior distribution parameters. See details. |
block |
Number of iterations between Metropolis proposal adaptation. |
begin_group_update |
The iteration at with the group clusters begin updating. The RJMCMC often performs better when the chain is allowed to sample only the parameters before the groups begin updating. |
update_omega |
Logical. Should omega be updated or not? |
burn |
Number of burnin iterations that are discarded. |
iter |
Number of iterations retained for posterior inference. |
The prior_list
argument needs to contain the following items:
a_alpha numeric. shape parameter for gamma prior on alpha,
b_alpha numeric. scale parameter for gamma prior on alpha,
Sigma_beta_inv numeric matrix. precision matrix for global regression coefficients, beta
mu_beta numeric vector. prior mean of beta parameters
phi_omega numeric. scale for half t/normal prior on delta variance parameter (omega),
df_omega numeric. degrees of freedom for half-t prior on omega (df_omega>=50 means a half-normal will be assumed)
phi_sigma numeric. scale parameter for half-t/normal prior for sigma parameters
df_sigma numeric. degrees of freedom for sigma prior (>=50 implies half-normal will be used)
A demonstration using simulated data is available in vignette form and can be accessed
by typing vignette("simulation_demo", package="multAbund")
. The vignette demo
uses a realistic number of iterations, so, if the user decides to run the associated R
code it will take some time.
Devin S. Johnson
Fit a Dirichlet Process random effect model for joint species distribution inference of Poisson count data using a RJMCMC procedure.
mult_abund_pois( data_list, initial_list, prior_list, block, begin_group_update, burn, iter )
mult_abund_pois( data_list, initial_list, prior_list, block, begin_group_update, burn, iter )
data_list |
A named list created of data items created from user data with the
function |
initial_list |
A named list of initial values for the parameters (see details).
The functions |
prior_list |
A named list of prior parameters. See details. |
block |
Number of iterations between Metropolis proposal adaptation. |
begin_group_update |
The iteration at with the group clusters begin updating. The RJMCMC often performs better when the chain is allowed to sample only the parameters before the groups begin updating. |
burn |
Number of burnin iterations that are discarded. |
iter |
Number of iterations retained for posterior inference. |
The prior_list
argument needs to contain the following items:
a_alpha numeric. shape parameter for gamma prior on alpha,
b_alpha numeric. scale parameter for gamma prior on alpha,
Sigma_beta_inv numeric matrix. precision matrix for global regression coefficients, beta
mu_beta numeric vector. prior mean of beta parameters
phi_omega numeric. scale for half t/normal prior on delta variance parameter (omega),
df_omega numeric. degrees of freedom for half-t prior on omega (df_omega>=50 means a half-normal will be assumed)
phi_sigma numeric. scale parameter for half-t/normal prior for sigma parameters
df_sigma numeric. degrees of freedom for sigma prior (>=50 implies half-normal will be used)
A demonstration using simulated data is available in vignette form and can be accessed
by typing vignette("simulation_demo", package="multAbund")
. The vignette demo
uses a realistic number of iterations, so, if the user decides to run the associated R
code it will take some time.
Devin S. Johnson
Fit a Dirichlet Process random effect model for joint species distribution inference of binary occurence data using a RJMCMC procedure.
mult_abund_probit( data_list, prior_list, initial_list, block, begin_group_update, update_omega, burn, iter )
mult_abund_probit( data_list, prior_list, initial_list, block, begin_group_update, update_omega, burn, iter )
data_list |
A named list created of data items created from user data with the
function |
prior_list |
A named list of prior parameters. See details. |
initial_list |
A named list of initial values for the parameters (see details).
The functions |
block |
Number of iterations between Metropolis proposal adaptation. |
begin_group_update |
The iteration at with the group clusters begin updating. The RJMCMC often performs better when the chain is allowed to sample only the parameters before the groups begin updating. |
update_omega |
logical. Should omega be updated during the MCMC or remain fixed. |
burn |
Number of burnin iterations that are discarded. |
iter |
Number of iterations retained for posterior inference. |
The prior_list
argument needs to contain the following items:
a_alpha numeric. shape parameter for gamma prior on alpha,
b_alpha numeric. scale parameter for gamma prior on alpha,
Sigma_beta_inv numeric matrix. precision matrix for global regression coefficients, beta
mu_beta numeric vector. prior mean of beta parameters
phi_omega numeric. scale for half t/normal prior on delta variance parameter (omega),
df_omega numeric. degrees of freedom for half-t prior on omega (df_omega>=50 means a half-normal will be assumed)
phi_sigma numeric. scale parameter for half-t/normal prior for sigma parameters
df_sigma numeric. degrees of freedom for sigma prior (>=50 implies half-normal will be used)
Devin S. Johnson
Fit a Dirichlet Process random effect model for joint species distribution inference of Zero-Inflated Poisson count data using a RJMCMC procedure.
mult_abund_zip( data_list, initial_list, prior_list, block, begin_group_update, update_omega = T, burn, iter )
mult_abund_zip( data_list, initial_list, prior_list, block, begin_group_update, update_omega = T, burn, iter )
data_list |
A named list created of data items created from user data with the
function |
initial_list |
A named list of initial values for the parameters (see details).
The functions |
prior_list |
A named list of prior distribution parameters. See details. |
block |
Number of iterations between Metropolis proposal adaptation. |
begin_group_update |
The iteration at with the group clusters begin updating. The RJMCMC often performs better when the chain is allowed to sample only the parameters before the groups begin updating. |
update_omega |
Logical. Should omega be updated or not? |
burn |
Number of burnin iterations that are discarded. |
iter |
Number of iterations retained for posterior inference. |
The prior_list
argument needs to contain the following items:
a_alpha numeric. shape parameter for gamma prior on alpha,
b_alpha numeric. scale parameter for gamma prior on alpha,
Sigma_beta_inv numeric matrix. precision matrix for global regression coefficients, beta
mu_beta numeric vector. prior mean of beta parameters
phi_omega numeric. scale for half t/normal prior on delta variance parameter (omega),
df_omega numeric. degrees of freedom for half-t prior on omega (df_omega>=50 means a half-normal will be assumed)
phi_sigma numeric. scale parameter for half-t/normal prior for sigma parameters
df_sigma numeric. degrees of freedom for sigma prior (>=50 implies half-normal will be used)
A demonstration using simulated data is available in vignette form and can be accessed
by typing vignette("simulation_demo", package="multAbund")
. The vignette demo
uses a realistic number of iterations, so, if the user decides to run the associated R
code it will take some time.
Devin S. Johnson
Users can view an .html file that contains an example with simulated abundance data. The demo is similar to a vigette but it takes much too long to build.
view_example()
view_example()
Devin S. Johnson