]> code.communitydata.science - coldcallbot-discord.git/blob - assessment_and_tracking/simulation.R
fix an ordering bug with grade creation
[coldcallbot-discord.git] / assessment_and_tracking / simulation.R
1 weight.fac <- 2
2 num.calls <- 373
3 num.students <- 76
4
5 gen.calls.per.students <- function (x) {
6     raw.weights <<- rep(1, num.students)
7     names(raw.weights) <- seq(1, num.students)
8
9     table(sapply(1:num.calls, function (i) {
10         probs <- raw.weights / sum(raw.weights)
11         selected <- sample(names(raw.weights), 1, prob=probs)
12         ## update the raw.weights
13         raw.weights[selected] <<- raw.weights[selected] / weight.fac
14                                         #print(raw.weights)
15         return(selected)
16     }))
17 }
18
19
20 simulated.call.list <- unlist(lapply(1:1000, gen.calls.per.students))
21 hist(simulated.call.list)
22
23 quantile(simulated.call.list, probs=seq(0,1,by=0.01))
24 quantile(simulated.call.list, probs=0.05)

Community Data Science Collective || Want to submit a patch?