#' plotOnlyExpectedUtilityCost
#'
#' Plots the expected utility measures for the voters of interest, in the round the proposal passed, for each of the kMajority rules.
#' @param outputDataList The output data list of summaries, that is generated by the iterations() function
#' @return A plot of the mean, across all iterations, of the external cost incurred for each k-majority rule.
#' @export
plotOnlyExpectedUtility <- function(outputDataList){
x_axislabels <- seq(0,nrow(outputDataList$expectedUtility),by=10)
y_axislabels <- seq(-.5,.5,by=.1)
numberOfKMajorities <- nrow(outputDataList$expectedUtility)
xRange <- range(c(1:numberOfKMajorities))
yRange <- c(-.5,.5)
plot(xRange, yRange, type="n", xlab="k-majority", ylab="Expected Utility", axes=FALSE, frame=TRUE)
axis(side=1, at=x_axislabels)
axis(side=2, at=y_axislabels)
lines(c(1:numberOfKMajorities),outputDataList$expectedUtility$meanOfMeanVotersExpectedUtilityEachIteration, col = "Black", lwd = 2, lty = "solid")
lines(c(1:numberOfKMajorities),outputDataList$expectedUtility$meanOfworstOffGroupsMeanExpectedUtilityEachIteration, col = "Black", lwd = 2, lty = "dotted")
lines(c(1:numberOfKMajorities),outputDataList$expectedUtility$meanOfbestOffGroupsMeanExpectedUtilityEachIteration, col = "Black", lwd = 2, lty = "dotdash")
mtext(text=paste("Group Sizes:", paste(outputDataList$theInputParameters$groupSize, collapse=", ")),side=3,line=2.540,cex=.8,font=1)
mtext(text=paste("Utility:", paste(toupper(substring(outputDataList$allGroups[[1]]$utilityDistribution,1,1)),"(",outputDataList$allGroups[[1]]$utilityDistributionParam1,",",outputDataList$allGroups[[1]]$utilityDistributionParam2,")", collapse=", ", sep="")),side=3,line=1.50,cex=.8,font=1)
mtext(text=paste("Error:", paste(toupper(substring(outputDataList$allGroups[[1]]$errorDistribution,1,1)),"(",outputDataList$allGroups[[1]]$errorDistributionParam1,",",outputDataList$allGroups[[1]]$errorDistributionParam2,")", collapse=", ", sep="")),side=3,line=.5,cex=.8,font=1)
legend(70,.5, # places a legend at the appropriate place
c("Mean Voter","Worst Group", "Best Group"), # puts text in the legend
lty=c("solid", "dotted", "dotdash"), # gives the legend appropriate symbols (lines)
lwd=c(2,2,2),col=c("Black","Black","Black")) # gives the legend lines the correct color and width
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.