# NOT RUN {
## Basics:
comp_prob_freq() # => computes prob from current freq
## Beware of rounding:
all.equal(prob, comp_prob_freq()) # => would be TRUE (IF freq were NOT rounded)!
fe <- comp_freq(round = FALSE) # compute exact freq (not rounded)
all.equal(prob, comp_prob_freq(fe$hi, fe$mi, fe$fa, fe$cr)) # is TRUE (qed).
## Explain by circular chain (compute prob 1. from num and 2. from freq)
# 0. Inspect current numeric parameters:
num
# 1. Compute currently 11 probabilities in prob (from essential probabilities):
prob <- comp_prob()
prob
# 2. Compute currently 11 frequencies in freq (from essential probabilities):
freq <- comp_freq(round = FALSE) # no rounding (to obtain same probabilities later)
freq
# 3. Compute currently 11 probabilities again (but now from frequencies):
prob_freq <- comp_prob_freq()
prob_freq
# 4. Check equality of probabilities (in steps 1. and 3.):
all.equal(prob, prob_freq) # => should be TRUE!
# }
Run the code above in your browser using DataCamp Workspace