rand_partitions: Generate uniform random partitions of Q having N parts.

Description Usage Arguments Value Note Examples

View source: R/rpartitions.R

Description

Generate uniform random partitions of Q having N parts.

Usage

1
2
3
  rand_partitions(Q, N, sample_size, method = "best",
    D = hash(), zeros = FALSE, use_c = TRUE,
    use_hash = FALSE)

Arguments

Q

Total sum across parts

N

Number of parts to sum over

sample_size

number of random partitions to generate

method

: method to use for generating the partition, options include: 'bottom_up', 'top_down', 'divide_and_conquer', 'multiplicity', and 'best'. Defaults to 'best'

D

a dictionary for the number of partitions of Q having N or less parts (or N or less as the largest part), i.e. P(Q, Q + N). Defaults to a blank dictionary.

zeros

boolean if True partitions can have zero values, if False partitions have only positive values, defaults to False

use_c

boolean if TRUE then compiled c code is used, defaults to TRUE

use_hash

boolean, if TRUE then a hash table is used, defaults to FALSE

Value

A matrix where each column is a random partition

Note

method 'best' attempts to use the values of Q and N to infer what the fastest method to compute the partition.

if zeros are allowed, then we must ask whether Q >= N. if not, then the total Q is partitioned among a greater number of parts than there are, say, individuals. In which case, some parts must be zero. A random partition would then be any random partition of Q with zeros appended at the end. But, if Q >= N, then Q is partitioned among less number of parts than there are individuals. In which case, a random partition would be any random partition of Q having N or less parts.

Examples

1
rand_partitions(100, 10, 5)

rpartitions documentation built on May 1, 2019, 8:03 p.m.