Project Report Advanced Statisics UMESHHASIJA SEPDSBBA 2021

You might also like

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

 

Project: Advanced Statistics


 
Table of Contents  
Contents  
Problem 1A…………................................................................................................................................... 3  
Introduction Anova.................................................................................................................................. 3  
Q1.1 One Way Anova Hypothesis ............................................................................................................3  
Q1.2 One Way Anova Salary: Education: .................................................................................................4 
Q1.3 One Way Anova Salary: Occupation: .............................................................................................. 5 
Q1.4 Turnkey HSD: .................................................................................................................................. 5 
Problem 1B 
Introduction ............................................................................................................................................. 6  
Q1B.1 Interaction between variables Analysis .........................................................................................6 
Q1B.2 Two Way Anova..............................................................................................................................7 
Q1B.3 Business Implications......................................................................................................................8 
Problem 2 
Introduction Principal Component Analysis................................................................................................9  
Q2.1 EDA Univariate and Bivariate Analysis ..............................................................................................10 
Q2.2 Scaling Requirement .........................................................................................................................21 
Q2.3 Comparing Covariance and Correlation Matrices..............................................................................22 
Q2.4 Outlier Analysis..................................................................................................................................24 
Q2.5 Eigen Values & Eigen Vectors............................................................................................................25 
Q2.6 PCA Execution....................................................................................................................................28 
Q2.7 Explicit form of first PC............................................................................ .........................................28 
Q2.8 Cumulative Eigen Values............................................................................ ......................................29 
Q2.9 Business Implications of PCA..................................................................... ......................................30 
Q2.10 Business Implications for Case Study...................................................... ......................................31 
   
                                         Project: Advanced Statistics

ADVANCED STATISTICS PROJECT 
REPORT 
Umesh Kumar Hasija 

 
   

DECEMBER 9, 2021 
GREAT LEARNING  
      

PREPARED BY – UMESH KUMAR HASIJA SEP 2021 BATCH 
 
                                         Project: Advanced Statistics
Problem 1A: 
Introduction 
Salary is hypothesized to depend on educational qualification and occupation. To understand 
the dependency, the salaries of 40 individuals [SalaryData.csv] are collected and each person’s 
educational qualification and occupation are noted. Educational qualification is at three levels, 
High school graduate, Bachelor, and Doctorate. Occupation is at four levels, Administrative and 
clerical, Sales, Professional or specialty, and Executive or managerial. A different number of 
observations are in each level of education – occupation combination. 
 
Question 1.1: State the null and the alternate hypothesis for conducting one‐way ANOVA for 
both Education and Occupation individually. 
Answer: Let the treatments for variable education be represented as E whole for occupation pe 
represented as O 

Dependent Variable (Salary)  Hypothesis for Education  Hypothesis for Occupation 


Null Hypothesis (H0)  𝐻0E1=E2=E3  𝐻0O1=O2=O3=O4 
Alternate Hypothesis(H1)  H1E1≠E2≠E3 or the means  H1O1≠O2≠O3≠O4 or the 
are not equal for any of the  means are not equal for at 
two pairs  least any 2 pairs 
                                     Table 1.1 One‐way Annova hypothesis Table 
 
Where:  Where:
O1= Mean of Data for Administrative and clerical
 E1= Mean of Data for High school graduate 
O2= Mean of Data for Sales
 E2= Mean of Data for Bachelor 
O3= Mean of Data for Professional or specialty
 E3= Mean of Data for Doctorate 
O4=Mean of Data for Executive or managerial
To conduct independent One‐way analysis for 
the variables/treatments Education and occupation on the dependent variable Salary above 
hypothesis must be considered independently as separate treatment while all other factors are 
randomized. 
Summary:  
One Way Annova Education 
Null Hypothesis 𝐻0: The mean salary is the same across all the 3 categories of education (High 
School Graduate, Bachelors & Doctorate). 
Alternate Hypothesis 𝐻1: The mean salary is different in at least one category of education. 
 

PREPARED BY – UMESH KUMAR HASIJA SEP 2021 BATCH 
 
                                         Project: Advanced Statistics
 
One Way Annova Occupation: 
Null Hypothesis 𝐻0: The mean salary is the same across all the 4 categories of occupation 
(Administrative and clerical, Sales, Professional or specialty, and Executive or managerial). 
Alternate Hypothesis 𝐻1: The mean salary is different in at least one category of occupation. 
Question 1.2: Perform a one‐way ANOVA on Salary with respect to Education. State whether 
the null hypothesis is accepted or rejected based on the ANOVA results. 
 
