Skip to main content

ANOVA with Hofstede's Cultural Values and Economic Outcomes

While in B-School, back around 2002, I considered trying to get published, partially because I had done well enough in economics and finance - A's in everything, and disturbed the curve in Financial Economics - to be a member of the International Economics Honor Society, which came with a subscription to American Economics, and that came with an opportunity to publish. Nothing came of it, other than highly illuminating correlations between income inequality (Gini Coefficient) and negative social outcomes, but I kept the data, and can now use it with R. To make the data more relevant to ongoing political discourse, it was limited to developed countries in the OECD. The data file is linked via Google Drive at the end of this post.

Countries
 
[1] Australia      Austria        Belgium        Canada         Denmark       
[6] Finland        France         Germany        Greece         Iceland       
[11] Ireland        Italy          Japan          Korea          Luxembourg    
[16] Netherlands    New Zealand    Norway         Portugal       Spain         
[21] Sweden         Switzerland    United Kingdom United States   


Data Columns
 
 [1] "Country"                       "HofstederPowerDx"             
 [3] "HofstederIndividuality"        "HofstederMasculinity"         
 [5] "HofstederUncertaintyAvoidance" "Diversity_Ethnic"             
 [7] "Diversity_Linguistic"          "Diversity_Religious"          
 [9] "ReligionMatters"               "Protestantism"                
[11] "Religiosity"                   "IQ"                           
[13] "Gini"                          "Employment"                   
[15] "Unemployment"                  "EduReading"                   
[17] "EduScience"                    "TertiaryEdu"                  
[19] "LifeExpectancy"                "InfantDeath"                  
[21] "Obesity"                       "HoursWorked"                  
[23] "Prison"                        "Carvandalism"                 
[25] "Cartheft"                      "Theftfromcar"                 
[27] "Motorcycletheft"               "Bicycletheft"                 
[29] "Assaultsandthreats"            "Sexualincidents"              
[31] "Burglaries"                    "Robberies"                    


Example Code
 
 #ANOVA  
 rm(list = ls())  
 
 oecdData <- read.table("OECD - Quality of Life.csv", header = TRUE, sep = ",")  
 
 print(is.data.frame(oecdData))  
 print(ncol(oecdData))  
 print(nrow(oecdData))  
 print(summary(oecdData))  
 print(names(oecdData))  
 
 v1 <- aov(Gini ~ HofstederIndividuality * HofstederMasculinity, data = oecdData)  
 v2 <- aov(Gini ~ HofstederIndividuality + HofstederMasculinity, data = oecdData)  
 result <- anova(v1, v2)  
 print(summary(v1))  
 print(summary(v2))  
 print(result)  
  


Example Results

 > v1 <- aov(Gini ~ HofstederIndividuality * HofstederMasculinity, data = oecdData)  
 + v2 <- aov(Gini ~ HofstederIndividuality + HofstederMasculinity, data = oecdData)  
 + result <- anova(v1, v2)  
 + print(summary(v1))  
 + print(summary(v2))  
 + print(result)  
                                               Df Sum Sq Mean Sq F value Pr(>F)  
 HofstederIndividuality                        1  4.00   4.00    0.283   0.60097  
 HofstederMasculinity                          1 46.87   46.87   3.318   0.08519  
 HofstederIndividuality:HofstederMasculinity   1 188.07  188.07  13.315  0.00184  
 Residuals                                    18 254.26  14.13          
 HofstederIndividuality              
 HofstederMasculinity            .   
 HofstederIndividuality:HofstederMasculinity **  
 Residuals                     
 ---  

 Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1  

 3 observations deleted due to missingness  

                            Df Sum Sq Mean Sq F value Pr(>F)  
 HofstederIndividuality     1  4.0    4.00    0.172   0.683  
 HofstederMasculinity       1  46.9   46.87   2.013   0.172  
 Residuals                 19  442.3  23.28          

 3 observations deleted due to missingness  

 Analysis of Variance Table  
 Model 1: Gini ~ HofstederIndividuality * HofstederMasculinity  
 Model 2: Gini ~ HofstederIndividuality + HofstederMasculinity  
 
 Res.Df  RSS    Df  Sum of Sq   F      Pr(>F)    
 1   18  254.26                  
 2   19  442.33 -1  -188.07     13.315 0.001836 **  
 ---  
 
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1  



Sample Data

Popular posts from this blog

Decision Tree in R, with Graphs: Predicting State Politics from Big Five Traits

This was a continuation of prior explorations, logistic regression predicting Red/Blue state dichotomy by income or by personality. This uses the same five personality dimensions, but instead builds a decision tree. Of the Big Five traits, only two were found to useful in the decision tree, conscientiousness and openness.

Links to sample data, as well as to source references, are at the end of this entry.

Example Code

# Decision Tree - Big Five and Politics library("rpart") # grow tree input.dat <- read.table("BigFiveScoresByState.csv", header = TRUE, sep = ",") fit <- rpart(Liberal ~ Openness + Conscientiousness + Neuroticism + Extraversion + Agreeableness, data = input.dat, method="poisson") # display the results printcp(fit) # visualize cross-validation results plotcp(fit) # detailed summary of splits summary(fit) # plot tree plot(fit, uniform = TRUE, main = "Classific…

Mean Median, and Mode with R, using Country-level IQ Estimates

Reusing the code posted for Correlations within with Hofstede's Cultural Values, Diversity, GINI, and IQ, the same data can be used for mean, median, and mode. Additionally, the summary function will return values in addition to mean and median, Min, Max, and quartile values:

Example Code
oecdData <- read.table("OECD - Quality of Life.csv", header = TRUE, sep = ",") v1 <- oecdData$IQ # Mean with na.rm = TRUE removed NULL avalues mean(v1, na.rm = TRUE) # Median with na.rm = TRUE removed NULL values median(v1, na.rm = TRUE) # Returns the same data as mean and median, but also includes distribution values: # Min, Quartiles, and Max summary(v1) # Mode does not exist in R, so we need to create a function getmode <- function(v) { uniqv <- unique(v) uniqv[which.max(tabulate(match(v, uniqv)))] } #returns the mode getmode(v1)
Example Results
> oecdData <- read.table("OECD - Quality of L…

Chi-Square in R on by State Politics (Red/Blue) and Income (Higher/Lower)

This is a significant result, but instead of a logistic regression looking at the income average per state and the likelihood of being a Democratic state, it uses Chi-Square. Interpreting this is pretty straightforward, in that liberal states typically have cities and people that earn more money. When using adjusted incomes, by cost of living, this difference disappears.

Example Code
# R - Chi Square rm(list = ls()) stateData <- read.table("CostByStateAndSalary.csv", header = TRUE, sep = ",") # Create vectors affluence.median <- median(stateData$Y2014, na.rm = TRUE) affluence.v <- ifelse(stateData$Y2014 > affluence.median, 1, 0) liberal.v <- stateData$Liberal # Solve pol.Data = table(liberal.v, affluence.v) result <- chisq.test(pol.Data) print(result) print(pol.Data)
Example Results
Pearson's Chi-squared test with Yates' continuity correction data: pol.Data X-squared = 12.672, df …