http://www.perlmonks.org?node_id=814544


in reply to Re^6: Random sampling a variable length file.
in thread Random sampling a variable record-length file.

...Just as the polster might discover that the "random selection" they make of the populous, happens to coincidentally consist of the entire membership of some extremist political organisation, they cannot know it will until they take the sample.

A valid sample may contain every member of an extremist group or only contain records whose lengths are even numbers. What makes the sample valid is the plan for selecting the sample (and adherence to that plan). Developing a sampling plan is non-trivial. It can be aided by things we know theoretically and by observational data. But sometimes you just get atypical samples.

In this case, I was confused by your statement in another response that "there is no meaningful correlation in the ordering of the records." This sounds like a positive assertion that there is no correlation based on order. This is quite different from the negative assertion that you don't know whether there are order related correlations.

Replies are listed 'Best First'.
Re^8: Random sampling a variable length file.
by BrowserUk (Patriarch) on Dec 27, 2009 at 22:04 UTC
    This sounds like a positive assertion that there is no correlation based on order. This is quite different from the negative assertion that you don't know whether there are order related correlations.

    I disagree. I cannot know if there is any correlation in the ordering of the records, therefore, for my purposes, there is no such correlation.

    Put another way, I am constructing an algorithm to process unknown data, and therefore must construct it on the basis that there is no such correlation.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
      If you assume any correlation in the ordering of the records, why not to pick, for instance, the first 1000 records?

        Because there might be (for example) a time-related correlation. If the file in question were a log file running midnight to midnight, it's possible that there might be less activity at either end of the day than in the middle.

        Or (for example), the file might have been previously ordered in some way that means the longer records are at the front and shorter at the end.

        Whilst it is possible that a random selection picked across the length of any given file might pick all the longest (or shortest), it is far,far less likely, than likely. That's why you pick a random sample.

        It is the whole basis of normal distributions, the 68-95-99.7 rule, and the associated statistics.


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.