banzhaf {TUvalues} | R Documentation |
Calculate the Banzhaf value
banzhaf(
characteristic_func,
method = "exact",
n_rep = 10000,
n_players = 0,
replace = FALSE
)
characteristic_func |
The valued function defined on the subsets of the number of players. |
method |
Method used to calculate the Banzhaf value. Valid methods are:
|
n_rep |
Only used if |
n_players |
Only used if |
replace |
should sampling be with replacement? |
The Banzhaf value for each player
n <- 10
v <- function(coalition) {
if (length(coalition) > n/2) {
return(1)
} else {
return(0)
}
}
banzhaf(v, method = "exact", n_players = n)
banzhaf(v, method = "appro", n_rep = 4000, n_players = n, replace = TRUE)
v<-c(0,0,0,1,2,1,3)
banzhaf(v, method = "exact")
banzhaf(v, method = "appro", n_rep = 4000, replace = TRUE)