Saturday, February 13, 2016

Creating Graphs

Using data from the Gapminder codebook: female employ rate  and urban rate. The data output was generated using SAS Studio.


Hypothesis formulation
Based on research review, it appears that while more women have joined the labor force thanks to urbanization, they have encountered several cultural and social obstacles that have negatively impacted their employment rates. It would be interesting to study the correlation between urbanization and the female employment rate in the Gapminder dataset. Hypothesis: Higher urbanization rates lead to lower female employment rates.



Univariate Graphs
  • Female employ rate:
  • The histogram generated by the female employ rate is unimodal. The mean (47.5) and the median (47.5) averages are similar and only just higher than the mode average of 42.1. There are more female employ rate values that fall below the mean average. The standard deviation is only 14.6 (low variability) and the range is 72. The combination of all these factors results in a distribution that is almost symmetrical.  Even though the mode average is lower than the mean and median averages, the small standard deviation and the similarities of the mean and median averages prevent the distribution from being skewed, bimodal or from having an even distribution.
  • Employ rate:
  • The histogram generated by the employ rate variable is unimodal. The mean average (58.6) is close to the median average (58.7), and the mode is much lower (47.3). The standard deviation is only 10.5 (low variability) and the range is 51.2. The combination of all these factors results in a distribution with a slight left skew, as the most frequent employ rate values (mode average) fall below the mean and median averages, with very little variation in values. The low range also prevents the left skew from being too pronounced.
  • Urban Rate:
  • The histogram generated by the urban rate variable is also unimodal but has a pronounced skewed-left distribution. This is due to a combination of a high (89.6) spread or range of values, a high standard deviation or variability (23.8), and a significantly high mode average (100), indicating that the most frequent urban rate values are higher than the mean (56.8) and median (57.9) averages.

Bivariate Graphs
The scatter plot generated between the female employ rate (response variable) and the urban rate (explanatory variable) shows a weak and decreasing or negative relationship between the two variables. An increase in the urban rate shows a decrease in the female employ rate. The weak relationship is indicated by the larger distances between scatter plots.



Code:


/** Exploring the data using PROC MEANS to produce statistics **/
PROC MEANS DATA=NEW N NMISS MEAN MODE MEDIAN MIN MAX STD RANGE ;
RUN;
The MEANS Procedure






VariableNN MissMeanModeMedianMinimumMaximumStd DevRange
femaleemployrate
employrate
urbanrate
178
178
203
35
35
10
47.5494381
58.6359551
56.7693596
42.0999985
47.2999992
100.0000000
47.5499992
58.6999989
57.9400000
11.3000002
32.0000000
10.4000000
83.3000031
83.1999969
100.0000000
14.6257425
10.5194545
23.8449326
72.0000029
51.1999969
89.6000000



/** UNIVARIATE GRAPHS - use GCHART/CHART for single categorical varuables**/
TITLE 'Female Employment Rate Vertical Bar Chart ';
PROC CHART DATA=NEW;
VBAR FemaleEmploymentRateGroup / DISCRETE /**Specify vertical bars for numeric discrete/categorical          variables**/
TYPE=PCT   /** Specify the statistic(percentage) represented in the chart**/
WIDTH=10   /** Specify the width of bars **/ 
        SPACE=2;   /** Specify the spaces between bars **/
RUN;

TITLE 'Employment Rate Vertical Bar Chart ';
PROC CHART DATA=NEW;
VBAR EmploymentRateGroup / DISCRETE
TYPE=PCT  
WIDTH=10  
        SPACE=2;  
RUN;

TITLE 'Urbanization Rate Vertical Bar Chart ';
PROC CHART DATA=NEW;
VBAR UrbanizationRateGroup / DISCRETE 
TYPE=PCT 
WIDTH=10   
        SPACE=2;   
RUN;


/** BIVARIATE GRAPHS **/
PROC PLOT DATA=NEW;  /**  Plots the values of two variables for each observation **/
PLOT femaleemployrate * urbanrate;
RUN;


SAS results:







