Learn R Programming

shallot (version 0.4.1)

shallot-package: Random Partition Distribution Indexed by Pairwise Information

Description

This package implements models described in the paper Dahl, D. B., Day, R., and Tsai, J. (2017), Random Partition Distribution Indexed by Pairwise Information, Journal of the American Statistical Association, accepted. The Ewens, Ewens-Pitman, Ewens attraction, Ewens-Pitman attraction, and ddCRP distributions are available for prior simulation. We hope in the future to add posterior simulation with a user-supplied likelihood. Supporting functions for partition estimation and plotting are also planned.

Arguments

References

Dahl, D. B., Day, R., and Tsai, J. (2017), Random Partition Distribution Indexed by Pairwise Information, Journal of the American Statistical Association, accepted. <DOI:10.1080/01621459.2016.1165103>

See Also

ewens.pitman.attraction, sample.partitions, estimate.partition, confidence

Examples

Run this code
# NOT RUN {
data <- iris[,-ncol(iris)]
truth <- as.integer(iris[,ncol(iris)])
distance <- as.dist(as.matrix(dist(scale(data))+0.001))

decay <- decay.exponential(temperature(9.0, fixed=TRUE), distance)
permutation <- permutation(n.items=nrow(data), fixed = FALSE)
attraction <- attraction(permutation, decay)
mass <- mass(1.0, fixed = TRUE)
discount <- discount(0.2, fixed = TRUE)
distribution <- ewens.pitman.attraction(mass, discount, attraction)

raw <- sample.partitions(distribution, 500, parallel=FALSE)
samples <- process.samples(raw,as.matrix=TRUE)

est <- estimate.partition(raw,max.subsets=3,max.scans=0, parallel=FALSE)
pp <- pairwise.probabilities(raw, parallel=FALSE)

conf <- confidence(pp,est)
plot(conf)
plot(conf,data=data)
adj.rand.index(est,truth)
# }

Run the code above in your browser using DataLab