sampleFeatureAllocation {aibd}R Documentation

Sample from a Feature Allocation Distribution

Description

This function obtains a sample from a previously defined feature allocation distribution object using wither the ibp or the aibd functions.

Usage

sampleFeatureAllocation(
  nSamples,
  distribution,
  implementation = "scala",
  parallel = TRUE
)

Arguments

nSamples

An integer giving the number of samples

distribution

A feature allocation distribution object as defined in the functions aibd or ibp.

implementation

The default of "scala" should be used. The "R" option is not a supported implementation.

parallel

Whether multiple cores should be used to generate the samples.

Value

A list of feature allocation matrices sampled from the supplied distribution.

Examples

 # Regardless of size, the initial warmup can exceed CRAN's 5 seconds threshold
d1 <- ibp(1,4)

states <- c("California","Wisconsin","Nebraska","New York")
data <- USArrests[states,]
dist <- dist(scale(data))
d2 <- aibd(1, seq_along(states), 1.0, dist)

samples_ibp <- sampleFeatureAllocation(10, d1, parallel=FALSE)
samples_aibd <- sampleFeatureAllocation(15, d2, parallel=FALSE)



[Package aibd version 0.1.9 Index]