Network Visualization of Key Driver Analysis
Want to share your content on Rbloggers? click here if you have a blog, or here if you don't.
Standardized Regression Weights


Sat

Recommend

Fly Again


(Intercept)

0.00

0.00

0.00

Easy Reservation

0.05

0.16

0.12

Preferred Seats

0.04

0.15

0.14

Flight Options

0.05

0.11

0.14

Ticket Prices

0.04

0.06

0.10

Seat Comfort

0.09

0.09

0.03

Seat Roominess

0.07

0.17

0.10

Overhead Storage

0.02

0.19

0.16

Clean Aircraft

0.10

0.15

0.09

Courtesy

0.06

0.00

0.01

Friendliness

0.15

0.00

0.01

Helpfulness

0.13

0.02

0.10

Service

0.14

0.09

0.05

RSquared

0.59

0.61

0.63

Appendix
qgraph(cor(ratings),layout=”spring”, groups=gr, labels=names(ratings), label.scale=FALSE, minimum=0.50)
The author is Sacha Epskamp . He works with the PsychoSystems Project. Either of the following two links will take you to web sites that will explain qgraph and the network visualization approach in greater depth: http://sachaepskamp.com/or http://www.psychosystems.org/.
R Code to Generate the Simulated Data and Run All Analyses
# The goal is to show all the R code that you would need
# to reproduce everything that has been reported.
# We will use the mvtnorm package in order to randomly
# generate a data set with a given correlation pattern.
# First, we create a matrix of factor loadings.
# This pattern is called bifactor because it has a
# general factor with loadings from all the items
# and specific factors for separate components.
# The outcome variables are also formed as
# combinations of these general and specific factors.
loadings < matrix(c (
.33, .58, .00, .00, # Ease of Making Reservation
.35, .55, .00, .00, # Availability of Preferred Seats
.30, .52, .00, .00, # Variety of Flight Options
.40, .50, .00, .00, # Ticket Prices
.50, .00, .55, .00, # Seat Comfort
.41, .00, .51, .00, # Roominess of Seat Area
.45, .00, .57, .00, # Availability of Overhead Storage
.32, .00, .54, .00, # Cleanliness of Aircraft
.35, .00, .00, .50, # Courtesy
.38, .00, .00, .57, # Friendliness
.60, .00, .00, .50, # Helpfulness
.52, .00, .00, .58, # Service
.43, .10, .20, .30, # Overall Satisfaction
.35, .50, .40, .20, # Purchase Intention
.25, .50, .50, .00), # Willingness to Recommend
nrow=15,ncol=4, byrow=TRUE)
# Matrix multiplication produces the correlation matrix,
# except for the diagonal.
cor_matrix<loadings %*% t(loadings)
# Diagonal set to ones.
diag(cor_matrix)<1
library(mvtnorm)
N=1000
set.seed(7654321) #needed in order to reproduce the same data each time
std_ratings<as.data.frame(rmvnorm(N, sigma=cor_matrix))
# Creates a mixture of two data sets:
# first 50 observations assinged uniformly lower scores.
ratings<data.frame(matrix(rep(0,15000),nrow=1000))
ratings[1:50,]<std_ratings[1:50,]*2
ratings[51:1000,]<std_ratings[51:1000,]*2+7.0
# Ratings given different means
ratings[1]<ratings[1]+2.2
ratings[2]<ratings[2]+0.6
ratings[3]<ratings[3]+0.3
ratings[4]<ratings[4]+0.0
ratings[5]<ratings[5]+1.5
ratings[6]<ratings[6]+1.0
ratings[7]<ratings[7]+0.5
ratings[8]<ratings[8]+1.5
ratings[9]<ratings[9]+2.4
ratings[10]<ratings[10]+2.2
ratings[11]<ratings[11]+2.1
ratings[12]<ratings[12]+2.0
ratings[13]<ratings[13]+1.5
ratings[14]<ratings[14]+1.0
ratings[15]<ratings[15]+0.5
# Truncates Scale to be between 1 and 9
ratings[ratings>9]<9
ratings[ratings<1]<1
# Rounds to single digit.
ratings<round(ratings,0)
# Assigns names to the variables in the data frame called ratings
names(ratings)=c(
"Easy_Reservation",
"Preferred_Seats",
"Flight_Options",
"Ticket_Prices",
"Seat_Comfort",
"Seat_Roominess",
"Overhead_Storage",
"Clean_Aircraft",
"Courtesy",
"Friendliness",
"Helpfulness",
"Service",
"Satisfaction",
"Fly_Again",
"Recommend")
# Calls qgraph package to run Network Map
library(qgraph)
# creates grouping of variables to be assigned different colors.
gr<list(1:4,5:8,9:12,13:15)
qgraph(cor(ratings),layout="spring", groups=gr, labels=names(ratings), label.scale=FALSE, minimum=0.50)
# Calculates zscores so that regression analysis will yield
# standardized regression weights
scaled_ratings<data.frame(scale(ratings))
ols.sat<lm(Satisfaction~Easy_Reservation + Preferred_Seats +
Flight_Options + Ticket_Prices + Seat_Comfort + Seat_Roominess +
Overhead_Storage + Clean_Aircraft + Courtesy + Friendliness +
Helpfulness + Service, data=scaled_ratings)
summary(ols.sat)
ols.rec<lm(Recommend ~ Easy_Reservation + Preferred_Seats +
Flight_Options + Ticket_Prices + Seat_Comfort + Seat_Roominess +
Overhead_Storage + Clean_Aircraft + Courtesy + Friendliness +
Helpfulness + Service, data=scaled_ratings)
summary(ols.rec)
ols.fly<lm(Fly_Again ~ Easy_Reservation + Preferred_Seats +
Flight_Options + Ticket_Prices + Seat_Comfort + Seat_Roominess +
Overhead_Storage + Clean_Aircraft + Courtesy + Friendliness +
Helpfulness + Service, data=scaled_ratings)
summary(ols.fly)
Rbloggers.com offers daily email updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/datascience job.
Want to share your content on Rbloggers? click here if you have a blog, or here if you don't.