Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

This is more of a math question than a Perl question, but I know there are monks with far greater math skills than I, and I hope to pick their brains.

Here's the question:

I have the population figures for several entities. What I am looking for is the probability of a given sample of entities occurring at random. Update: As the first response below demonstrates, I have not been sufficiently clear. I'm looking for a the likelyhood of getting a random sample of seven entities (or however many specified) from the total population represented by the population numbers provided. The order of the sample doesn't matter, just that it has those entities in the stipulated proportions. Some pseudocode:

#!/usr/bin/perl use strict; use warnings; # Population numbers my $entity1 = 35000 my $entity2 = 41000 my $entity3 = 16000 my $entity4 = 18000 my $entity5 = 21000 my $entity6 = 45000 my $entity7 = 27000 my $entity8 = 10000 my $entity9 = 16000 # Sample constituents my @sample = ($entity9,$entity9,$entity4,$entity2,$entity6,$entity1,$e +ntity1) sub probability { # Return the probability of @sample occurring at random based on the # populations declared }

I would be perfectly happy if someone could show me how to do the math, and I can do the Perl, although seeing how to do the math in Perl would be great too. Thanks.


In reply to Sample Probabilities by willyyam

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2024-03-28 23:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found