Learn R Programming

shallot (version 0.4.1)

nsubsets: Number of Subsets

Description

These functions either sample the number of subsets for supported partition distributions or computes probabilities, means, and variances of these distributions.

Usage

nsubsets.random(x, n.samples)
nsubsets.probability(x, n.subsets)
nsubsets.average(x)
nsubsets.variance(x)

Arguments

x

An object of class shallot.distribution.

n.samples

An integer containing the number of samples.

n.subsets

An integer containing the number of subsets.

...

Currently ignored.

Value

The nsubsets.random function returns a vector of random samples of the number of subsets in the distribution x.

The nsubsets.probability function returns the probability that the number of subsets is n.subsets in the distribution x. Depending on the number of items and the value of n.subsets, this function can be computationally intensive.

The nsubsets.average and nsubsets.variance functions return the mean and variances, respectively, of the number of subsets in the distribution x.

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

partition.distribution

Examples

Run this code
# NOT RUN {
pd <- ewens.pitman.attraction(
        mass(1),
        discount(0.05),
        attraction(permutation(n.items=50,fixed=FALSE),
          decay.exponential(temperature(1.0),dist(scale(USArrests)))))
mean(nsubsets.random(pd,1000))
nsubsets.average(pd)

pde <- ewens(mass(1),50)
nsubsets.variance(pde)
nsubsets.probability(pde,4)
# }

Run the code above in your browser using DataLab