#Overall Results Bottom Line up Front: The programs are on track but require some performance improvement as do all programs.

#####################Read and Pre-Clean the Data#######################
library(psych) #to describe
library(reticulate) #to use Python in R as well
mydata=read.csv("C:/Users/lfult/OneDrive - Texas State University/MHA BHA BSHS Honors/AUPHA Materials/2014_2019.csv")
#str(mydata)
#########################################################################

#Descriptive Statistics / Univariate Graphs / Crosstabs

Descriptive analysis is broken down by BHA (n=91), MHA (n=50), BHA/MHA (n=11). For those who earned both the BHA and MHA, their responses are included in all three categories for completeness.

#############################Descriptives 1##############################
describe(mydata[,3:17])
##                 vars   n   mean     sd median trimmed    mad min max range
## Last*              1 491 168.62  96.89    167  169.63 126.02   1 330   329
## TexasStateName*    2 490  21.51  35.87      1   13.98   0.00   1 111   110
## Address*           3 491 196.04 126.90    194  195.14 164.57   1 413   412
## City*              4 491  74.47  52.57     77   73.67  87.47   1 162   161
## State*             5 491  31.30   8.79     31   33.49   8.90   1  40    39
## Zip*               6 491 134.30  65.86    148  138.69  68.20   1 242   241
## Email*             7 491 183.85 111.79    186  183.49 146.78   1 378   377
## Business*          8 491  95.67  88.34     82   89.38 120.09   1 261   260
## Title*             9 491  87.81  87.22     64   79.69  93.40   1 259   258
## BusAddress*       10 491  71.40  79.73     36   61.44  51.89   1 244   243
## BusCity*          11 491  31.97  35.55      7   27.78   8.90   1 113   112
## BusState*         12 491  19.61  15.17     29   19.96   8.90   1  39    38
## BusZip*           13 491  50.45  51.19     36   45.81  51.89   1 156   155
## BusPhone*         14 491  46.29  63.23      1   35.23   0.00   1 200   199
## BusEmail*         15 491  59.74  73.58     10   48.82  13.34   1 226   225
##                  skew kurtosis   se
## Last*           -0.05    -1.20 4.37
## TexasStateName*  1.43     0.38 1.62
## Address*         0.04    -1.27 5.73
## City*            0.09    -1.53 2.37
## State*          -2.26     4.55 0.40
## Zip*            -0.52    -0.85 2.97
## Email*           0.01    -1.22 5.05
## Business*        0.35    -1.38 3.99
## Title*           0.48    -1.27 3.94
## BusAddress*      0.68    -1.01 3.60
## BusCity*         0.74    -0.99 1.60
## BusState*       -0.30    -1.78 0.68
## BusZip*          0.43    -1.37 2.31
## BusPhone*        1.10    -0.26 2.85
## BusEmail*        0.88    -0.72 3.32
par(mfrow=c(1,1))


boxplot(mydata$Q32.MonthstoEmployment~mydata$Degree, horizontal=TRUE, col=c("red", "blue", "green", xlab="Months"), main="Time to Employment by Degree")

boxplot(mydata$Q33.AnnualSalary1000s~mydata$Degree, horizontal=TRUE, col=c("red","blue","green"), main="Salary in 1000's by Degree")

plot(mydata$Q33.AnnualSalary1000s~mydata$YearsSinceGrad, ylab="Salary in 1000's", xlab="Years Since Graduation", col="red", pch=20)

abline(lm(mydata$Q33.AnnualSalary1000s~mydata$YearsSinceGrad), col="black")

mygraph=function(x,lab){

ggplot(mydata, aes(x=x, group=Degree))+
geom_bar(aes(y = ..prop.., fill = factor(..x..)), stat="count") +
geom_text(aes( label = scales::percent(..prop..),
y= ..prop.. ), stat= "count", vjust=-.1)+
facet_wrap(~Degree)+
scale_y_continuous(labels = scales::percent)+
ylab("Percent")+
xlab(lab)+
theme(axis.text.x = element_text(angle = 90, hjust = 1))+
guides(fill=FALSE)
}

mygraph(mydata$Q26.Recommend, "Recommend?")

mygraph(mydata$Q16.1.Curriculum, "Curriculum")

mygraph(mydata$Q16.2.FacultyTeaching, "Faculty Teaching")

mygraph(mydata$Q16.3FieldPlacementExperience, "Field Placement Experience")

mygraph(mydata$Q16.4.SOHAFacilities, "SOHA Facilities")

mygraph(mydata$Q16.5.AlumniRelations, "Alumni Relations")

mygraph(mydata$Q18.1.Leadership, "Prepared me for Leadership")

mygraph(mydata$Q18.2.BusinessSkills, "Provided Business Skills")

mygraph(mydata$Q18.3.Professionalism, "Prepared me for Professionalism")

mygraph(mydata$Q18.4.KnowledgeofHCEnvironment, "Provided Knowledge of HC Environment")

mygraph(mydata$Q18.5.CRM, "Prepared for Communication & Relationship Mgt")

mygraph(mydata$Q19.PrepforMgtPosition, "Curriculum Prepared for Mgt Position")

mygraph(mydata$Q20.FieldExpPrepforMgt, "Field Experience Prepared for Mgt Position")

mygraph(mydata$Q22.1.FinMgt, "Course:  Financial Mgt")

mygraph(mydata$Q22.2.PatMgtQI, "Course:  Patient Mgt & QI")

mygraph(mydata$Q22.3.HIMCourse, "Course: HIM")

mygraph(mydata$Q22.4.HealthLaw, "Course:  Health Law")

mygraph(mydata$Q22.5.EthicsOB, "Course:  Ethics / OB")

mygraph(mydata$Q22.6.Marketing, "Course: Marketing")

mygraph(mydata$Q22.7.HRM,"HRM")

mygraph(mydata$Q22.8.HCCulture, "Health Care History & Culture")

mygraph(mydata$Q22.9.StratMgt, "Strategic Management")

#########################################################################