aKMajorityRuleSimulation: aKMajorityRuleSimulation

Description Usage Arguments Value Examples

Description

Runs a series of proposals for J iterations, for all possible k-majority rules.

Usage

1
2
3
4
5
6
7
8
aKMajorityRuleSimulation(folderName, numberOfIterations, groupSize,
  utilityDistribution, utilityDistributionParameters, errorDistribution,
  errorDistributionParameters, groupPostFailingProposalMeanUiIncrease,
  maximumNumberOfProposalsInASeries, perProposalDecisionCost, silentSeries,
  silentIterations, outputTo, writeCSV, writeRObjects,
  plotExternalCostTotalCosts, plotExpectedUtilityDecCostTotalUtil,
  plotOnlyExternalCost, plotOnlyExpectedUtility, plotNumberOfRounds, plotPareto,
  printOutputToScreen)

Arguments

folderName

A user provided string for the output folder. The name will be output_folderName_on_08_11_2013_at_17_30_25

numberOfIterations

The number of iterations the model is run.

groupSize

This is a vector that has a length of numberOfGroups. Each element indicates the number of voters in each group. While the examples in the paper use 3 groups, the package can handle any number of groups.

utilityDistribution

The distribution the utility ui values will be drawn from. This can currently only be "normal".

utilityDistributionParameters

The relevant parameters needed for the distribution provided as utilityDistribution. You must provide a pair of parameters for each group. For "normal" you must provide the mean and standard deviation. For example for 5 groups and utilityDistribution="normal", you might provide c(-.7,.2,-.1,.2,0,.2,-.3,.2,.2,.2).

errorDistribution

The distribution the error ei values will be drawn from. This can be "uniform", "normal".

errorDistributionParameters

The relevant parameters needed for the distribution provided as errorDistribution. For "normal" you must provide the mean and standard deviation. For "uniform" you must provide the lower bound and upper bound. For example for 5 groups and errorDistribution="uniform", you might provide c(-.7,0,-.1,.3,0,.2,-.3,.2,-.2,.2).

groupPostFailingProposalMeanUiIncrease

The amount the mean used to sample a group's ui goes up after a failing proposal. Must be entered as a string vector.

maximumNumberOfProposalsInASeries

An intiger or FALSE. If an integer, it represents the maximum possible number of proposals considered by a group of voters in one series of votes. Note though, that even if if maximumNumberOfProposalsInASeries is set to an integer, that voting will still stop if a proposal passes for all kMajority Rules being considerd. To allow the series of proposals to anly stop once all kMajority Rules have passes a proposal, set maximumNumberOfProposalsInASeries=FALSE.

perProposalDecisionCost

The total decision costs a group faced given the number of rounds (R) it took to pass the proposal. Must be entered as a vector of strings.

silentSeries

TRUE silences all of the notifications from the running of a series of proposals like "The vote on the proposal in round 126 is complete. kMajorities that passed proposal: 84". FALSE prints all the notifications to the console as the series of proposals runs.

silentIterations

TRUE silences the notification that an iteration is complete, like "iteration 9 is complete.". FALSE prints all the notifications to the console as the iterations run.

outputTo

The working directory where you want the output from the simulation to be stored. The default uses your current working directory. Enter the directory as a string appropriate to your operating system, like outputTo="/Users/username/Documents/Foldername/Targetfoldername" or C:/Documents and Settings/username/My Documents/x/y/z"

writeCSV

TRUE writes out all of the input and output as CSV files for later use or inspection.

writeRObjects

TRUE writes out all the input and output as R objects using dput() for later use or inspection. See ?dput.

plotExternalCostTotalCosts

If TRUE creates two graphs. One has the decision cost, external cost and total cost for the worst groups. The other plots the same three costs, but for the mean groups. This is the main output presented in the paper.

plotExpectedUtilityDecCostTotalUtil

If TRUE creates two graphs. One has the decision cost, Expected Utility, Decision Costs and Total Utility for the worst groups. The other plots the same three measures, but for the mean groups. This is the main output presented in the paper.

plotOnlyExternalCost

If set to TRUE plots the external cost for the worst, mean and best groups.

plotOnlyExpectedUtility

If set to TRUE plots the expected utility for the worst, mean and best groups.

plotNumberOfRounds

If set to TRUE plots mean number of rounds it took for the status quo to be defeated for each k-majority rule, across all the iterations.

plotPareto

If set to TRUE plots the proportion of rounds with a failed Pareto Proposal.

printOutputToScreen

If set to TRUE prints a summary of the simulation output to the screen after the simulation is finished.

Value

Will stores all model input, output and graphs in provided working directory. The user can control which elemets to store and plot with the the write_____ and plot______ fundtion parameters detailed above. Use the printOutputToScreen=TRUE option to see summary output after the model runs.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
aKMajorityRuleSimulation(folderName="SimulationA",
                                                 numberOfIterations=100,
                                                 groupSize=c(35,30,35),
                                                 utilityDistribution=c("normal","normal","normal"),
                                                 utilityDistributionParameters=c(-.25,.25,0,.25,.25,.25),
                                                 errorDistribution=c("normal","normal","normal"),
                                                 errorDistributionParameters=c(0,.3,0,.3,0,.3),
                                                 groupPostFailingProposalMeanUiIncrease=c(".1",".1",".1"),
                                                 maximumNumberOfProposalsInASeries=FALSE,
                                                 perProposalDecisionCost=.01,
                                                 outputTo=getwd(),
                                                 silentSeries=FALSE,
                                                 silentIterations=FALSE,
                                                 writeCSV=FALSE,
                                                 writeRObjects=FALSE,
                                                 plotExternalCostTotalCosts=FALSE,
                                                 plotExpectedUtilityDecCostTotalUtil=FALSE,
                                                 plotOnlyExternalCost=FALSE,
                                                 plotOnlyExpectedUtility=FALSE,
                                                 plotNumberOfRounds=FALSE,
                                                 plotPareto=TRUE,
                                                 printOutputToScreen=TRUE)

codeForReviewer/kMajorityRule documentation built on May 13, 2019, 8:47 p.m.