Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

# Create an empty array to hold our simulated differences differences = np.array([]) # Set number of repetitions repetitions = 10000 # Combine the two

# Create an empty array to hold our simulated differences differences = np.array([]) # Set number of repetitions repetitions = 10000 # Combine the two arrays into a single array all_birthweights = np.append(nonsmoker_births, smoker_births)

for i in np.arange(repetitions): # Permute all_birthweights shuffled_birthweights = ... # Make the simulated smoker and non-smoker group sim_nonsmoker_births = shuffled_birthweights[:len(nonsmoker_births)] sim_smoker_births = shuffled_birthweights[len(nonsmoker_births):] # Calculate test statistics sim_difference = np.average(sim_nonsmoker_births) - np.average(sim_smoker_births) # Save the test statistics in differences differences = observed_difference - sim_difference

differences

Question:

What should I write in the places with three dots to generate a random sample?

I have tried sample(), choice(), but it always showsnumpy.ndarrary object has no attribute random

Thank you!

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

More Books

Students also viewed these Databases questions

Question

1.Which are projected Teaching aids in advance learning system?

Answered: 1 week ago

Question

What are the classifications of Bank?

Answered: 1 week ago