Wednesday, May 27, 2020

R for MBA's- Hypothesis testing - T test

R for MBA's- Hypothesis testing  - 't' test

one sample

Problem 1:


The prices of stockof M/S  Nanjund Agri industries in last nine days given below
71,74,82,67,35,79,48,57,62
Test the hypothesis whether stock prices of M/S Nanjund Agri differ significantly.

Coding:

> x<-c(71,74,82,67,35,79,48,57,62)
> t.test(x)

Output

One Sample t-test

data:  x
t = 12.581, df = 8, p-value = 1.495e-06

alternative hypothesis: true mean is not equal to 0
95 percent confidence interval:
 52.17808 75.59970
sample estimates:
mean of x
 63.88889 

Two samples


Problem 2:

Test the hypothesis to ascertain the significance of sales on the profit. The sales of Ajay enterprises are given below for previous seven years.
135,132,234,213,245,267,156
 Similarly, the profit of the firm for the corresponding period is as follows.
21,20,34,32,36,38,19

Solution:
Coding:
> Sales<-c(135,132,234,213,245,267,156)
> Profit<-c(21,20,34,32,36,38,19)
> t.test(Sales,Profit)
Output:
        Welch Two Sample t-test
Data:  Sales and Profit
t = 7.9421,       df = 6.2632,               p-value = 0.0001705
Alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
 117.3586                    220.3557
Sample estimates:
Mean of Sales                                                              mean of Profit
197.42857                                                        28.57143                   

No comments:

Post a Comment