—————————————————————————

Student Name : Sachid Deshmukh

—————————————————————————

  1. 6.6 2010 Healthcare Law.

  1. 6.28 Sleep deprivation, CA vs. OR, Part I.

prop.1 = 0.08
prop.2 = 0.088
prop.diff = prop.2 - prop.1

sample1<-11545
sample2 <-4691
std.err<- sqrt(prop.1*(1-prop.1)/sample1 + prop.2*(1-prop.2)/sample2)

# We know that critical value for 95% confidence interval = 1.96
crit.value = 1.96

print(paste("95% confidence interval of difference in proportion = ",  prop.diff + crit.value * std.err, "to", prop.diff - crit.value * std.err))
## [1] "95% confidence interval of difference in proportion =  0.0174981284088213 to -0.00149812840882135"
  1. 6.44 Barking deer.

(a) Write the hypotheses for testing if barking deer prefer to forage in certain habitats over others.

(b) What type of test can we use to answer this research question?

Answer : We can use Chi Square fitness of good test to answer this research question

(c) Check if the assumptions and conditions required for this test are satisfied.

Answer : We need to assume that deers are radomly selected and selection is independent of each other. We need atleast 10 positive and 10 negative samples in each category. However in the case of wood there are only 4 positive samples. This would not give us accurate estimation of the chi square statistic

pwoods<-0.048
pcult<-0.147
pforest<-0.396
pother<-1-pwoods-pcult-pforest

owoods = 4
ocult = 16
oforest = 67
oother = 345

# Perform Chi-Square fitness of good test
chisq.test(x=c(owoods, ocult, oforest, oother), p=c(pwoods, pcult, pforest,pother))
## 
##  Chi-squared test for given probabilities
## 
## data:  c(owoods, ocult, oforest, oother)
## X-squared = 272.69, df = 3, p-value < 2.2e-16

From the Chi-Square test above we can see that Chi Square value is very large (272.69) and P value is almost 0. Since P value is lesser that level of significance (0.05) we need to reject null hypotheis. The above Chi Square test results suggest that barking deer forage is not agnostic to their habitate. There is a significant relation between barking deer forage habits and the corresponding habitate in which they live.