Download as pdf or txt
Download as pdf or txt
You are on page 1of 18

 

  

Contents  
Problem 1 ................................................................................................................................................ 2  
1.1. Use methods of descriptive statistics to summarize data. Which Region and which Channel spent the 
most? Which Region and which Channel spent the least? ................................................ 2  
1.2. There are 6 different varieties of items that are considered. Describe and comment/explain all the 
varieties across Region and Channel? Provide a detailed justification for your answer. ............. 2  
1.3. On the basis of the descriptive measure of variability, which item shows the most inconsistent 
behaviour? Which items shows the least inconsistent behaviour? ................................................... 2  
1.4. Are there any outliers in the data? Back up your answer with a suitable plot/technique with the help 
of detailed comments. .......................................................................................................... 2  
1.5. On the basis of your analysis, what are your recommendations for the business? How can your 
analysis help the business to solve its problem? Answer from the business perspective. ........ 3  
Problem 2 ................................................................................................................................................ 3  
2.1. For this data, construct the following contingency tables (Keep Gender as row variable) ......... 3  
2.1.2. Gender and Grad Intention ................................................................................................... 3  
2.1.3. Gender and Employment ...................................................................................................... 3  
2.1.4. Gender and Computer .......................................................................................................... 3  
2.2. Assume that the sample is a representative of the population of CMSU. Based on the data, answer 
the following questions: ......................................................................................................... 3  
2.2.1. What is the probability that a randomly selected CMSU student will be male? What is the 
probability that a randomly selected CMSU student will be female? ............................................ 3  
2.3. Based on the above probabilities, do you think that the column variable in each case is independent 
of Gender? Justify your comment in each case. ........................................................... 4  
2.4. Note that there are three numerical (continuous) variables in the data set, Salary, Spending and Text 
Messages. For each of them comment whether they follow a normal distribution. Write a note 
summarizing your conclusions. [Recall that symmetric histogram does not necessarily mean that the 
underlying distribution is symmetric] ................................................................................... 4  
Problem 3 ................................................................................................................................................ 5  
3.1 Do you think that the population means for shingles A and B are equal? Form the hypothesis and 
conduct the test of the hypothesis. What assumption do you need to check before the test for equality 
of means is performed? ........................................................................................................ 5  

3.2 What assumption about the population distribution is needed in order to conduct the hypothesis tests
above? ......................................................................................................................  

 
 
 
 
 
 
 
  

Problem 1 
A wholesale distributor operating in different regions of Portugal has information on annual 
spending of several items in their stores across different regions and channels. The data 
consists of 440 large retailers’ annual spending on 6 different varieties of products in 3 different 
regions (Lisbon, Oporto, Other) and across different sales channel (Hotel, Retail). 
1.1 Use methods of descriptive statistics to summarize data. Which Region and which Channel spent 
the most? Which Region and which Channel spent the least? 

Solution 1.1 

 There are 6 categories across which sale has been made namely Fresh,Milk,Grocery,Frozen 
Detergents_Paper and Delicatessen 

 There are no missing/Null values in data set. 

 Region “Other” has the most spend of 10677599 while the Channel with most spend is 
“Hotel” with spend of 7999569 

 Region Optro has the least spend amount with 1555088 while the channel retail has least 
spend amount of 6619931 

 
 
  

   
 

1.2 There are 6 different varieties of items that are considered. Describe and comment/explain all the 
varieties across Region and Channel? Provide a detailed justification for your answer. 

Solution 1.2 

 
 

 There are 6 categories across which sale has been made namely Fresh,Milk,Grocery,Frozen 
Detergents_Paper and Delicatessen 

 The highest Total Spend is on Fresh products while the lowest is on Delicatessen. 

 With a box plot we can summarize that the spend for Fresh and groceries is the maximum 
across region and channel while for Delicatessen it is the least across region and channel. 
 
  

 
 

1.3 On the basis of a descriptive measure of variability, which item shows the most inconsistent 
behavior? Which items show the least inconsistent behavior? 

Solution 1.3 

Even though fresh items are most sold both in terms of Total Spend and mean it is also the highest Std 
deviation of 12647.29 which skews its mean, the outliers are also clearly visible for Fresh however it has 
lowest Coefficient of variation of 1.05 while Delicatessen has lowest mean and std of 2820 has the 
highest coefficient of variation of 1.85. 

Giving higher precedence to CV the most consistent item is Fresh while least is Delicatessen 

 
 
  

 
 

1.4 Are there any outliers in the data? Back up your answer with a suitable plot/technique with the 
help of detailed comments. 

Solution 1.4 

Yes, there are outliers in all variables of data set as evident from Boxplot. 

 
 

 
 
  

1.5 On the basis of your analysis, what are your recommendations for the business? How can your 
analysis help the business to solve its problem? Answer from the business perspective 

Solution 1.5 

Based on the data and subsequent analysis it is evident that from sales viewpoint Hotel channel 
seem to be a more valued customer in terms of total spend however more attention and better 
deals on Grocery items should be provided to this valued channel since it is spending considerably 
less in this category when compared to retail channel. Hotels seems to be preferring other 
wholesalers or distributors for their grocery needs. on much more as compared to retail business 

 
Another major area of focus is Detergents_Paper though the spend could be less purely based on 
number of end clients in this case. 

 
 

 
 
  