Answer: Exploratory Data Analysis: Sample of Data Set & Checking the type of variables in Data 
set Data Set: 

The Data has (2) independent 
variables Occupation and Education 
while (1) dependent variable Salary 

 
 
Type of Variable 

Salary the dependent variable id of 
integer type and represent the 
observations while the treatments of 
dependent variable of Education and 
Occupation are object of String type 
variable. Also, there is no missing 
values. 
  
Null Hypothesis 𝐻0: The mean salary is the same across all the 3 categories of education (High 
School Graduate, Bachelors & Doctorate). 
Alternate Hypothesis 𝐻1: The mean salary is different in at least one category of education. 
Post application of One‐way Annova below results are obtained. Snippet for Output (Jupyter) 
Fig 2 

 
PREPARED BY – UMESH KUMAR HASIJA SEP 2021 BATCH 
 
                                         Project: Advanced Statistics
Since the p value = 1.257709e‐08 is less than the significance level (alpha = 0.05), we can reject 
the null hypothesis and conclude that there is a significant difference in the mean salaries for at 
least one category of education. What it means is that Education level does have an impact on 
the salary and the variable is to eb considered as a factor in further analysis on what is the 
impact. 
Question 1.3: Perform a one‐way ANOVA on Salary with respect to Occupation. State whether 
the null hypothesis is accepted or rejected based on the ANOVA results. 
Answer: One Way Annova Occupation: 
Null Hypothesis 𝐻0: The mean salary is the same across all the 4 categories of occupation 
(Administrative and clerical, Sales, Professional or specialty, and Executive or managerial). 
Alternate Hypothesis 𝐻1: The mean salary is different in at least one category of occupation 
Post application of One‐way Annova below results are obtained. Snippet for Output (Jupyter) 

 
Since the p value = 0.458508 is greater than the significance level (alpha = 0.05), we fail to 
reject the null hypothesis (i.e., we accept H0) and conclude that there is no significant 
difference in the mean salaries across the 4 categories of occupation. Based on the above 
results we can conclude that Occupation does not have a significant affect on the salaries 
provided in the sample data set. 
Question 1.4: If the null hypothesis is rejected in either (2) or in (3), find out which class means 
are significantly different. Interpret the result. 
Answer:  
We perform post‐hoc (Tukey HSD) analysis only if the ANOVA test shows a p‐value less than α. 
Where p>α, we don’t know whether the means are all the same or not. Hence performing the 
test only for Education where 1‐way Annova showed that the p value is less that Alpha. 
The table shows that since the p‐ values (p‐adj in the table) are lesser than the significance level 
for all the three categories of education, this implies that the mean salaries across all categories 
of education are different. 
 
 

PREPARED BY – UMESH KUMAR HASIJA SEP 2021 BATCH 
 
                                         Project: Advanced Statistics

 
Above conclusion is further solidified by performing Tukey HSD on Occupation as well where 
the P values are greater than Alpha which concludes there is no significant difference between 
means. 

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Problem 1B: 

PREPARED BY – UMESH KUMAR HASIJA SEP 2021 BATCH 
 
                                         Project: Advanced Statistics
 
Question 1B.1 What is the interaction between two treatments? Analyze the effects of one 
variable on the other (Education and Occupation) with the help of an interaction plot. [hint: use 
the ‘point plot’ function from the ‘seaborn’ function] 
Answer: 
Interaction Plot: 

 
Fig 1B.1 
 
The interaction plot shows that there is significant amount of interaction between the 
categorical variables, Education and Occupation. 
The following are some of the observations from the interaction plot: 
 
 People with HS‐grad education do not reach the position of Exec‐managerial and they 
hold only Adm‐clerk, Sales and Prof‐Specialty occupations. 
 Prof‐Specialty people with education as Doctorate earn maximum salaries and people 
with education as HS‐Grad earn the minimum. 
 People with education as HS ‐Grad earn the minimum salaries. 
 There are no people with education as HS ‐grad who hold Exec‐managerial occupation 
 People with education as Bachelors and occupation as Prof‐Specialty earn lesser than 
people with education as Bachelors and occupations as Adm‐clerical and Sales. 
 People with education as Bachelors and occupation Sales earn higher than people with 
education as Bachelors and occupation Prof‐Specialty whereas people with education as 
Doctorate and occupation Sales earn lesser than people with Doctorate and occupation 
Prof‐Specialty. We see a reversal in this part of the plot. 
 x whereas people with education as Doctorate and occupation as Prof‐Specialty earn 
