The Naked Scientists
  • Login
  • Register
  • Podcasts
      • The Naked Scientists
      • eLife
      • Naked Genetics
      • Naked Astronomy
      • In short
      • Naked Neuroscience
      • Ask! The Naked Scientists
      • Question of the Week
      • Archive
      • Video
      • SUBSCRIBE to our Podcasts
  • Articles
      • Science News
      • Features
      • Interviews
      • Answers to Science Questions
  • Get Naked
      • Donate
      • Do an Experiment
      • Science Forum
      • Ask a Question
  • About
      • Meet the team
      • Our Sponsors
      • Site Map
      • Contact us

User menu

  • Login
  • Register
  • Home
  • Help
  • Search
  • Tags
  • Member Map
  • Recent Topics
  • Login
  • Register
  1. Naked Science Forum
  2. General Discussion & Feedback
  3. Just Chat!
  4. What do you mean by "random"?
« previous next »
  • Print
Pages: [1] 2   Go Down

What do you mean by "random"?

  • 27 Replies
  • 2577 Views
  • 0 Tags

0 Members and 1 Guest are viewing this topic.

Online alancalverd (OP)

  • Global Moderator
  • Naked Science Forum GOD!
  • ********
  • 14820
  • Activity:
    100%
  • Thanked: 1120 times
  • life is too short to drink instant coffee
    • View Profile
What do you mean by "random"?
« on: 03/07/2021 18:22:24 »
Common problem: I need to traceably randomise 100 patients for a clinical trial. So as they are recruited, I assign each one a random number from 00 to 99, then, say, give the trial drug to those with odd numbers and the placebo to the evens.How do I generate those random numbers?

A. Take two 10-sided dice, one numbered 0 to 9 and the other, 00 to 90. Roll the dice and there's a random two-digit integer for each patient, with a 1 in 100 chance of it being any value from 00 to 99.

B. put 100 counters in a hat, give it a good shake, draw one at a time and discard it: same probability of it being any value from 00 to 99.

What is the probability that I will assign a given number to two patients?  In case A, almost 1. In case B, zero.

In case A I cannot guess what the next number will be, so that's really random. In case B, my guess will become more accurate as the numbers are assigned, and I know exactly what the 100th number will be, so it's not quite as random.

It all depends on what you mean by "random".
Logged
helping to stem the tide of ignorance
 



Offline Bored chemist

  • Naked Science Forum GOD!
  • *******
  • 27780
  • Activity:
    98.5%
  • Thanked: 933 times
    • View Profile
Re: What do you mean by "random"?
« Reply #1 on: 03/07/2021 18:41:06 »
Or you could just toss a coin for each patient.
If you are concerned that your coin may be balanced, toss it twice.
If you get HH or TT toss twice more (repeatedly if needs be).
If you get HT then assign them to the placebo group, if you get TH assign them to the treatment group.

There's no  guarantee that the number in each group will be the same, but it will probably be close.
In reality, I suspect everyone uses excel.
Logged
Please disregard all previous signatures.
 

Offline hamdani yusuf

  • Naked Science Forum King!
  • ******
  • 5086
  • Activity:
    78%
  • Thanked: 183 times
    • View Profile
Re: What do you mean by "random"?
« Reply #2 on: 03/07/2021 22:40:02 »
Quote from: Bored chemist on 03/07/2021 18:41:06
Or you could just toss a coin for each patient.
If you are concerned that your coin may be balanced, toss it twice.
If you get HH or TT toss twice more (repeatedly if needs be).
If you get HT then assign them to the placebo group, if you get TH assign them to the treatment group.
If the first coin is biased towards head, or the second coin is biased towards tail, then the patient is more likely to get placebo, and vice versa.
Logged
Unexpected results come from false assumptions.
 

Online alancalverd (OP)

  • Global Moderator
  • Naked Science Forum GOD!
  • ********
  • 14820
  • Activity:
    100%
  • Thanked: 1120 times
  • life is too short to drink instant coffee
    • View Profile
Re: What do you mean by "random"?
« Reply #3 on: 03/07/2021 23:47:32 »
The specific application isn't the point. It is to demonstrate that of two ways of generating a set of random numbers, one is almost certain to produce duplicates but with no possibility of predicting anything about the remainder of the set, whilst the other cannot produce duplicates and increasingly gives you information about the remainder to the point that you can predict the last number with absolute certainty.

3-way randomisation is sometimes used e.g. to investigate superiority or tolerability between treatments X, Y and placebo. Coin tossing becomes more difficult, but it's easy with a random number table because one third will be divisible by 3, one third by 2 but not 3, and one third not divisible by 2 or 3. But the problem remains as to what you mean by "random".

