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                   

Python for MBA's- One sample 't' test

T test

This is the most common hypothesis testing statistical test used in social science.
Today we will learn how to calculate One sample 't ' test using Python.

Problem:

Let us take Virat Kohli's  four  innings score in 2020 in New zealand in T 20 matches
They are
11,
38,
11,
45
His career average in T20 Internationals is 50.80
Now the hypothesis is

Virat Kohli's average in T20's in New Zealand 2020 series  significantly differs from career T 20 International average.

The Python code is given below.


import numpy as np
from scipy.stats import norm
from scipy import stats
Virat_t20I=(11,38,11,45)
# Perform t-test and print result
t_result=stats.ttest_1samp(Virat_t20I, 50.8)
print(t_result)

# Test significance
alpha= 0.05
if (t_result[1] < alpha):
    print("mean value of Virat_T20I differs from given value")
else:
  print("No significant difference found")
 

Solution:

Ttest_1sampResult(statistic=-2.7523096064356434, pvalue=0.07060545196814848)
No significant difference found
 
 
 

 

Learn SPSS- Normality Tests


Friday, May 22, 2020

Advanced Excel for MBA's - Calculating the Mean using Excel


Calculating mean of the datasets using Excel.

Problem1 :
Calculate the mean sales of Prasad industries's sales executive for the month MAY 2020.


Company : Prasad Industries.
Sales for May 2020(in '000s)
Sales Executive 172
Sales executive 235
Sales Executive 345
Sales Executive 452
Sales Executive 561
Sales Executive 663
Sales Executive 748
Sales Executive 859
Sales Executive 971
Sales Executive 1074

Answer
 Step 1: Click on formula
 Step 2: Insert functions
Step 3:
Step 4: Click on Average
Step 5; 
Select the sales executive 1 to 10 sales data
Step 6; The answer 58 will appear on the window.