Description Details Fields Methods Examples

This class implements the main functionality of this package. The consturctor receives a numeric vector (Y) and priors. A model should be provided specifying the distributions to be used for inference (e.g. NormalModel for Normal distributions or GammaModel for Gamma distributions). Then an MCMC algorithm will be used to infer a number of distributions (k) that fit the data. The prior for the number of distributions is specified by the concentration_parameter_alpha and expected_k. Once the data and priors are specified the method run is used to start the inference.

Class dppMCMC_C
Class `dppMCMC_C`

A Reference Class that provides DPP functionality

`dpp_mcmc_object`

a DPPmcmc object

`getNumCategoryProbabilities(burnin_cutoff = 0.25)`

returns the probabilities vector for inferred number of categories

`getNumCategoryTrace(burnin_cutoff = 0.25)`

returns the trace vector for the inferred number of categories in the data

`initialize(data, output, model, num_auxiliary_tables = 4, expected_k = 2, power = 1, verbose = TRUE, sample.num.clusters = TRUE)`

the class constructor, initializes DPPmcmc object with data and parameters

`run(generations, sample_freq = generations/1000, log_file, allocation_file, param_file, append = TRUE, random = FALSE, auto_stop = FALSE, min_ess = 500, max_gen = 1e+05)`

starts the MCMC run

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | ```
normal.model<-new(NormalModel,
mean_prior_mean=0.5,
mean_prior_sd=0.1,
sd_prior_shape=3,
sd_prior_rate=20,
estimate_concentration_parameter=TRUE,
concentration_parameter_alpha=10,
proposal_disturbance_sd=0.1)
#simulating three normal distributions
y <- c(rnorm(100,mean=0.2,sd=0.05), rnorm(100,0.7,0.05), rnorm(100,1.3,0.1))
hist(y,breaks=30)
#setwd("~/yourwd") #mcmc log files will be saved here
## Not run:
my_dpp_analysis <- dppMCMC_C(data=y,
output = "output_prefix_",
model=normal.model,
num_auxiliary_tables=4,
expected_k=1.5,
power=1)
#running the mcmc , generations will be ignored because auto_stop=true
my_dpp_analysis$run(generations=1000,auto_stop=TRUE,max_gen = 10000,min_ess = 500)
#we get rid of the first 25% of the output (burn-in)
hist(my_dpp_analysis$getNumCategoryTrace(0.25))
my_dpp_analysis$getNumCategoryProbabilities(0.25)
## End(Not run)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.