Chapter 8: Problem 21
Independent vs. dependent random numbers. Generate a sequence of \(N\) independent random variables with values 0 or 1 and print out this sequence without space between the numbers (i.e., as 001011010110111010\() .\) The next task is to generate random zeros and ones that are dependent. If the last generated number was 0 , the probability of generating a new 0 is \(p\) and a new 1 is \(1-p\). Conversely, if the last generated was 1, the probability of generating a new 1 is \(p\) and a new 0 is \(1-p\). Since the new value depends on the last one, we say the variables are dependent. Implement this algorithm in a function returning an array of \(N\) zeros and ones. Print out this array in the condense format as described above. Choose \(N=80\) and try the probabilities \(p=0.5, p=0.8\) and \(p=0.9\). Can you by visual inspection of the output characterize the differences between sequences of independent and dependent random variables? Name of program file: dependent_random_variables.py.
Short Answer
Step by step solution
Key Concepts
These are the key concepts you need to understand to accurately answer the question.