• Skip to primary navigation
  • Skip to content
  • Skip to footer
Higher Order Functions
  • Posts
  • Notes
  • About Me
  • CV

    Sampling from a multinomial with sample()

    drob dropped this tweet:

    sample() takes a prob argument, so you can skip rmultinom entirely!

    sample(n_comp, n, prob = mixture_probs, replace = TRUE)

    — David Robinson (@drob) October 27, 2021

    Tags: probability, r, simulation

    Posted: January 1, 2022

    Previous Next

    Leave a comment

    • Home
    • Follow:
    • Bluesky
    • GitHub
    • Feed
    © 2026 Tristan Mahr. Powered by Jekyll & Minimal Mistakes.