Research protocols usually refer to an unnamed "computer program that generates random numbers", and as far as I am concerned a set of 2-digit integers generated by Excel RAND is indeed adequately random, but you still need to filter out duplicates.
« Last Edit: 03/07/2021 23:59:13 by alancalverd »
Logged
helping to stem the tide of ignorance
 

Offline Petrochemicals

  • Naked Science Forum King!
  • ******
  • 2604
  • Activity:
    25%
  • Thanked: 97 times
  • forum overlord
    • View Profile
Re: What do you mean by "random"?
« Reply #4 on: 04/07/2021 00:03:07 »
That the numbers 1, 2, 3, 4, 5, 6, can win the lottery, every week since its inception just as easily as the string of numbers that has followed for the last 25 years.
Logged
For reasons of repetitive antagonism, this user is currently not responding to messages from;
BoredChemist
To ignore someone too, go to your profile settings>modifyprofie>ignore!
 



Offline Eternal Student

  • Naked Science Forum King!
  • ******
  • 1116
  • Activity:
    10%
  • Thanked: 219 times
    • View Profile
Re: What do you mean by "random"?
« Reply #5 on: 04/07/2021 20:44:28 »
Hi.

    Go with the counters in a hat concept.  It's easier.
    It's random at the time when you first started (before pulling any counters).  It doesn't really matter if you know more as the process continues.   Nothing is random after observations have been made and information is available, then it's just a fact not a random variable with an associated probability distribution.  For example the result of a coin toss I made yesterday is not random, it's outcome is an established fact.   The outcome of yesterday's coin toss is never going to be random ever again.
   Just make sure you go through with the selection - don't interfere with it near the end (for example, it would be quite human to give everyone a chance to be in the active group rather than the placebo group and you could do this by tampering with the process to keep at least one active group counter in the bag at all times).
    Randomise the outcomes twice, so that you can't know what will happen.  You can have the hat and the counters but all you're doing is assigning people to group A or group B with no way of knowing which will be the placebo or the active treatment group.  Someone else will decide which group is the placebo by some other method (e.g. tossing a coin) and they should not be informed of who was put into which group.   Keep all records of the random outcomes locked away until it becomes necessary to trace a patient.

     Discussing the true nature of proability and randomness could take a long time and there are chapters on this in most good books about probability.  I'm sure you know this already.
Logged
 

Offline Bored chemist

  • Naked Science Forum GOD!
  • *******
  • 27780
  • Activity:
    98.5%
  • Thanked: 933 times
    • View Profile
Re: What do you mean by "random"?
« Reply #6 on: 04/07/2021 22:43:17 »
Quote from: hamdani yusuf on 03/07/2021 22:40:02
Quote from: Bored chemist on 03/07/2021 18:41:06
Or you could just toss a coin for each patient.
If you are concerned that your coin may be balanced, toss it twice.
If you get HH or TT toss twice more (repeatedly if needs be).
If you get HT then assign them to the placebo group, if you get TH assign them to the treatment group.
If the first coin is biased towards head, or the second coin is biased towards tail, then the patient is more likely to get placebo, and vice versa.
Did you notice that I said "coin" not "coins"?

It's not me you are arguing with
"John von Neumann invented a simple algorithm to fix simple bias and reduce correlation. It considers two bits at a time (non-overlapping), taking one of three actions: when two successive bits are equal, they are discarded; a sequence of 1,0 becomes a 1; and a sequence of 0,1 becomes a zero. It thus represents a falling edge with a 1, and a rising edge with a 0. This eliminates simple bias, and is easy to implement as a computer program or in digital logic. This technique works no matter how the bits have been generated."

From
https://en.wikipedia.org/wiki/Hardware_random_number_generator#Software_whitening
Logged
Please disregard all previous signatures.
 
The following users thanked this post: hamdani yusuf

Offline Bored chemist

  • Naked Science Forum GOD!
  • *******
  • 27780
  • Activity:
    98.5%
  • Thanked: 933 times
    • View Profile
Re: What do you mean by "random"?
« Reply #7 on: 04/07/2021 22:51:53 »
Quote from: alancalverd on 03/07/2021 23:47:32
as far as I am concerned a set of 2-digit integers generated by Excel RAND is indeed adequately random, but you still need to filter out duplicates.
No you don't.
You put the numbers 0 to 99 in a column, Put random numbers into the next column and then sort both columns by the random number
Then you use the top haul of the first column as your "treatment" group and the bottom half as your "placebo" group.

