Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Suppose that the experimenter still wants 1 0 people in the treatment group, but instead of the restriction that the treatment group contain exactly 5

Suppose that the experimenter still wants 10 people in the treatment group, but instead of the restriction that the treatment group contain exactly 5 males and 5 females, the experimenter only imposes the restriction that it contain at least 2 males and at least 2 females. How many different treatment groups are possible? Store your answer in the variable num_treatment_groups as an integer.
Hint: Break the problem into a few cases based on the number of males in the treatment group, and use a for-loop to do the appropriate calculation for each case.
import math
import numpy as np
from random import shuffle
from scipy.stats import binom
from scipy.stats import norm
num_treatment_groups =0
for num_males in range (2,9) :
num_females =10-num_males
num_ways_males=math.comb(14, num_males)
num_ways_females=math.comb(17, num_females)
num_treatment_groups+=(num_ways_males*num_ways_females)
num_males =9
num_females =1
num_ways_males=math.comb(14,num_males)
num_ways_females=math.comb(17, num_females)
num_treatment_groups+=(num_ways_males*num_ways_females)
num_males =10
num_females =0
num_ways_males=math.comb(14, num_males)
num_treatment_groups += num_ways_males
print (num_treatment_groups)
Assertion error problem where is my code going wrong?
image text in transcribed

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

Advances In Spatial And Temporal Databases 10th International Symposium Sstd 2007 Boston Ma Usa July 2007 Proceedings Lncs 4605

Authors: Dimitris Papadias ,Donghui Zhang ,George Kollios

2007th Edition

3540735399, 978-3540735397

More Books

Students also viewed these Databases questions

Question

Factors Influencing the Success/Failure of Start-up Branding?

Answered: 1 week ago