You are on page 1of 2

9/6/22, 12:25 PM 2140869_LabAssignment06.

2140869_LabAssignment06.1
Srikanth Rajkumar
30/08/2022
#Report answering various questions on hypothesis testing

##Introduction

Hypothesis testing is a statistical method to determine whether a hypothesis that you have holds true or not.
The hypothesis can be with respect to two variables within a dataset, an association between two groups or a
situation.

The method evaluates two mutually exclusive statements (two events that cannot occur simultaneously) to
determine which statement is best supported by the sample data and make an informed decision.

##Objective

Hypothesis testing is an important mathematical concept that’s used in the field of data science. While it’s
really easy to call a random method from a python library that’ll carry out the test for you, it’s both necessary
and interesting to know what is actually happening behind the scenes!

##Q1

res <- prop.test(x = 7, n = 100, p = 0.095, correct = FALSE, alternative = "less")

res

#The p-value of the test is 0.1969, which is less than the significance level alpha = 0.05. W
e can conclude that the proportion of male with cancer is significantly different from 0.5 wi
th a p-value = 0.1969.

##Q2

newucb_data <- as.data.frame(UCBAdmissions)

View(newucb_data)
attach(newucb_data)

ft=xtabs(Freq~Admit)

ft

N=sum(ft) ######total no. of application

fa=ft[1]

#There are 24 observations

b = nrow(subset(newucb_data, Admit=="Admitted"))

res <- prop.test(x = fa, n = N, p = 0.4, correct = FALSE, alternative = "less", conf.level =
0.99)

res

#The p-value of the test is 0.04639, which is more than the significance level alpha = 0.01.
Here p value greater than the considered level of significance(0.01), we don't have sufficien
t evidence to reject the hypothesis.Therefore proportion of students who are admitted to the
University of California at Berkeley and the public relations officer boasts that UCB has his
torically had is 40% acceptance rate

file:///C:/Users/Srikanth R/OneDrive/Documents/2140869_PracticalAssignment06.1.html 1/2


9/6/22, 12:25 PM 2140869_LabAssignment06.1

##Q3

res <- prop.test(x = 540, n = 1000, p = 0.5, correct = FALSE, conf.level = 0.99)

res

#The p-value of the test is 0.01141, which is greater than the significance level alpha = 0.0
1. We can conclude that the proportion of rice-eaters is not significantly different from 0.5
with a p-value = 0.01141.

##Q4 (a)

res <- prop.test(x = 3240, n = 9000, p = 1/3, correct = FALSE, conf.level = 0.95)

res

#The p-value of the test is 1.425e-09, which is lesser than the significance level alpha = 0.
05. Here p value less than the considered level of significance(0.01), we have sufficient evi
dence to reject the hypothesis.Therefore, the dice cannot be regarded as an unbiased one

##Q4 (b)

res <- prop.test(x = 3240, n = 9000, p = 1/3, correct = FALSE, conf.level = 0.99)

res

#The p-value of the test is 1.425e-09, which is lesser than the significance level alpha = 0.
01. Here p value less than the considered level of significance(0.01), we have sufficient evi
dence to reject the hypothesis.Therefore, the dice cannot be regarded as an unbiased one

##Q5

res <- prop.test(x = 55, n = 150, p = 0.60, correct = FALSE, conf.level = 0.99)

res

#The p-value of the test is 5.433e-09, which is lesser than the significance level alpha = 0.
01. Here p value less than the considered level of significance(0.01), we have sufficient evi
dence to reject the hypothesis.Therefore, the management's claim is wrong, as are a different
management's claim of the promoting of holistic development.

##Conclusion

Hypothesis testing is done on a sample of the whole population — hence sample data. (if you want to
determine whether age impacts the likelihood of getting admitted to the hospital, the ‘population’ would be
every single person on earth. A ‘sample’ is a number of people chosen at random from this population)

file:///C:/Users/Srikanth R/OneDrive/Documents/2140869_PracticalAssignment06.1.html 2/2

You might also like