r - Appropriate ways to show scores in relation to population percentile -
i have data set 8 variables , on 300 observations (participants). these observations randomly divided 10 groups. each participant perform same set of tasks.
for each group, want draw graph illustrates how performs in terms of mean scores land in overall percentile.
i did googling , found graph below. graph 1 group of participants , each bar represents single task. performance labels produced dividing overall score (of each task) 5 percentile groups (10%, 20%, 40%, 20%, 10%) respectively.
is there way draw in either r, spss, or excel?
thanks
in r :
a=c(0.1,0.4,0.5,0.6,0.9) # containes result per category in vector barplot(a, names.arg=c("cat1", "cat2", "cat3","cat4","cat5"),horiz=true,xlim=c(0,1),ylim=c(0,6.5)) # add vertical lines abline(v=c(0.25,0.5,0.75),col='red') # add text text(0.1, y =6.3, labels = 'low') text(0.4, y =6.3, labels = 'average') text(0.6, y =6.3, labels = 'high') text(0.85, y =6.3, labels = 'very high') pretty basic customize further if want to.
edit : add code compute quantile on different categories. assume have r dataframe 2 columns, 1 cointaining result name "col" , 1 containing category named category.
then code work :
# df dataframe in data stored all_categories = unique(df$category) n=length(all_categories) results_category=rep(0,n) # q percentile have compute 0.5 median q_wanted=0.5 (i in (1:n)){ results_category[i] = quantile(x=df$col[df$category==all_categories[i]],prob=q_wanted) } barplot(results_category, names.arg=all_categories,horiz=true,xlim=c(0,1),ylim=c(0,5)) abline(v=c(0.25,0.5,0.75),col='red') text(0.1, y =4, labels = 'low') text(0.4, y =4, labels = 'average') text(0.6, y =4, labels = 'high') 

Comments
Post a Comment