If you want to split them into 3 you can do the same thing (as long as your numbers of patients is divisible by 3).


Quote from: alancalverd on 03/07/2021 23:47:32
but it's easy with a random number table because one third will be divisible by 3, one third by 2 but not 3, and one third not divisible by 2 or 3.
More generally, you can split them into n sub groups by finding the remainder when you divide by n
So, for example, if you divide by 4 the remainders are 0, 1, 2 or 3.
« Last Edit: 05/07/2021 08:31:57 by Bored chemist »
Logged
Please disregard all previous signatures.
 

Offline hamdani yusuf

  • Naked Science Forum King!
  • ******
  • 5086
  • Activity:
    78%
  • Thanked: 183 times
    • View Profile
Re: What do you mean by "random"?
« Reply #8 on: 05/07/2021 06:09:43 »
Quote from: Bored chemist on 04/07/2021 22:43:17
Quote from: hamdani yusuf on 03/07/2021 22:40:02
Quote from: Bored chemist on 03/07/2021 18:41:06
Or you could just toss a coin for each patient.
If you are concerned that your coin may be balanced, toss it twice.
If you get HH or TT toss twice more (repeatedly if needs be).
If you get HT then assign them to the placebo group, if you get TH assign them to the treatment group.
If the first coin is biased towards head, or the second coin is biased towards tail, then the patient is more likely to get placebo, and vice versa.
Did you notice that I said "coin" not "coins"?

It's not me you are arguing with
"John von Neumann invented a simple algorithm to fix simple bias and reduce correlation. It considers two bits at a time (non-overlapping), taking one of three actions: when two successive bits are equal, they are discarded; a sequence of 1,0 becomes a 1; and a sequence of 0,1 becomes a zero. It thus represents a falling edge with a 1, and a rising edge with a 0. This eliminates simple bias, and is easy to implement as a computer program or in digital logic. This technique works no matter how the bits have been generated."

From
https://en.wikipedia.org/wiki/Hardware_random_number_generator#Software_whitening

I'm sorry for missing the first sentences.
What would happen if the coin has a strong tendency to flip from the last toss? I think it can be done using a simple mechanism.
Logged
Unexpected results come from false assumptions.
 



Offline Bored chemist

  • Naked Science Forum GOD!
  • *******
  • 27780
  • Activity:
    98.5%
  • Thanked: 933 times
    • View Profile
