In a county where jury selection is supposed to be random, a civil rights group sues the county, claiming racial disparities in jury selection.

Distribution of ethnicities of the people in the county who are eligible for jury duty (based on census results):

ethnicity white black nat. amer. asian & PI other
%in population 80.29% 12.06% 0.79% 2.92% 3.94%

Distribution of 2500 people who were selected for jury duty the previous year:

ethnicity white black nat. amer. asian & PI other
observed# 1920 347 19 84 130

Ho->percentages are same Ha->percentages are not same

First, lets calculate expected values:

ethnicity white black nat. amer. asian & PI other
observed# 1920 347 19 84 130
expected# 2007 302 20 73 98
expected=c(2007,302,20,73,98)
observed=c(1920,347,19,84,130)
chi_sq<-sum( ((observed-expected)**2)/expected )
k=5 #number of categories
df = k - 1 #degree of freedom
pvalue<-pchisq(chi_sq, df, lower.tail = FALSE)
print(pvalue)
## [1] 0.0001498896

Since pvalue<0.05, we reject Ho, accept Ha.