-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.R
51 lines (38 loc) · 1.9 KB
/
main.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# --------------------------------------------------------------------------- #
# --------------------------------------------------------------------------- #
# #
# The PMT SILAC Analyzer Script #
# #
# --------------------------------------------------------------------------- #
# --------------------------------------------------------------------------- #
# =========================================================================== #
# #
######### LOADING FUNCTIONS #########
# #
# =========================================================================== #
### Load all functions
# List files in "R/"
fnFunc <- list.files(path = "functions/", recursive=T, full.names = TRUE)
# Source all functions
for(i in 1:length(fnFunc)){
source(fnFunc[i])
}
# =========================================================================== #
# #
######### TESTING THE FUNCTIONS #########
# #
# =========================================================================== #
#### Bionomincal Distribution ####
# # formulars
# P(X=r) = nCr * p^r * (1-p)^(n-r)
# nCr = n! / ((n-r)! * r!)
# parameters
p <- 0.5
n <- 7
r <- 2
for(n in 1:10){
prob <- minSuc(p,n,r)
cat("Dice Pool of", n, "at Difficulty", r, "=", prob, "\n")
}
#### Monte Carlo Simulation ####
V5stats(7,2,2, nMC = 20000)