higher than people with education as Doctorate and occupation Exec‐Managerial.  
 Salespeople with Bachelors or Doctorate education earn the same salaries and earn 
higher than people with education as HS‐grad. 
 Prof‐Specialty people with education as Doctorate earn maximum salaries and people 
with education as HS‐Grad earn the minimum. 

PREPARED BY – UMESH KUMAR HASIJA SEP 2021 BATCH 
 
                                         Project: Advanced Statistics
 People with education as HS ‐Grad earn the minimum salaries. 
 There are no people with education as HS ‐grad who hold Exec‐managerial occupation 
 People with education as Bachelors or Doctorate and occupation as Adm‐clerical and 
Sales almost earn the same salaries (salaries ranging from 170000–190000). 
 Adm clerical people with education as HS‐grad earn the lowest salaries when compared 
to people with education as Bachelors or Doctorate. 
 People with education as Bachelors and occupation, Sales and Exec‐Managerial earn the 
same salaries. 
 
Question 1B.2: Perform a two‐way ANOVA based on Salary with respect to both Education and 
Occupation (along with their interaction Education*Occupation). State the null and alternative 
hypotheses and state your results. How will you interpret this result? 
 
Answer: Defining Hypothesis: 
Ho=The effect of the independent variable ‘education’ on the mean ‘salary’ does not depend on 
the effect of the other independent variable ‘occupation’ 
H1=There is an interaction effect between the independent variable ‘education’ and the 
independent variable ‘occupation’ on the mean Salary. 
 
Snippet from 2‐way Annova Analysis from Jupyter Notebook 

 
Fig 7 
Since the p value = 2.232500e‐05 is lesser than the significance level (alpha = 0.05), we can 
reject the null hypothesis. 
Hence, we can conclude that there is a significant amount of interaction between the variables, 
Education and Occupation. 
 
Question 1B.3: Explain the business implications of performing ANOVA for this case study. 
 
Answer: From the ANOVA method and the interaction plot, we see that education combined 
with occupation results in higher and better salaries among the people. It is clearly seen that 
people with education as Doctorate draw the maximum salaries and people with education HS‐
grad earn the least. Thus, we can conclude that Salary is dependent on educational 
qualifications and occupation. 
 
Problem 2 

PREPARED BY – UMESH KUMAR HASIJA SEP 2021 BATCH 
 
                                         Project: Advanced Statistics
The dataset Education ‐ Post 12th Standard.csv contains information on various colleges. You 
are expected to do a Principal Component Analysis for this case study according to the 
instructions given. The data dictionary of the 'Education ‐ Post 12th Standard.csv' can be found 
in the following file: Data Dictionary.xlsx. 
 
Question 2.1: Perform Exploratory Data Analysis [both univariate and multivariate analysis to 
be performed]. What insight do you draw from the EDA? 
 
Ans: Performing the EDA 
Describing the data with help of Data Dictionary. 
 
S.NO  Data Columns 
1  Names: Names of various university and colleges 
2  Apps: Number of applications received 
3  Accept: Number of applications accepted 
4  Enroll: Number of new students enrolled 
5  Top10perc: Percentage of new students from top 10% of Higher Secondary class 
6  Top25perc: Percentage of new students from top 25% of Higher Secondary class 
7  F.Undergrad: Number of full‐time undergraduate students 
8  P.Undergrad: Number of part‐time undergraduate students 
9  Outstate: Number of students for whom the particular college or university is Out‐
of‐state tuition 
10  Room.Board: Cost of Room and board 
11  Books: Estimated book costs for a student 
12  Personal: Estimated personal spending for a student 
13  PhD: Percentage of faculties with Ph.D.’s 
14  Terminal: Percentage of faculties with terminal degree 
15  S.F.Ratio: Student/faculty ratio 
16  perc.alumni: Percentage of alumni who donate 
17  Expend: The Instructional expenditure per student 
18  Grad.Rate: Graduation rate 
 
 
 
 
 
 
 
 
 
 
 
 

PREPARED BY – UMESH KUMAR HASIJA SEP 2021 BATCH 
 
                                         Project: Advanced Statistics
Sample of the dataset:  

 
 
There are 777 unique colleges with 17 attributes/variables associated with ongoing new 
admissions with 9 variables having an impact on the decision made by students to enroll in a 
particular college or not. 
 
Let us check the types of variables in the data frame.   
 
There are total of 777 rows and 18 columns with Names as the only object type variable and 
remaining being integer/floating vales. There are no missing values. 
 

