TheBayesteApproach: Bayesian estimation of distribution components from...

Description Usage Arguments Details Value See Also Examples

View source: R/TheBayesteApproach.R

Description

This function performs BNN... mixture density estimation of binned antibiotic resistance data with Bayesian modeling

Usage

1

Arguments

data

vector of flat data or table of counts with groups as names

prior

an optional list of hyperparameters for prior distributions (See details how to define this list). Default is NULL.

k

optional value of how many normal components should be modeled. Default is NULL.

Details

This function can be used to estimate a BNN... mixture density from binned antibiotic resistance data. It therefore uses a Bayesian set up where it models the resistant antibiotics (ZD = 6) with a binomial component and all other non-resistant antibiotics with a mixture of normal components. The data is assumed to be rounded to integer values which minimum 6 and maximum 50. Additionally to the data, the arguments prior and k may be specified. Thereby, the argument prior must be a list containing hyperparameters for the prior distribution and k must be a value defining the number of modeled normal components. The elements of the prior list need to be named as the following:

The length of each hyperparameter can only be one, thus if one wants to use hyperparameters for the priors of μ and τ, they are used for all normal components. If the hyperparameters are not named in that way the function still runs but ignores the wrongly labeled elements of the list. In the first step the function estimates the MAPE for the binomial component. If any hyperparameter for the beta prior is defined as noted above, it will be used. Otherwise a and b are set to 1. JAGS is used for Gibbs sampling from the posterior distribution. Finally, even though hyperparameters and the prior itself are defined for τ, the MAPE for σ^2 will be estimated and returned, besides the MAPE for the μ.

If the argument k is not defined by the user, the function assumes 20 components, applies Gibbs sampling and then post-processes the outcome to determine the number of resulting components k that are filled. If the argument k is given, Gibbs sampling is applied for the given number of components k.

Finally, the function returns an object of the class 'TheBayesteApproach' which includes the estimated number of components, the MAPE parameters for the μ's and σ^2's of all normal components, the MAPE of the binomial component and the input data.

Value

An object of the S3 class 'TheBayesteApproach' which is a list including these elements:

See Also

plot.TheBayesteApproach

Examples

1
2
3
4
data("Antibiotics")
bayes.density <- TheBayesteApproach(Antibiotics)
print(bayes.density)
plot(bayes.density)

sp2019-antibiotics/ECOFFBayes documentation built on Aug. 28, 2019, 6:06 p.m.