Problem 2 ‐ 
The Student News Service at Clear Mountain State University (CMSU) has decided to gather 
data about the undergraduate students that attend CMSU. CMSU creates and distributes a 
survey of 14 questions and receives responses from 62 undergraduates (stored in 
the Survey data set). 
2.1. For this data, construct the following contingency tables (Keep Gender as row variable) 

2.1.1. Gender and Major 

2.1.2. Gender and Grad Intention 

2.1.3. Gender and Employment 

2.1.4. Gender and Computer 

Solution 2.1 to 2.4: Using crosstab to create the desired tables for above ask. Output shown below 

 
 

2.2. Assume that the sample is representative of the population of CMSU. Based on the data, answer 
the following question: 

2.2.1. What is the probability that a randomly selected CMSU student will be male? 

Solution 2.2.1: There are total of 62 Students as evident from the info() command and no missing/null 
values. Out of these there are 29 Male students hence the probability of randomly selected student will 
be male is 46.77% 
 
  

  
2.2.2. What is the probability that a randomly selected CMSU student will be female? 

Solution 2.2.2: With same above logic the probability of randomly selected student being female is 
53.22%. 

 
2.3. Assume that the sample is representative of the population of CMSU. Based on the data, answer 
the following question: 

2.3.1. Find the conditional probability of different majors among the male students in CMSU 

Solution 2.3.1: Post creation of cross tab between “Gender” and “Major”, we can find out the 
distribution of Male students across the Majors while total male students is 29. 

Hence Probability across each major is:  

Sum of Male Students in Major/Total Male Students. 

Probability of Males opting for Accounting. is 13.79% 

Probability of Males opting for CIS. is 3.45% 
 
  

Probability of Males opting for Economics/Finance. is 13.79% 

Probability of Males opting for InternationalBusiness. is 6.90% 

Probability of Males opting for Management. is 20.69% 

Probability of Males opting for Other. is 13.79% 

Probability of Males opting for Retailing/Marketing. is 17.24% 

Probability of Males opting for Undecided. is 10.34% 

2.3.2 Find the conditional probability of different majors among the female students of CMSU. 

Solution 2.3.2: Post creation of cross tab between “Gender” and “Major”, we can find out the 
distribution of Female students across the Majors while total Female students is 33. 

Hence Probability across each major is:  

Sum of Female Students in Major/Total Female Students. 

Probability of Females opting for Accounting. is 9.09% 

Probability of Females opting for CIS. is 9.09% 

Probability of Females opting for Economics/Finance. is 21.21% 

Probability of Females opting for InternationalBusiness. is 12.12% 

Probability of Females opting for Management. is 12.12% 

Probability of Females opting for Other. is 9.09% 

Probability of Females opting for Retailing/Marketing. is 27.27% 

Probability of Females opting for Undecided. is 0.00% 

 
 
  

2.4. Assume that the sample is a representative of the population of CMSU. Based on the data, 
answer the following question: 

2.4.1. Find the probability That a randomly chosen student is a male and intends to graduate. 

Solution 2.4.1: 

Ans: From the crosstab total students is 62 out of which 29 are males. 

Out of these 29 there are 3 male students that do not intend to graduate while 9 are undecided and 
total of 17 have intention to Graduate  

Hence required Probability = 17/62 which is 27.419% 

 
2.4.2 Find the probability that a randomly selected student is a female and does NOT have a laptop. 

Solution 2.4.2: From Cross tab between Female and Computer 

There are 4 Female students without laptop, hence the desired probability is  

4/Total students  4/62 

Probability = 6.45% 

 
 

 
 
  

2.5. Assume that the sample is representative of the population of CMSU. Based on the data, answer 
the following question: 

2.5.1. Find the probability that a randomly chosen student is a male or has full‐time employment? 

Solution 2.5.1: 

Total = 62 

Total Male =29 

Total Full Time employed =10 
Total Full time Male =7 

Total Full Time Female = 3 

Probability = [ (Total Male + Total Full Time Female)‐ Total Full time Male]/ Total 

Probability = [(29+3)‐7]/62 

 
2.5.2. Find the conditional probability that given a female student is randomly chosen, she is majoring 
in international business or management. 

Solution 2.5.2: 

Total Female = 33 

International Business =4 

Management =4 

Probability = (International Business+ Management)/ Total Female 

Probability =24.24% 

 
 
  

2.6.  Construct a contingency table of Gender and Intent to Graduate at 2 levels (Yes/No). The 
Undecided students are not considered now and the table is a 2x2 table. Do you think the graduate 
intention and being female are independent events? 

Solution 2.6: 

Step1: Creating a copy of data frame and dropping the rows where Grad intention = Undecided 

Step 2: Creating a crosstab of this new data frame between Gender and Grad Intention to get the 
desired output. 

 
Choose one student from this new data frame, what is the probability that the student is a female is:  

