You are on page 1of 2

SAMRIDH VIKHAS S | 20MIY0001 | MAT3011[ELA] | DA – 1

Objective:
To perform “Chi-Squared Test” using R Programming

Null Hypothesis[H0]:
The given attributes are independent

Alternative Hypothesis[H1]:
The given attributes are dependent

Level of Significance = 5%

Code:
x = c(50,120,80,30,90,60,20,60,40)
data = matrix(x,nrow=3)
chisq.test(x)

Output:
Chi-squared test for given probabilities

data: x
X-squared = 129.09, df = 8, p-value < 2.2e-16

Conclusion:
Since calculated p-value < 0.05, Do not Reject Null Hypothesis (H0). Therefore, the given attributes are
independent.
SAMRIDH VIKHAS S | 20MIY0001 | MAT3011[ELA] | DA – 1
Objective:
To perform “Test for Rank Correlation” using R Programming

Null Hypothesis[H0]:
X & Y are independent

Alternative Hypothesis[H1]:
X & Y are dependent

Level of Significance = 5%

Code:
x = c(7,3,10,5,8,2,12,15,1,6,11,4,14,9,13)
y = c(50000,40000,60000,45000,
55000,35000,70000,80000,
30000,48000,65000,42000,
75000,58000,68000)
cor.test(x,y,method="spearman")

Output:
Spearman's rank correlation rho
data: x and y
S = 2, p-value < 2.2e-16
alternative hypothesis: true rho is not equal to 0
sample estimates:
rho
0.9964286

Conclusion:
Since calculated p-value < 0.05, Do not Reject Null Hypothesis (H0). Therefore, the X & Y are
independent.

You might also like