PREPARED BY – UMESH KUMAR HASIJA SEP 2021 BATCH 
 
                                         Project: Advanced Statistics
Checking the statistics of Data 

  
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

PREPARED BY – UMESH KUMAR HASIJA SEP 2021 BATCH 
 
                                         Project: Advanced Statistics
Analyzing each variable: 
 
APPS:  
The data for variable apps clearly has outliers as evident from the Box plot while the histograms 
further solidify the same as data seems to be right slewed. The number of applications received 
by the colleagues greatly varies and this could be due to any of the remaining variables/factors 
in the data frame has outliers. The minimum value being 81 with mean of ~3000 while the 
maximum goes up to 50000 

 
 
ACCEPT: 
Majority of the applications accepted by the universities is between 100‐1500 mark where as 
there are outliers to this. 

 
 
 
 
 
 
 
 
 
 

PREPARED BY – UMESH KUMAR HASIJA SEP 2021 BATCH 
 
                                         Project: Advanced Statistics
ENROLL 

 
 
 
The maximum frequency of enrollments per college seems to be somewhere between 25‐500 
students as evident from the histogram however there are a good number of outlier to this 
trend which could be due to facilities, lower fee, faculty competency/ ratio to students and 
other factors. 
 
Top10per & Top25perc: 
 

 
There are no outliers in percentage of students applied/enrolled for the colleges that are from 
Top 25% of higher secondary class while data of Top 105 is right/positively slewed. 
 
 
 
 
 
 
 
 

PREPARED BY – UMESH KUMAR HASIJA SEP 2021 BATCH 
 
                                         Project: Advanced Statistics
Full Time Undergraduate & Part Time Undergraduate Students 
 

 
The number of undergraduate students in both modes full time and part time is right slewed 
with outliers amongst various colleges with maximum frequency distribute between 1000‐3000 
students. 
 
OUTSTATE: 
 

 
 
The data is normally distributed with just 1 outlier highlighting that students apply/get 
onboarded mostly in colleges within their own state. 
 
 
 
 
 
 
 
 
 
 

PREPARED BY – UMESH KUMAR HASIJA SEP 2021 BATCH 
 
                                         Project: Advanced Statistics
ROOM & BOARD: 
 

 
The cost of room and boarding is normally distributed with few outliers. 
 
BOOKS: 
 

 
The cost of the books varies greatly and there are outlies towards both quartiles. The data is 
binomially distributed, and this variable could be one of the primary components that affects 
the decision of students to apply in a particular college based on the expenditure to be incurred 
on books. 
 
 
 
 
 
 
 
 
 
 

PREPARED BY – UMESH KUMAR HASIJA SEP 2021 BATCH 
 
                                         Project: Advanced Statistics
PERSONAL EXPENDITURE 
 

 
Personal expenditure is positively skewed with the expenses incurred by some students higher 
than the others. 
 
PhD Faculty 

 
The data has outliers towards Q1, and data is negatively skewed with maximum frequency 
distribution between 70‐85 faculty members. Clearly few colleges have lesser number of PhD 
faculty that can be a determining factor towards popularity of the college amongst the 
students. 
 
 
 
 
 
 
 
 
 
 
 

PREPARED BY – UMESH KUMAR HASIJA SEP 2021 BATCH 
 
                                         Project: Advanced Statistics
 
TERMINAL Degree: 

 
Shows similar properties as Phd. Data is negatively skewed with few outliers towards the first 
quartile. The maximum frequency is distributed between 70‐90 faculty members having 
Terminal level of degree in their respective fields. 
 
 
Student to Faculty Ratio: 
 

 
 
Data is normally distributed with outliers on either side there is a possibility where Student to 
faculty ratio is low will have better an more focused education hence such colleges may be 
preferred over others. This could be one of the important variables in further processing of the 
given data set. 
 
 
 
 
 
 

PREPARED BY – UMESH KUMAR HASIJA SEP 2021 BATCH 
 
                                         Project: Advanced Statistics
 
Percentage of Alumni Donated: 

 
 
The data is negatively skewed with few outliers for some of the colleges. The data is normally 
distributed with maximum spread between 10‐30 alumni donations. The variable seems to have 
an insignificant impact on the overall analysis. 
 
 
EXPEND:

 
The data has along tail towards the right which is also clear with the box plot output having 
high number of outliers towards the right ow Q3. The instructional expenditure variations could 
be related to the facilities in infrastructure or salary structure of the faculty members and can 
be an indicator of the expertise of the faculty or additional infrastructure maintained by certain 
institutes as compared to others. 
Deeper analysis of the variables shows discrepancy in the Graduation rate levels where one of 
the entries is marked as 118. The graduation rate cannot be more than 100% hence this is an 
incorrect entry and will require an appropriate treatment. 
 
 
 
 

