lda_bernoulli: LDA with bernoulli entry and Stick-Breaking prior.

Description Usage Arguments Details Value Note Author(s) References See Also Examples

Description

This method implements the Latent Dirichlet Allocation with Stick-Breaking prior for bernoulli data. rlda.bernoulli works with binary data.frame.

Usage

1
2
  rlda.bernoulli(data, n_community, alpha0, alpha1, gamma,
  n_gibbs, ll_prior = TRUE, display_progress = TRUE)

Arguments

data

A binary data.frame where each row is a sampling unit (i.e. Plots, Locations, Time, etc.) and each column is a categorical type of element (i.e. Species, Firms, Issues, etc.). The elements inside this data.frame must be Zeros and Ones.

n_community

Total number of communities to return. It must be less than the total number of columns inside the data data.frame.

alpha0

Hyperparameter associated with the Beta prior Beta(alpha0, alpha1).

alpha1

Hyperparameter associated with the Beta prior Beta(alpha0, alpha1).

gamma

Hyperparameter associated with the Stick-Breaking prior.

n_gibbs

Total number of Gibbs Samples.

ll_prior

boolean scalar indicating TRUE if the log-likelihood must be computed using also the priors or FALSE otherwise.

display_progress

boolean scalar TRUE if the Progress Bar must be showed and FALSE otherwise.

Details

rlda.bernoulli uses a modified Latent Dirichlet Allocation method to construct Mixed-Membership Clusters using Bayesian Inference. The data must be a non-empty data.frame with the binaries values Zero or Ones for each variable (column) in each observation (row).

Value

A R List with three elements:

Theta

The individual probability for each observation (ex: location) belong in each cluster (ex: community). It is a matrix with dimension equal n_gibbs by nrow(data) * n_community

Phi

The individual probability for each variable (ex: Specie) belong in each cluster (ex: community). It is a matrix with dimension equal n_gibbs by ncol(data) * n_community

LogLikelihood

The vector of Log-Likelihoods compute for each Gibbs Sample.

Note

The Theta and Phi matrix can be obtained for the i-th gibbs sampling using matrix(Theta[i,], nrow = nrow(data), ncol = n_community) and matrix(Phi[i,], nrow = n_community, ncol = ncol(data)), respectively.

Author(s)

References

See Also

rlda.multinomial, rlda.binomial

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
	## Not run: 
		library(Rlda)
		# Presence
		data(presence)
		# Set seed
		set.seed(9842)
		# Hyperparameters for each prior distribution
		gamma <- 0.01
		alpha0 <- 0.01
		alpha1 <- 0.01
		# Execute the LDA for the Bernoulli entry
		res <- rlda.bernoulli(data = presence, n_community = 10,
		alpha0 = alpha0, alpha1 = alpha1, gamma = gamma,
		n_gibbs = 5000,ll_prior = TRUE, display_progress = TRUE)
	
## End(Not run)

Rlda documentation built on May 1, 2019, 7:26 p.m.

Related to lda_bernoulli in Rlda...