Total Females/Total Students = (9+11)/40 

Probability of being a Female=0.5 

Probability of Graduation intention amongst females = 11/20 ‐0.55 

Probability of Total Graduation intention = 28/40 ‐0.7 

Hence from above data it can be concluded that Graduation intention and being a female are not 
mutually exclusive 

 
 
  

2.7. Note that there are four numerical (continuous) variables in the data set, GPA, Salary, Spending, 
and Text Messages. 

Answer the following questions based on the data 

2.7.1. If a student is chosen randomly, what is the probability that his/her GPA is less than 3? 

Solution 2.7.1: 

To find absolute probability count number of entries with GPA less than 3 = 17(entries) 

Required probability = 17/62 

Required probability = 27.42% 

 
2.7.2. Find the conditional probability that a randomly selected male earns 50 or more.  

Solution 2.7.2: 

Find total males earning more than 50 by filtering out the data and then dividing it by total males 

Total Males = 29 

Males >50 Salary = 14 

Probability = 14/25  48.27% 

 
 
  

Find the conditional probability that a randomly selected female earns 50 or more. 

Total Females = 33 

Females earning more than 50 =18 

Probability>50 = 18/33 

Probability = 54.54% 

 
2.8. Note that there are four numerical (continuous) variables in the data set, GPA, Salary, Spending, 
and Text Messages. For each of them comment whether they follow a normal distribution. Write a 
note summarizing your conclusions. 

Solution 2.8 

GPA: Follows a Right skewed curve with all three values mean, median and mode being different and 
both the mean and median being towards right of the mode which is the peak of values or highest 
frequency. 

 
 

 
 
  

Salary: Follows a Right skewed curve with all three values mean, median and mode being different and 
both the mean and median being towards right of the mode which is the peak of values or highest 
frequency. 

 
 

Spending: Has a tail towards the right but data shows that both mode and median are 500 while the 
mean is 482 i.e towards left of the highest frequency of peak. The skewness can be attributed to outliers 
with smaller frequency curve. All three mean median and mode are different hence not an ideal 
normal distribution but closet amongst all 4 variables under consideration. 

 
 
 
  

Text Messages: Has a clear right skew with mean being towards right of peak value and a long tail in the 
histogram plot.

 
 
 
 
 
  

Problem 3  
An important quality characteristic used by the manufacturers of ABC asphalt shingles is the 
amount of moisture the shingles contain when they are packaged. Customers may feel that 
they have purchased a product lacking in quality if they find moisture and wet shingles inside 
the packaging.   In some cases, excessive moisture can cause the granules attached to the 
shingles for texture and coloring purposes to fall off the shingles resulting in appearance 
problems. To monitor the amount of moisture present, the company conducts moisture tests. A 
shingle is weighed and then dried. The shingle is then reweighed and based on the amount of 
moisture taken out of the product, the pounds of moisture per 100 square feet are calculated. 
The company would like to show that the mean moisture content is less than 0.35 pounds per 
100 square feet. 
The file (A & B shingles.csv) includes 36 measurements (in pounds per 100 square feet) for A 
shingles and 31 for B shingles. 
3.1 Do you think there is evidence that means moisture contents in both types of shingles are within 
the permissible limits? State your conclusions clearly showing all steps. 

Solution 3.1: 

H0 : mean moisture content <=0.35 

HA : mean moisture content > 0.35 

This is a one sample and one tailed Ttest and both columns or in the readings from shingles A & B are to 
be considered separately. 
Based on output from python code run on data: 
For Shingle A 
t statistic: ‐1.4735046253382782 p value: 0.07477633144907513   
Since pvalue > 0.05, do not reject H0 . There is not enough evidence to conclude that the mean moisture 
content for Sample A shingles is less than 0.35 pounds per 100 square feet. p‐value = 0.0748.  

 
 

 
For Shingle B 
From Python code   
 
  

t statistic: ‐3.1003313069986995 p value: 0.0020904774003191826   
Since pvalue < 0.05, reject H0 . There is enough evidence to conclude that the mean moisture content 
for Sample B shingles is not less than 0.35 pounds per 100 square feet. p‐value = 0.0021.  

 
 

3.2 Do you think that the population mean for shingles A and B are equal? Form the hypothesis and 
conduct the test of the hypothesis. What assumption do you need to check before the test for 
equality of means is performed? 

Solution 3.2: 
H0 : mean of population (A)=  mean of population (B)   
Ha : mean(A)!= mean(B)   
Alpha = 0.05   
Mean population = μ 

Here we must run independent T test. 

The independent t‐test, also called the two‐sample t‐test, independent‐samples t‐test or student's t‐
test, is an inferential statistical test that determines whether there is a statistically significant difference 
between the means in two unrelated groups 

Output from Python Jupyter 

t_statistic=1.29 and pvalue=0.202   

Since the  pvalue > alpha , we cannot reject H0; and we can say that population mean for shingles A and 
B are equal Test Assumptions. 

Assumptions:  When running a two‐sample t‐test, the basic assumptions are that the distributions of the 
two populations are normal, and that the variances of the two distributions are the same.  

You might also like