Learn R Programming

humanleague (version 2.0.2)

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)

Arguments

pIn

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

pop

the total population

Value

an integer vector of frequencies that sums to pop.

Examples

Run this code
# NOT RUN {
prob2IntFreq(c(0.1,0.2,0.3,0.4), 11)
# }

Run the code above in your browser using DataLab