Create a semi-colon delimited string of probabilities to be used to define categorical data.

genCatFormula(..., n = 0)

## Arguments

... one or more numeric values to be concatenated, delimited by ";". Number of probabilities (categories) to be generated - all with equal probability.

## Value

string with multinomial probabilities.

## Details

The function accepts a number of probabilities or a value of n, but not both.

If probabilities are passed, the string that is returned depends on the nature of those probabilities. If the sum of the probabilities is less than 1, an additional category is created with the probability 1 - sum(provided probabilities). If the sum of the probabilities is equal to 1, then the number of categories is set to the number of probabilities provided. If the sum of the probabilities exceeds one (and there is more than one probability), the probabilities are standardized by dividing by the sum of the probabilities provided.

If n is provided, n probabilities are included in the string, each with a probability equal to 1/n.

## Examples

genCatFormula(0.25, 0.25, 0.50)
#> [1] "0.25;0.25;0.5"genCatFormula(1 / 3, 1 / 2)
#> Warning: Probabilities do not sum to 1. Adding category with p = 0.166666666666667#> [1] "0.333333333333333;0.5;0.166666666666667"genCatFormula(1, 2, 3)
#> Warning: Sum of probabilities > 1. Probabilities will be normalized.#> [1] "0.166666666666667;0.333333333333333;0.5"genCatFormula(n = 5)
#> [1] "0.2;0.2;0.2;0.2;0.2"