Female Employment Rate Vertical Bar Chart
                           Percentage                                                                                               
                                                                                                                                    
                              |                                      **********                                                     
                              |                                      **********                                                     
                           40 +                                      **********                                                     
                              |                                      **********                                                     
                              |                                      **********                                                     
                              |                                      **********                                                     
                              |                                      **********                                                     
                           35 +                                      **********                                                     
                              |                                      **********                                                     
                              |                                      **********                                                     
                              |                                      **********                                                     
                              |                          **********  **********                                                     
                           30 +                          **********  **********                                                     
                              |                          **********  **********                                                     
                              |                          **********  **********                                                     
                              |                          **********  **********                                                     
                              |                          **********  **********                                                     
                           25 +                          **********  **********                                                     
                              |                          **********  **********                                                     
                              |                          **********  **********                                                     
                              |                          **********  **********                                                     
                              |                          **********  **********                                                     
                           20 +                          **********  **********                                                     
                              |                          **********  **********                                                     
                              |                          **********  **********                                                     
                              |                          **********  **********                                                     
                              |                          **********  **********                                                     
                           15 +                          **********  **********                                                     
                              |                          **********  **********                                                     
                              |                          **********  **********                                                     
                              |                          **********  **********  **********                                         
                              |                          **********  **********  **********                                         
                           10 +                          **********  **********  **********                                         
                              |                          **********  **********  **********                                         
                              |              **********  **********  **********  **********                                         
                              |              **********  **********  **********  **********                                         
                              |              **********  **********  **********  **********                                         
                            5 +              **********  **********  **********  **********  **********                             
                              |              **********  **********  **********  **********  **********                             
                              |              **********  **********  **********  **********  **********                             
                              |  **********  **********  **********  **********  **********  **********                             
                              |  **********  **********  **********  **********  **********  **********                             
                              ---------------------------------------------------------------------------                           
                                      1           2           3           4           5           6                                 
                                                                                                                                    
                                                       FemaleEmploymentRateGroup                                                    

Employment Rate Vertical Bar Chart
                           Percentage                                                                                               
                                                                                                                                    
                              |                                      **********                                                     
                              |                                      **********                                                     
                              |                                      **********                                                     
                           40 +                                      **********                                                     
                              |                                      **********                                                     
                              |                                      **********                                                     
                              |                                      **********                                                     
                              |                                      **********                                                     
                           35 +                                      **********                                                     
                              |                                      **********                                                     
                              |                                      **********                                                     
                              |                                      **********                                                     
                              |                                      **********                                                     
                           30 +                                      **********                                                     
                              |                                      **********                                                     
                              |                                      **********                                                     
                              |                                      **********                                                     
                              |                                      **********                                                     
                           25 +                                      **********                                                     
                              |                                      **********                                                     
                              |                          **********  **********                                                     
                              |                          **********  **********                                                     
                              |                          **********  **********                                                     
                           20 +                          **********  **********                                                     
                              |                          **********  **********                                                     
                              |                          **********  **********                                                     
                              |                          **********  **********                                                     
                              |                          **********  **********  **********                                         
                           15 +                          **********  **********  **********                                         
                              |                          **********  **********  **********                                         
                              |                          **********  **********  **********                                         
                              |                          **********  **********  **********                                         
                              |                          **********  **********  **********                                         
                           10 +              **********  **********  **********  **********                                         
                              |              **********  **********  **********  **********                                         
                              |              **********  **********  **********  **********  **********                             
                              |              **********  **********  **********  **********  **********                             
                              |              **********  **********  **********  **********  **********                             
                            5 +              **********  **********  **********  **********  **********                             
                              |              **********  **********  **********  **********  **********                             
                              |              **********  **********  **********  **********  **********                             
                              |              **********  **********  **********  **********  **********                             
                              |  **********  **********  **********  **********  **********  **********                             
                              ---------------------------------------------------------------------------                           
                                      1           2           3           4           5           6                                 
                                                                                                                                    
                                                          EmploymentRateGroup                                                       

