Learn R Programming

humanleague (version 2.3.1)

prob2IntFreq: Generate integer frequencies from discrete probabilities and an overall population.

Description

This function will generate the closest integer vector to the probabilities scaled to the population.

Usage

prob2IntFreq(pIn, pop)

Value

an integer vector of frequencies that sum to pop, and the RMS difference from the original values.

Arguments

pIn

a numeric vector of state occupation probabilities. Must sum to unity (to within double precision epsilon)

pop

the total population

Examples

Run this code
prob2IntFreq(c(0.1,0.2,0.3,0.4), 11)

Run the code above in your browser using DataLab