Re: What do you mean by "random"?
« Reply #9 on: 05/07/2021 08:33:10 »
Quote from: hamdani yusuf on 05/07/2021 06:09:43
What would happen if the coin has a strong tendency to flip from the last toss?
Then it would be cheating to use it.
(and it probably wouldn't be a coin).
Logged
Please disregard all previous signatures.
 

Online alancalverd (OP)

  • Global Moderator
  • Naked Science Forum GOD!
  • ********
  • 14820
  • Activity:
    100%
  • Thanked: 1120 times
  • life is too short to drink instant coffee
    • View Profile
Re: What do you mean by "random"?
« Reply #10 on: 05/07/2021 22:16:41 »
Quote from: Bored chemist on 04/07/2021 22:51:53
Put random numbers into the next column and then sort both columns by the random number
As Mrs Beeton said, "first catch your rabbit..."

Slightly off the subject (as always) when cooking with my chef son, he once told me to "Just....." and I asked "what exactly do you mean by "just" to which he replied "study and practice for 20 years, then just...." So, to construct 100 random numbers, start with a random number table, then just.....
Logged
helping to stem the tide of ignorance
 

Offline Bored chemist

  • Naked Science Forum GOD!
  • *******
  • 27780
  • Activity:
    98.5%
  • Thanked: 933 times
    • View Profile
Re: What do you mean by "random"?
« Reply #11 on: 05/07/2021 22:25:33 »
Quote from: alancalverd on 05/07/2021 22:16:41
Quote from: Bored chemist on 04/07/2021 22:51:53
Put random numbers into the next column and then sort both columns by the random number
As Mrs Beeton said, "first catch your rabbit..."

Slightly off the subject (as always) when cooking with my chef son, he once told me to "Just....." and I asked "what exactly do you mean by "just" to which he replied "study and practice for 20 years, then just...." So, to construct 100 random numbers, start with a random number table, then just.....
no, just put random numbers in tte h2nd column.
Like you said
Quote from: alancalverd on 03/07/2021 23:47:32
and as far as I am concerned a set of 2-digit integers generated by Excel RAND is indeed adequately random,
Logged
Please disregard all previous signatures.
 

Offline Eternal Student

  • Naked Science Forum King!
  • ******
  • 1116
  • Activity:
    10%
  • Thanked: 219 times
    • View Profile
Re: What do you mean by "random"?
« Reply #12 on: 05/07/2021 23:27:19 »
Hi.

There's no interesting discussions going on today, so I'm joining this one.
An old view is to claim that nothing in nature is random.   Probability doesn't exist in nature, it's just an abstract mathematical concept.   There are mathematical objects that are random variables but nature does not have any such variables within it.   

    However, Quantum Mechanics presents some evidence that probability is something inherently found in nature.  So the answer to your problem is simple.   Go down to the Physics lab and get their experimental set up of an electron being fired through some slits and impacting on a screen at the end.   Draw a score board on the screen (like a darts board) and have a few games of quantum darts to generate some random numbers.
Logged
 



Offline hamdani yusuf

  • Naked Science Forum King!
  • ******
  • 5086
  • Activity:
    78%
  • Thanked: 183 times
    • View Profile
Re: What do you mean by "random"?
« Reply #13 on: 08/07/2021 05:10:40 »
Quote from: Eternal Student on 05/07/2021 23:27:19
However, Quantum Mechanics presents some evidence that probability is something inherently found in nature.  So the answer to your problem is simple.   Go down to the Physics lab and get their experimental set up of an electron being fired through some slits and impacting on a screen at the end.   Draw a score board on the screen (like a darts board) and have a few games of quantum darts to generate some random numbers.
Newest experiment shows that quantum jump can be sensed before actually occuring. It can even be canceled. It's not instantaneous.
Logged
Unexpected results come from false assumptions.
 

Offline Europa

  • Sr. Member
  • ****
  • 208
  • Activity:
    0%
  • Thanked: 2 times
  • Naked Science Forum Newbie
    • View Profile
Re: What do you mean by "random"?
« Reply #14 on: 21/07/2021 15:01:50 »
Quote from: alancalverd on 03/07/2021 18:22:24
Common problem: I need to traceably randomise 100 patients for a clinical trial. So as they are recruited, I assign each one a random number from 00 to 99, then, say, give the trial drug to those with odd numbers and the placebo to the evens.How do I generate those random numbers?

A. Take two 10-sided dice, one numbered 0 to 9 and the other, 00 to 90. Roll the dice and there's a random two-digit integer for each patient, with a 1 in 100 chance of it being any value from 00 to 99.

B. put 100 counters in a hat, give it a good shake, draw one at a time and discard it: same probability of it being any value from 00 to 99.

What is the probability that I will assign a given number to two patients?  In case A, almost 1. In case B, zero.

In case A I cannot guess what the next number will be, so that's really random. In case B, my guess will become more accurate as the numbers are assigned, and I know exactly what the 100th number will be, so it's not quite as random.

It all depends on what you mean by "random".
While it would be possible to select 100 individuals randomly there is no way to achieve an accurate representation of the population of a country or of the Earth with just 100 individuals so random can not actually be achieved   
Logged
 

Offline hamdani yusuf

  • Naked Science Forum King!
  • ******
  • 5086
  • Activity:
    78%
  • Thanked: 183 times
    • View Profile
Re: What do you mean by "random"?
« Reply #15 on: 21/07/2021 23:02:04 »
Quote from: Europa on 21/07/2021 15:01:50
While it would be possible to select 100 individuals randomly there is no way to achieve an accurate representation of the population of a country or of the Earth with just 100 individuals so random can not actually be achieved 
It's more like rounding error, representing population with less bit of information, rather than impossibility to get randomness.
Logged
Unexpected results come from false assumptions.
 

Offline Europa

  • Sr. Member
  • ****
  • 208
  • Activity:
    0%
  • Thanked: 2 times
  • Naked Science Forum Newbie
    • View Profile
Re: What do you mean by "random"?
« Reply #16 on: 22/07/2021 02:10:03 »
Quote from: hamdani yusuf on 21/07/2021 23:02:04
Quote from: Europa on 21/07/2021 15:01:50
While it would be possible to select 100 individuals randomly there is no way to achieve an accurate representation of the population of a country or of the Earth with just 100 individuals so random can not actually be achieved 
It's more like rounding error, representing population with less bit of information, rather than impossibility to get randomness.

Again there are too many human variables to represent the population with just 100 people.  There are 195 countries in the World so this study would leave out entire groups
Logged
 



Offline Bored chemist

  • Naked Science Forum GOD!
  • *******
  • 27780
  • Activity:
    98.5%
  • Thanked: 933 times
    • View Profile
Re: What do you mean by "random"?
« Reply #17 on: 22/07/2021 08:52:49 »
Quote from: Europa on 22/07/2021 02:10:03
Quote from: hamdani yusuf on 21/07/2021 23:02:04
Quote from: Europa on 21/07/2021 15:01:50
While it would be possible to select 100 individuals randomly there is no way to achieve an accurate representation of the population of a country or of the Earth with just 100 individuals so random can not actually be achieved 
It's more like rounding error, representing population with less bit of information, rather than impossibility to get randomness.

Again there are too many human variables to represent the population with just 100 people.  There are 195 countries in the World so this study would leave out entire groups
Will whoever is keeping a tally of the things Europa doesn't understand please add this one to the list, thanks.
Logged
Please disregard all previous signatures.
 

Offline evan_au

  • Global Moderator
  • Naked Science Forum GOD!
  • ********
  • 10420
  • Activity:
    23.5%
  • Thanked: 1254 times
    • View Profile
Re: What do you mean by "random"?
« Reply #18 on: 22/07/2021 11:08:57 »
A few weeks ago I was doing a Monte-Carlo simulation (yes, that is a thing!), and needed to generate a lot of random sequences; I was using EXCEL to generate them.
See: https://en.wikipedia.org/wiki/Monte_Carlo_method

There were a number of methods on the web that would generate random numbers "with replacement", but I wanted to do it "without replacement".
- If you are running a clinical trial, you can't give two different patients the same bottle of medicine
- And you don't want any bottles left over at the end
- And you don't want to allocate more people to one arm of the trial than the other
- What you want is a random permutation:
       - Randomly assign 100 people to 100 bottles of medicine; once you have assigned a bottle to a person, that bottle is removed from consideration.
       - It also works in the opposite direction: once you have assigned a person to a bottle, that person is removed from consideration.

I found a method on the web that is pretty much what bored chemist suggested, generating a random permutation:
- Generate a row of random numbers (however many you need): EXCEL has a RND() function.
- Lookup the list of random numbers and pick the nth largest, using the "LARGE()" function
- Find the index of that entry using the "MATCH()" function
- It seems rather roundabout, but it works well.
- I wanted to generate a hundred random permutations: Just copy the equations 100 times
- I wanted to run the simulation many times with different inputs: Every time you click "Calculate", it generates a new simulation and graphs the results...
This is the method I used: https://superuser.com/questions/972507/can-i-produce-a-row-in-excel-which-is-random-permutation-of-another-row

But I think Alan only wanted to generate 1 random permutation.

Apparently, EXCEL in Microsoft365 has a new RANDARRAY function that can be used to randomly permute a list by coupling it with the SORTBY function:
https://www.ablebits.com/office-addins-blog/2020/07/15/excel-randarray-function-generate-random-numbers/
Logged
 

Online alancalverd (OP)

  • Global Moderator
  • Naked Science Forum GOD!
  • ********
  • 14820
  • Activity:
    100%
  • Thanked: 1120 times
  • life is too short to drink instant coffee
    • View Profile
Re: What do you mean by "random"?
« Reply #19 on: 23/07/2021 22:45:06 »
Quote from: Europa on 21/07/2021 15:01:50
While it would be possible to select 100 individuals randomly there is no way to achieve an accurate representation of the population of a country or of the Earth with just 100 individuals so random can not actually be achieved   

Try reading the first line of the question.

I have 100 patients, that is, individuals who have been diagnosed with  the same illness. They are by definition not representative of the population, 99.9% of whom are not sick.

I want to see if toadleg accelerates their recovery. So I need to give half of them a dose of toadleg, and the other half a bottle that tastes the same but doesn't contain my magic gloop, and nobody must know or be able to calculate who got which until the end of the trial. 
Logged
helping to stem the tide of ignorance
 



  • Print
Pages: [1] 2   Go Up
« previous next »
Tags:
 
There was an error while thanking
Thanking...
  • SMF 2.0.15 | SMF © 2017, Simple Machines
    Privacy Policy
    SMFAds for Free Forums
  • Naked Science Forum ©

Page created in 0.122 seconds with 77 queries.

  • Podcasts
  • Articles
  • Get Naked
  • About
  • Contact us
  • Advertise
  • Privacy Policy
  • Subscribe to newsletter
  • We love feedback

Follow us

cambridge_logo_footer.png

©The Naked Scientists® 2000–2017 | The Naked Scientists® and Naked Science® are registered trademarks created by Dr Chris Smith. Information presented on this website is the opinion of the individual contributors and does not reflect the general views of the administrators, editors, moderators, sponsors, Cambridge University or the public at large.