Urbanization Rate Vertical Bar Chart
                           Percentage                                                                                               
                                                                                                                                    
                              |                                                  **********                                         
                           24 +                                                  **********                                         
                              |                                                  **********  **********                             
                              |                                                  **********  **********                             
                              |                                                  **********  **********                             
                           22 +                                                  **********  **********                             
                              |                                                  **********  **********                             
                              |                                                  **********  **********                             
                              |                                                  **********  **********                             
                           20 +                                                  **********  **********                             
                              |                                                  **********  **********                             
                              |                                                  **********  **********                             
                              |                                                  **********  **********                             
                           18 +                                                  **********  **********                             
                              |                                                  **********  **********                             
                              |                          **********  **********  **********  **********                             
                              |                          **********  **********  **********  **********                             
                           16 +                          **********  **********  **********  **********                             
                              |                          **********  **********  **********  **********                             
                              |              **********  **********  **********  **********  **********                             
                              |              **********  **********  **********  **********  **********                             
                           14 +              **********  **********  **********  **********  **********                             
                              |              **********  **********  **********  **********  **********                             
                              |              **********  **********  **********  **********  **********                             
                              |              **********  **********  **********  **********  **********                             
                           12 +              **********  **********  **********  **********  **********                             
                              |              **********  **********  **********  **********  **********                             
                              |              **********  **********  **********  **********  **********                             
                              |              **********  **********  **********  **********  **********                             
                           10 +              **********  **********  **********  **********  **********                             
                              |              **********  **********  **********  **********  **********                             
                              |              **********  **********  **********  **********  **********                             
                              |              **********  **********  **********  **********  **********                             
                            8 +              **********  **********  **********  **********  **********                             
                              |              **********  **********  **********  **********  **********                             
                              |              **********  **********  **********  **********  **********                             
                              |              **********  **********  **********  **********  **********                             
                            6 +              **********  **********  **********  **********  **********                             
                              |              **********  **********  **********  **********  **********                             
                              |              **********  **********  **********  **********  **********                             
                              |              **********  **********  **********  **********  **********                             
                            4 +              **********  **********  **********  **********  **********                             
                              |              **********  **********  **********  **********  **********                             
                              |              **********  **********  **********  **********  **********                             
                              |  **********  **********  **********  **********  **********  **********                             
                            2 +  **********  **********  **********  **********  **********  **********                             
                              |  **********  **********  **********  **********  **********  **********                             
                              |  **********  **********  **********  **********  **********  **********                             
                              |  **********  **********  **********  **********  **********  **********                             
                              ---------------------------------------------------------------------------                           
                                      1           2           3           4           5           6                                 
                                                                                                                                    
                                                         UrbanizationRateGroup                                                      

Urbanization Rate Vertical Bar Chart
                              Plot of femaleemployrate*urbanrate.  Legend: A = 1 obs, B = 2 obs, etc.                               
                                                                                                                                    
femaleemployrate |                                                                                                                  
              90 +                                                                                                                  
                 |                                                                                                                  
                 |                                                                                                                  
                 |                                                                                                                  
                 |  A                                                                                                               
                 |                                  A                                                                               
              80 +      A     A            A                                                                                        
                 |                           A   A                                                                                  
                 |                     A                                                                                            
                 |             A                                                                                                    
                 |          A     A                                                                                                 
                 |                                                                                                                  
              70 +                                                          A                                          A            
                 |     A       A         A                  A                                                                       
                 |                A     A      A                                                                                    
                 |                              A                           A   A                                                   
                 |                                   AA             A                                                               
                 |                                                                     A             A                              
              60 +                        A             A                                     A             A                       
                 |                                   A   A                    A                         A       B               A   
                 |                                         A          A            A            A         A  A                      
                 |           A           A                                                       AA       A       A                 
                 |                       A         AA             A             A   A          A              AA    A               
                 |            A  A                                           A    B        AA                                   B   
              50 +      A              AA   A    A  A             A            A         AB                                         
                 |                                  A     A            AA   A           A       B         A                         
                 |                    A                                               A A       A          A          BB            
                 |                                       A                  A    A     A             A                  A           
                 |                                        A       A   A  A      A           A   A  A                                
                 |                        A          A          A                 A          A       A                       AA     
              40 +        A                      A     A                     A      A    A A         A                     A        
                 |          A                                      A  A        A A                                                  
                 |                                  A      A      A    A    A                        A                              
                 |                             A                AB               A   A    A                       A           A     
                 |                                                                                                                  
                 |                         A                                          A                                             
              30 +                                                                                A               A      A          
                 |                                          A                                                                       
                 |                                                                      A A                                         
                 |                   A                                                                                              
                 |                                                                            A      A                              
                 |                                                         A            A A                     A                   
              20 +                           A                                                                                      
                 |                                 A       A                                               A                        
                 |                                                       A                                                          
                 |                                                                                                                  
                 |                                                                                    A                             
                 |                                                                      A     A                                     
              10 +                                                                                                                  
                 ---+-----------+-----------+-----------+-----------+-----------+-----------+-----------+-----------+-----------+-- 
                   10          20          30          40          50          60          70          80          90          100  
                                                                                                                                    
                                                                      urbanrate                                                     
                                                                                                                                    
NOTE: 40 obs had missing values.                                                                                                    





No comments:

Post a Comment