Chapter 2: berkeley simulation
Chapter 2: berkeley simulation
We first shuffle the rows of the application table using the custom Shuffle.m function:
Ntable=[5125 940; 1625 2965; 2510 1123; 955 1965; 2085 1875; 1265 1705];%numbers of male & female applicants
Ptable=[73 83; 27 28; 64 68; 15 18; 35 37; 6 7]/100; %percentages of male & female acceptances
Dept={'engineering','english','chemistry','communication','psychology','philosophy'}
ilist=Shuffle(1:6); %pseudorandomly arranged numbers bet 1 and 6
Ntablenew=Ntable(ilist,:); %new Ntable
p=sum(Ntablenew.*Ptable)./sum(Ntablenew) %overall rate of [male female] acceptances
pcoin=bpdf(sum(Ptable(:,2)>=Ptable(:,1)),6,.5); %binomial probability
The first two lines give the data: male/female application numbers, and male/female percent accepted for each department. In the last line the pcoin variable shows the probability of flipping a fair coin 6 times (once per department) and having the result show heads each time. This is also the probability of having a result in which either mens or women’s applications are favored in every single department by accident (i.e., without looking at the sex of the applicant).