PREPARED BY – UMESH KUMAR HASIJA SEP 2021 BATCH 
 
                                         Project: Advanced Statistics
GRAD RATE 

 
 
This is an important indicator related to success of the students in particular college and can be 
one of the deciding factors while initial selection of an institute for application submission of 
final joining amongst the students.  
On closer analysis the data somehow seems to have incorrect value as an outlier with Grad rate 
of 118% which is mathematically incorrect and may require treatment for modelling. 
 

 
 

PREPARED BY – UMESH KUMAR HASIJA SEP 2021 BATCH 
 
                                         Project: Advanced Statistics

 
 
MULTIVARIANT ANALYSIS: 
 
HEAT MAP: 
 

 
 

PREPARED BY – UMESH KUMAR HASIJA SEP 2021 BATCH 
 
                                         Project: Advanced Statistics
With help of multivariant analysis it is further proved that variables like PhD faculty and ones 
having terminal level of degree have high correlation since that seems to be obvious growth 
path in field of education. 
 
Similarly, the number of applications had high and positive correlation between Applications 
submitted, accepted, and subsequently enrolled indicating higher the number of applications 
received higher is the acceptance and final enrollment numbers. 
 
Question 2.2 Is scaling necessary for PCA in this case? Give justification and perform scaling. 
 
Ans: Yes, scaling is required for this data because the scale/variations are on higher side for 
each variable. The PCA calculates a new projection of data set. And the new axis is based on the 
standard deviation of these variables. Since we have variable with a high standard deviation 
this will have a higher weight for the calculation of axis than a variable with a low standard 
deviation. If we normalize our data, all variables will have the same standard deviation, thus all 
variables have the same weight and our PCA calculates relevant axis. 
 
Applying scaling using the Zscore:  
 
Before Z score: 
 

 
 
After Z Score: 

 
 

PREPARED BY – UMESH KUMAR HASIJA SEP 2021 BATCH 
 
                                         Project: Advanced Statistics

 
As evident from the above description of the data the standard deviation is now 1 and the 
mean values are better centered as compared to data without scaling. This centers the data. 
 
Question 2.3 Comment on the comparison between the covariance and the correlation 
matrices from this data [on scaled data]. 
 
ANS: Covariance” indicates the direction of the linear relationship between variables. 
“Correlation” on the other hand measures both the strength and direction of the linear 
relationship between two variables. Correlation is a function of the covariance. What sets them 
apart is the fact that correlation values are standardized whereas, covariance values are not. 
You can obtain the correlation coefficient of two variables by dividing the covariance of these 
variables by the product of the standard deviations of the same values. If we revisit the 
definition of Standard Deviation, it essentially measures the absolute variability of a datasets’ 
distribution. When you divide the covariance values by the standard deviation, it essentially 
scales the value down to a limited range of ‐1 to +1. This is precisely the range of the 
correlation values. 
 
 
 
 

PREPARED BY – UMESH KUMAR HASIJA SEP 2021 BATCH 
 
                                         Project: Advanced Statistics
Snippet from Correlation Matrix 

 
 
The snippet shows that there is strong correlation between Applications submitted, 
Applications accepted, Enrolled and number of full time Undergraduate which is logical.  
 
Snippet from Covariance Matrix 
 
Covariance” indicates the direction of the linear relationship between variables. Percentage of 
Alumi donating is negative liner realationship with applicatpns, acceptace but has a positive 
relationship with Top10% of higher secondayr schools idication that students from 10% schools 
are the ones that show strong inclination towards donation.

 
 
 
 
 
 
 
 

PREPARED BY – UMESH KUMAR HASIJA SEP 2021 BATCH 
 
                                         Project: Advanced Statistics
Question 2.4 Check the dataset for outliers before and after scaling. What insight do you derive 
here? [Please do not treat Outliers unless specifically asked to do so] 
 
ANS: 
Snipped before scaling 

 
 
Snippet After Scaling: 

 
 
As evident from the above snippets scaling has no impact on outliers because it merely changes 
the scale of variables around the Z score so that each variable can enjoy same weightage while 
doing further analysis or fitting into a model. For outliers one must employ outlier treatments 
like using the Interquartile range.s 

PREPARED BY – UMESH KUMAR HASIJA SEP 2021 BATCH 
 
                                         Project: Advanced Statistics
