Decision Trees (party) on Political Outcome Based on State-level Big Five Assessment

This decision tree demo is similar to a prior one I've done, but in this case, it uses the party package, that produces much higher-quality graphics than rpart, at least when used with plot. Although the idea for this analysis is mine, this was done as part of work for a Pluralsight training presentation, Data Mining Algorithms in SSAS, Excel, and R.

Source data is here.

 # Load Data  
 # Set working directory  
 # read from data frame  
 BigFivByState.df <- read.table("BigFiveScoresByState.csv", header = TRUE, sep = ",")  
 # Run Analysis  
 # Load package,   
 install.packages('party', dependencies = TRUE)  
 # train the model  
 BigFivByState.dt <- ctree(data = BigFivByState.df, Liberal ~ Openness + Conscientiousness + Extraversion + Neuroticism + Agreeableness)  
 # plot result  
 plot(BigFivByState.dt, uniform = TRUE, main = "Classification Tree for Politics on Big Five")  


Popular posts from this blog

Neural Networks in R (Part 2 of 4) - caret and nnet on State 'Personality' and Political Outcomes

Cultural Dimensions and Coffee Consumption

Charting Correlation Matrices in R