Description Usage Arguments Value Author(s) Examples
View source: R/calculateScenarios.r
This function simulates multiple scenarios for the iterative deferred acceptance mechanism with ties, implemented as stabsim3 within the matchingmarkets package. The results can be used to analyse the number of rounds necessary for the market to be cleared up to a specified threshold.
1 2 | calculateScenarios(scenarios, nruns = 10, nworkers = detectCores(),
seed = NULL, fullresult = FALSE)
|
scenarios |
list of lists containing the different scenarios. |
nruns |
integer indicating the number of markets to be simulated (results are averaged over all simulated markets). |
nworkers |
integer number of workers generated for the parallel package. |
fullresult |
boolean if true not only the aggregated rounds of iterations it returned but the full object of each run. |
calculateScenarios
returns a list of lists, which contains the following fields
occupancyrate |
double indicating the ratio of #students/#availableplaces |
nStudents |
integer indicating the number of students per market |
nColleges |
integer indicating the number of colleges per market |
threshold |
double influencing the number of decentrailzed rounds played. The mechanism terminates if the ratio of places, which are different in comparison to the finished mechanism are below this percentage value. |
areasize |
integer indicating the length of the grid used for the horizontal preferences. |
horizontalscenario |
integer (0,1,2) indicating which colleges uses horizontal preferences in their ranking (1=>all, 2=>only public colleges, 3=> none). |
conf.s.prefs |
vector representing the size of the tiers for students' ranking lists |
quota |
double between 0 and 1 indicating the percentage of private facilities |
Tobias Reischmann
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ## Simulate a set of different scenarios and return the average number of decentralized rounds played.
elem1 <- list(occupancyrate = .8, quota = .3, nStudents = 2700, nColleges = 600,
areasize = 7, conf.s.prefs = c(3,7,10,10), horizontalscenario = 1)
elem2 <- list(occupancyrate = .8, quota = .3, nStudents = 600, nColleges = 200,
areasize = 6, conf.s.prefs = c(2,5,6,7), horizontalscenario = 1)
elements <- list(elem1, elem2)
scenarios <- lapply(elements, function(elem) {
lapply(c(0.2,0.5), function(x){
elem$threshold <- x
elem
})
})
xdata <- calculateScenarios(scenarios, nruns=2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.