Question 2.5 Extract the eigenvalues and eigenvectors. [Using Sklearn PCA Print Both] 
 
Ans: Eigen Vector: 
 
array([[ 2.48765602e‐01,  2.07601502e‐01,  1.76303592e‐01, 
         3.54273947e‐01,  3.44001279e‐01,  1.54640962e‐01, 
         2.64425045e‐02,  2.94736419e‐01,  2.49030449e‐01, 
         6.47575181e‐02, ‐4.25285386e‐02,  3.18312875e‐01, 
         3.17056016e‐01, ‐1.76957895e‐01,  2.05082369e‐01, 
         3.18908750e‐01,  2.52315654e‐01], 
       [ 3.31598227e‐01,  3.72116750e‐01,  4.03724252e‐01, 
        ‐8.24118211e‐02, ‐4.47786551e‐02,  4.17673774e‐01, 
         3.15087830e‐01, ‐2.49643522e‐01, ‐1.37808883e‐01, 
         5.63418434e‐02,  2.19929218e‐01,  5.83113174e‐02, 
         4.64294477e‐02,  2.46665277e‐01, ‐2.46595274e‐01, 
        ‐1.31689865e‐01, ‐1.69240532e‐01], 
       [‐6.30921033e‐02, ‐1.01249056e‐01, ‐8.29855709e‐02, 
         3.50555339e‐02, ‐2.41479376e‐02, ‐6.13929764e‐02, 
         1.39681716e‐01,  4.65988731e‐02,  1.48967389e‐01, 
         6.77411649e‐01,  4.99721120e‐01, ‐1.27028371e‐01, 
        ‐6.60375454e‐02, ‐2.89848401e‐01, ‐1.46989274e‐01, 
         2.26743985e‐01, ‐2.08064649e‐01], 
       [ 2.81310530e‐01,  2.67817346e‐01,  1.61826771e‐01, 
        ‐5.15472524e‐02, ‐1.09766541e‐01,  1.00412335e‐01, 
        ‐1.58558487e‐01,  1.31291364e‐01,  1.84995991e‐01, 
         8.70892205e‐02, ‐2.30710568e‐01, ‐5.34724832e‐01, 
        ‐5.19443019e‐01, ‐1.61189487e‐01,  1.73142230e‐02, 
         7.92734946e‐02,  2.69129066e‐01], 
       [ 5.74140964e‐03,  5.57860920e‐02, ‐5.56936353e‐02, 
        ‐3.95434345e‐01, ‐4.26533594e‐01, ‐4.34543659e‐02, 
         3.02385408e‐01,  2.22532003e‐01,  5.60919470e‐01, 
        ‐1.27288825e‐01, ‐2.22311021e‐01,  1.40166326e‐01, 
         2.04719730e‐01, ‐7.93882496e‐02, ‐2.16297411e‐01, 
         7.59581203e‐02, ‐1.09267913e‐01], 
       [‐1.62374420e‐02,  7.53468452e‐03, ‐4.25579803e‐02, 
        ‐5.26927980e‐02,  3.30915896e‐02, ‐4.34542349e‐02, 
        ‐1.91198583e‐01, ‐3.00003910e‐02,  1.62755446e‐01, 
         6.41054950e‐01, ‐3.31398003e‐01,  9.12555212e‐02, 
         1.54927646e‐01,  4.87045875e‐01, ‐4.73400144e‐02, 
        ‐2.98118619e‐01,  2.16163313e‐01], 
       [‐4.24863486e‐02, ‐1.29497196e‐02, ‐2.76928937e‐02, 
        ‐1.61332069e‐01, ‐1.18485556e‐01, ‐2.50763629e‐02, 
         6.10423460e‐02,  1.08528966e‐01,  2.09744235e‐01, 
        ‐1.49692034e‐01,  6.33790064e‐01, ‐1.09641298e‐03, 

PREPARED BY – UMESH KUMAR HASIJA SEP 2021 BATCH 
 
                                         Project: Advanced Statistics
        ‐2.84770105e‐02,  2.19259358e‐01,  2.43321156e‐01, 
        ‐2.26584481e‐01,  5.59943937e‐01], 
       [‐1.03090398e‐01, ‐5.62709623e‐02,  5.86623552e‐02, 
        ‐1.22678028e‐01, ‐1.02491967e‐01,  7.88896442e‐02, 
         5.70783816e‐01,  9.84599754e‐03, ‐2.21453442e‐01, 
         2.13293009e‐01, ‐2.32660840e‐01, ‐7.70400002e‐02, 
        ‐1.21613297e‐02, ‐8.36048735e‐02,  6.78523654e‐01, 
        ‐5.41593771e‐02, ‐5.33553891e‐03], 
       [‐9.02270802e‐02, ‐1.77864814e‐01, ‐1.28560713e‐01, 
         3.41099863e‐01,  4.03711989e‐01, ‐5.94419181e‐02, 
         5.60672902e‐01, ‐4.57332880e‐03,  2.75022548e‐01, 
        ‐1.33663353e‐01, ‐9.44688900e‐02, ‐1.85181525e‐01, 
        ‐2.54938198e‐01,  2.74544380e‐01, ‐2.55334907e‐01, 
        ‐4.91388809e‐02,  4.19043052e‐02], 
       [ 5.25098025e‐02,  4.11400844e‐02,  3.44879147e‐02, 
         6.40257785e‐02,  1.45492289e‐02,  2.08471834e‐02, 
        ‐2.23105808e‐01,  1.86675363e‐01,  2.98324237e‐01, 
        ‐8.20292186e‐02,  1.36027616e‐01, ‐1.23452200e‐01, 
        ‐8.85784627e‐02,  4.72045249e‐01,  4.22999706e‐01, 
         1.32286331e‐01, ‐5.90271067e‐01], 
       [ 4.30462074e‐02, ‐5.84055850e‐02, ‐6.93988831e‐02, 
        ‐8.10481404e‐03, ‐2.73128469e‐01, ‐8.11578181e‐02, 
         1.00693324e‐01,  1.43220673e‐01, ‐3.59321731e‐01, 
         3.19400370e‐02, ‐1.85784733e‐02,  4.03723253e‐02, 
        ‐5.89734026e‐02,  4.45000727e‐01, ‐1.30727978e‐01, 
         6.92088870e‐01,  2.19839000e‐01], 
       [ 2.40709086e‐02, ‐1.45102446e‐01,  1.11431545e‐02, 
         3.85543001e‐02, ‐8.93515563e‐02,  5.61767721e‐02, 
        ‐6.35360730e‐02, ‐8.23443779e‐01,  3.54559731e‐01, 
        ‐2.81593679e‐02, ‐3.92640266e‐02,  2.32224316e‐02, 
         1.64850420e‐02, ‐1.10262122e‐02,  1.82660654e‐01, 
         3.25982295e‐01,  1.22106697e‐01], 
       [ 5.95830975e‐01,  2.92642398e‐01, ‐4.44638207e‐01, 
         1.02303616e‐03,  2.18838802e‐02, ‐5.23622267e‐01, 
         1.25997650e‐01, ‐1.41856014e‐01, ‐6.97485854e‐02, 
         1.14379958e‐02,  3.94547417e‐02,  1.27696382e‐01, 
        ‐5.83134662e‐02, ‐1.77152700e‐02,  1.04088088e‐01, 
        ‐9.37464497e‐02, ‐6.91969778e‐02], 
       [ 8.06328039e‐02,  3.34674281e‐02, ‐8.56967180e‐02, 
        ‐1.07828189e‐01,  1.51742110e‐01, ‐5.63728817e‐02, 
         1.92857500e‐02, ‐3.40115407e‐02, ‐5.84289756e‐02, 
        ‐6.68494643e‐02,  2.75286207e‐02, ‐6.91126145e‐01, 
         6.71008607e‐01,  4.13740967e‐02, ‐2.71542091e‐02, 
         7.31225166e‐02,  3.64767385e‐02], 

PREPARED BY – UMESH KUMAR HASIJA SEP 2021 BATCH 
 
                                         Project: Advanced Statistics
       [ 1.33405806e‐01, ‐1.45497511e‐01,  2.95896092e‐02, 
         6.97722522e‐01, ‐6.17274818e‐01,  9.91640992e‐03, 
         2.09515982e‐02,  3.83544794e‐02,  3.40197083e‐03, 
        ‐9.43887925e‐03, ‐3.09001353e‐03, ‐1.12055599e‐01, 
         1.58909651e‐01, ‐2.08991284e‐02, ‐8.41789410e‐03, 
        ‐2.27742017e‐01, ‐3.39433604e‐03], 
       [ 4.59139498e‐01, ‐5.18568789e‐01, ‐4.04318439e‐01, 
        ‐1.48738723e‐01,  5.18683400e‐02,  5.60363054e‐01, 
        ‐5.27313042e‐02,  1.01594830e‐01, ‐2.59293381e‐02, 
         2.88282896e‐03, ‐1.28904022e‐02,  2.98075465e‐02, 
        ‐2.70759809e‐02, ‐2.12476294e‐02,  3.33406243e‐03, 
        ‐4.38803230e‐02, ‐5.00844705e‐03], 
       [ 3.58970400e‐01, ‐5.43427250e‐01,  6.09651110e‐01, 
        ‐1.44986329e‐01,  8.03478445e‐02, ‐4.14705279e‐01, 
         9.01788964e‐03,  5.08995918e‐02,  1.14639620e‐03, 
         7.72631963e‐04, ‐1.11433396e‐03,  1.38133366e‐02, 
         6.20932749e‐03, ‐2.22215182e‐03, ‐1.91869743e‐02, 
        ‐3.53098218e‐02, ‐1.30710024e‐02]]) 
 
