Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This question is in python 3. I generate the sample here according to the distribution. I am not sure how to do this question. The

This question is in python 3.image text in transcribed

I generate the sample here according to the distribution.image text in transcribed

I am not sure how to do this question.

The probability of 6 being selected is very small. Let's write a function that can check whether a certain element (such as 6) is included in the sample. Your function should take in a sample in the form of an array and an element x, and return True or False. It must use a while loop. Then use your function to determine if 6 was in the sample of size 1000. Assign this result to a variable called is_six_in1. Hint: Go through each entry in the array until you find a 6.

image text in transcribed

If my sample does not contain any 6, continue generating larger and larger samples until you have one with exactly one 6 in it. Your solution must use a while loop. Assign the resulting sample size to a variable called final_sample_size. Hint 1: We have written a function that checks if 6 is in an array; can we use it? Hint 2: You don't need to try every possible sample size (1000, 1001, 1002, ...) inside your while loop. Doing so will take too long!

image text in transcribed

valuesmake_array (1,2,3,4,5,6) prob-of-value = make_array (0.1,0.2,0.3,0.4,0.5, 0.00001) normalizer - 1.0/sum (prob_of_value) prob-of-value-normalizer * prob-of-value # ensure probabilities sum to 1 distribution_table Table).with_columns( 'value, values, 'probability of value', prob_of_value) distribution table suntol le().with_columns value probability of value 0.0666662 0.133332 0.199999 0.266665 0.333331 6.66662e-06 2 3 4 valuesmake_array (1,2,3,4,5,6) prob-of-value = make_array (0.1,0.2,0.3,0.4,0.5, 0.00001) normalizer - 1.0/sum (prob_of_value) prob-of-value-normalizer * prob-of-value # ensure probabilities sum to 1 distribution_table Table).with_columns( 'value, values, 'probability of value', prob_of_value) distribution table suntol le().with_columns value probability of value 0.0666662 0.133332 0.199999 0.266665 0.333331 6.66662e-06 2 3 4

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Database Programming

Authors: Chris Fehily

1st Edition

1937842312, 978-1937842314

More Books

Students also viewed these Databases questions

Question

=+8.3(i)). If j is transient, then fi= C PH) /(1+2 Pc)

Answered: 1 week ago

Question

Explain how cultural differences affect business communication.

Answered: 1 week ago

Question

List and explain the goals of business communication.

Answered: 1 week ago