Eigenvalues: 
 
array([5.45052162, 4.48360686, 1.17466761, 1.00820573, 0.93423123, 
       0.84849117, 0.6057878 , 0.58787222, 0.53061262, 0.4043029 , 
       0.31344588, 0.22061096, 0.16779415, 0.1439785 , 0.08802464, 
       0.03672545, 0.02302787]) 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

PREPARED BY – UMESH KUMAR HASIJA SEP 2021 BATCH 
 
                                         Project: Advanced Statistics
Question 2.6 Perform PCA and export the data of the Principal Component (eigenvectors) into a 
data frame with the original features 
 
Ans: PCA is performed and exported into data frame post which clearly multi collinearity is 
reduced. 
 

 
 

PREPARED BY – UMESH KUMAR HASIJA SEP 2021 BATCH 
 
                                         Project: Advanced Statistics
 
Question 2.7 Write down the explicit form of the first PC (in terms of the eigenvectors. Use 
values with two places of decimals only). [hint: write the linear equation of PC in terms of 
eigenvectors and corresponding features] 
 
Ans 

 
 
 
Question 2.8 Consider the cumulative values of the eigenvalues. How does it help you to decide 
on the optimum number of principal components? What do the eigenvectors indicate? 
 
ANS: Cumulative Values helps us to understand how much each carriable contributes towards 
the principal components hence helps us to decide optimum number of principal components. 

 
 
Question 2.9 Explain the business implication of using the Principal Component Analysis for this 
case study. How may PCs help in the further analysis? [Hint: Write Interpretations of the 
Principal Components Obtained] 
 
ANS: Reduces the dimensionality by dropping few principal components while none of the 
variable is dropped. With reduced multi collinearity models can be improved. 

PREPARED BY – UMESH KUMAR HASIJA SEP 2021 BATCH 
 
                                         Project: Advanced Statistics

 
Dimensionality Reduction: 
 The First PC explains 32% of variance 
 The First (2) PCs combined contributes to 58% variance 
 Similarly, by adding the first 6 component we can easily see that >80% variance can be 
explained. 
 Hence remaining PCs can be dropped reducing the components from 17 to 6 
 
Improving Signal to Noise ratio 
It helps to reduce the noise of minimize the data in mathematical space of concentration data 
on the axis for better results from ML models. Below is the covariance matrix post PCA 
application indicating that data/noise in mathematical space has been reduced with data now 
being concentrated only around the axis of the Principal Components. 

PREPARED BY – UMESH KUMAR HASIJA SEP 2021 BATCH 
 
                                         Project: Advanced Statistics

 
 
 
 
Question 2.10: Explain the business implication of using the Principal Component Analysis for 
this case study. How may PCs help in the further analysis? 
 
ANS: This business case study is about education dataset which contain the names of various 
colleges, which has various details of colleges and university. To understand more about the 
dataset, we perform univariate analysis and multivariate analysis which gives us the 
understanding about the variables. From analysis we can understand the distribution of the 
dataset, skew, and patterns in the dataset. From multivariate analysis we can understand the 
correlation of variables. Inference of multivariate analysis shows we can understand multiple 
variables highly correlated with each other. The scaling helps the dataset to standardize the 
variable in one scale. Outliers are imputed using IQR values once the values are imputed we can 
perform PCA. The principal component analysis is used reduce the multicollinearity between 
the variables. Depending on the variance of the dataset we can reduce the PCA components. 
The PCA components for this business case is 5 where we could understand the maximum 
variance of the dataset. Using the components we can now understand the reduced 
multicollinearity in the dataset 
 
PREPARED BY – UMESH KUMAR HASIJA SEP 2021 BATCH 
 

You might also like