R : Copyright 2005, The R Foundation for Statistical Computing Version 2.1.1 (2005-06-20), ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for a HTML browser interface to help. Type 'q()' to quit R. > ### *
> ### > attach(NULL, name = "CheckExEnv") > assign(".CheckExEnv", as.environment(2), pos = length(search())) # base > ## add some hooks to label plot pages for base and grid graphics > setHook("plot.new", ".newplot.hook") > setHook("persp", ".newplot.hook") > setHook("grid.newpage", ".gridplot.hook") > > assign("cleanEx", + function(env = .GlobalEnv) { + rm(list = ls(envir = env, all.names = TRUE), envir = env) + RNGkind("default", "default") + set.seed(1) + options(warn = 1) + delayedAssign("T", stop("T used instead of TRUE"), + assign.env = .CheckExEnv) + delayedAssign("F", stop("F used instead of FALSE"), + assign.env = .CheckExEnv) + sch <- search() + newitems <- sch[! sch %in% .oldSearch] + for(item in rev(newitems)) + eval(substitute(detach(item), list(item=item))) + missitems <- .oldSearch[! .oldSearch %in% sch] + if(length(missitems)) + warning("items ", paste(missitems, collapse=", "), + " have been removed from the search path") + }, + env = .CheckExEnv) > assign("..nameEx", "__{must remake R-ex/*.R}__", env = .CheckExEnv) # for now > assign("ptime", proc.time(), env = .CheckExEnv) > grDevices::postscript("kappalab-Examples.ps") > assign("par.postscript", graphics::par(no.readonly = TRUE), env = .CheckExEnv) > options(contrasts = c(unordered = "contr.treatment", ordered = "contr.poly")) > options(warn = 1) > library('kappalab') Loading required package: quadprog Loading required package: kernlab > > assign(".oldSearch", search(), env = .CheckExEnv) > assign(".oldNS", loadedNamespaces(), env = .CheckExEnv) > cleanEx(); ..nameEx <- "Choquet.integral-methods" > > ### * Choquet.integral-methods > > flush(stderr()); flush(stdout()) > > ### Name: Choquet.integral-methods > ### Title: Choquet integral > ### Aliases: Choquet.integral Choquet.integral-methods > ### Choquet.integral,Mobius.game,numeric-method > ### Choquet.integral,card.game,numeric-method > ### Choquet.integral,game,numeric-method > ### Keywords: methods > > ### ** Examples > > ## a normalized capacity > mu <- capacity(c(0:13/13,1,1)) > > ## and its Möbius transform > a <- Mobius(mu) > > ## a discrete positive function f > f <- c(0.1,0.9,0.3,0.8) > > ## the Choquet integral of f w.r.t mu > Choquet.integral(mu,f) [1] 0.6615385 > Choquet.integral(a,f) [1] 0.6615385 > > ## a similar example with a cardinal capacity > mu <- uniform.capacity(4) > Choquet.integral(mu,f) [1] 0.525 > > > > cleanEx(); ..nameEx <- "Mobius-methods" > > ### * Mobius-methods > > flush(stderr()); flush(stdout()) > > ### Name: Mobius-methods > ### Title: The Möbius transform > ### Aliases: Mobius Mobius-methods Mobius,capacity-method > ### Mobius,card.set.func-method Mobius,game-method Mobius,set.func-method > ### Keywords: methods > > ### ** Examples > > ## a capacity > mu <- capacity(0:15) > mu capacity {} 0.000000 {1} 1.000000 {2} 2.000000 {3} 3.000000 {4} 4.000000 {1,2} 5.000000 {1,3} 6.000000 {1,4} 7.000000 {2,3} 8.000000 {2,4} 9.000000 {3,4} 10.000000 {1,2,3} 11.000000 {1,2,4} 12.000000 {1,3,4} 13.000000 {2,3,4} 14.000000 {1,2,3,4} 15.000000 > > ## its Möbius transform > a <- Mobius(mu) > a Mobius.capacity {} 0.000000 {1} 1.000000 {2} 2.000000 {3} 3.000000 {4} 4.000000 {1,2} 2.000000 {1,3} 2.000000 {1,4} 2.000000 {2,3} 3.000000 {2,4} 3.000000 {3,4} 3.000000 {1,2,3} -2.000000 {1,2,4} -2.000000 {1,3,4} -2.000000 {2,3,4} -4.000000 {1,2,3,4} 0.000000 > > ## its zeta transform > zeta(a) capacity {} 0.000000 {1} 1.000000 {2} 2.000000 {3} 3.000000 {4} 4.000000 {1,2} 5.000000 {1,3} 6.000000 {1,4} 7.000000 {2,3} 8.000000 {2,4} 9.000000 {3,4} 10.000000 {1,2,3} 11.000000 {1,2,4} 12.000000 {1,3,4} 13.000000 {2,3,4} 14.000000 {1,2,3,4} 15.000000 > > ## a similar example with a game object > mu <- game(c(0,-2:12)) > mu game {} 0.000000 {1} -2.000000 {2} -1.000000 {3} 0.000000 {4} 1.000000 {1,2} 2.000000 {1,3} 3.000000 {1,4} 4.000000 {2,3} 5.000000 {2,4} 6.000000 {3,4} 7.000000 {1,2,3} 8.000000 {1,2,4} 9.000000 {1,3,4} 10.000000 {2,3,4} 11.000000 {1,2,3,4} 12.000000 > Mobius(mu) Mobius.game {} 0.000000 {1} -2.000000 {2} -1.000000 {3} 0.000000 {4} 1.000000 {1,2} 5.000000 {1,3} 5.000000 {1,4} 5.000000 {2,3} 6.000000 {2,4} 6.000000 {3,4} 6.000000 {1,2,3} -5.000000 {1,2,4} -5.000000 {1,3,4} -5.000000 {2,3,4} -7.000000 {1,2,3,4} 3.000000 > zeta(Mobius(mu)) game {} 0.000000 {1} -2.000000 {2} -1.000000 {3} 0.000000 {4} 1.000000 {1,2} 2.000000 {1,3} 3.000000 {1,4} 4.000000 {2,3} 5.000000 {2,4} 6.000000 {3,4} 7.000000 {1,2,3} 8.000000 {1,2,4} 9.000000 {1,3,4} 10.000000 {2,3,4} 11.000000 {1,2,3,4} 12.000000 > > ## a similar example with a set.func object > mu <- set.func(-7:8) > mu set.func {} -7.000000 {1} -6.000000 {2} -5.000000 {3} -4.000000 {4} -3.000000 {1,2} -2.000000 {1,3} -1.000000 {1,4} 0.000000 {2,3} 1.000000 {2,4} 2.000000 {3,4} 3.000000 {1,2,3} 4.000000 {1,2,4} 5.000000 {1,3,4} 6.000000 {2,3,4} 7.000000 {1,2,3,4} 8.000000 > Mobius(mu) Mobius.set.func {} -7.000000 {1} 1.000000 {2} 2.000000 {3} 3.000000 {4} 4.000000 {1,2} 2.000000 {1,3} 2.000000 {1,4} 2.000000 {2,3} 3.000000 {2,4} 3.000000 {3,4} 3.000000 {1,2,3} -2.000000 {1,2,4} -2.000000 {1,3,4} -2.000000 {2,3,4} -4.000000 {1,2,3,4} 0.000000 > zeta(Mobius(mu)) set.func {} -7.000000 {1} -6.000000 {2} -5.000000 {3} -4.000000 {4} -3.000000 {1,2} -2.000000 {1,3} -1.000000 {1,4} 0.000000 {2,3} 1.000000 {2,4} 2.000000 {3,4} 3.000000 {1,2,3} 4.000000 {1,2,4} 5.000000 {1,3,4} 6.000000 {2,3,4} 7.000000 {1,2,3,4} 8.000000 > > ## a similar example with a card.set.func object > mu <- card.set.func(-3:4) > mu card.set.func 0 -3 1 -2 2 -1 3 0 4 1 5 2 6 3 7 4 > Mobius(mu) Mobius.card.set.func 0 -3 1 1 2 0 3 0 4 0 5 0 6 0 7 0 > zeta(Mobius(mu)) card.set.func 0 -3 1 -2 2 -1 3 0 4 1 5 2 6 3 7 4 > > > > cleanEx(); ..nameEx <- "Mobius.capacity-class" > > ### * Mobius.capacity-class > > flush(stderr()); flush(stdout()) > > ### Name: Mobius.capacity-class > ### Title: Class "Mobius.capacity" > ### Aliases: Mobius.capacity-class > ### Keywords: classes > > ### ** Examples > > ## a capacity > mu <- capacity(c(0,0,0:13)) > ## and its Möbius representation > a <- Mobius(mu) > a Mobius.capacity {} 0.000000 {1} 0.000000 {2} 0.000000 {3} 1.000000 {4} 2.000000 {1,2} 3.000000 {1,3} 3.000000 {1,4} 3.000000 {2,3} 5.000000 {2,4} 5.000000 {3,4} 5.000000 {1,2,3} -3.000000 {1,2,4} -3.000000 {1,3,4} -3.000000 {2,3,4} -6.000000 {1,2,3,4} 1.000000 > > # the attributes of object a > a@n [1] 4 > a@k [1] 4 > a@data [1] 0 0 0 1 2 3 3 3 5 5 5 -3 -3 -3 -6 1 > a@subsets [1] 0 1 2 4 8 3 5 9 6 10 12 7 11 13 14 15 > > ## a test > is.normalized(a) [1] FALSE > ## normalize it > normalize(a) Mobius.capacity {} 0.000000 {1} 0.000000 {2} 0.000000 {3} 0.076923 {4} 0.153846 {1,2} 0.230769 {1,3} 0.230769 {1,4} 0.230769 {2,3} 0.384615 {2,4} 0.384615 {3,4} 0.384615 {1,2,3} -0.230769 {1,2,4} -0.230769 {1,3,4} -0.230769 {2,3,4} -0.461538 {1,2,3,4} 0.076923 > > ## a transformation > zeta(a) capacity {} 0.000000 {1} 0.000000 {2} 0.000000 {3} 1.000000 {4} 2.000000 {1,2} 3.000000 {1,3} 4.000000 {1,4} 5.000000 {2,3} 6.000000 {2,4} 7.000000 {3,4} 8.000000 {1,2,3} 9.000000 {1,2,4} 10.000000 {1,3,4} 11.000000 {2,3,4} 12.000000 {1,2,3,4} 13.000000 > ## Let us check ... > Mobius(zeta(a)) Mobius.capacity {} 0.000000 {1} 0.000000 {2} 0.000000 {3} 1.000000 {4} 2.000000 {1,2} 3.000000 {1,3} 3.000000 {1,4} 3.000000 {2,3} 5.000000 {2,4} 5.000000 {3,4} 5.000000 {1,2,3} -3.000000 {1,2,4} -3.000000 {1,3,4} -3.000000 {2,3,4} -6.000000 {1,2,3,4} 1.000000 > > ## some summary indices > orness(a) [1] 0.4294872 > veto(a) 1 2 3 4 0.4871795 0.5470085 0.5982906 0.6495726 > favor(a) 1 2 3 4 0.3589744 0.4017094 0.4529915 0.5042735 > variance(a) [1] 0.1439842 > entropy(a) [1] 0.8073944 > ## the same > summary(a) Shapley value : 1 2 3 4 1.75 2.75 3.75 4.75 Shapley interaction indices : 1 2 3 4 1 NA 0.3333333 0.3333333 0.3333333 2 0.3333333 NA 0.8333333 0.8333333 3 0.3333333 0.8333333 NA 0.8333333 4 0.3333333 0.8333333 0.8333333 NA Orness : 0.4294872 Veto indices : 1 2 3 4 0.4871795 0.5470085 0.5982906 0.6495726 Favor indices : 1 2 3 4 0.3589744 0.4017094 0.4529915 0.5042735 Normalized variance : 0.1439842 Normalized entropy : 0.8073944 > > > > cleanEx(); ..nameEx <- "Mobius.card.gen" > > ### * Mobius.card.gen > > flush(stderr()); flush(stdout()) > > ### Name: Mobius.card.set.func > ### Title: Creates an object representing the Möbius transform of a > ### cardinal set function. > ### Aliases: Mobius.card.set.func > ### Keywords: math > > ### ** Examples > > Mobius.card.set.func(4:-2) Mobius.card.set.func 0 4 1 3 2 2 3 1 4 0 5 -1 6 -2 > > > > cleanEx(); ..nameEx <- "Mobius.card.set.func-class" > > ### * Mobius.card.set.func-class > > flush(stderr()); flush(stdout()) > > ### Name: Mobius.card.set.func-class > ### Title: Class "Mobius.card.set.func" > ### Aliases: Mobius.card.set.func-class > ### Keywords: classes > > ### ** Examples > > ## the Möbius representation of a cardinal set function > a <- Mobius.card.set.func(-3:2) > > # the attributes of the object > a@n [1] 5 > a@data [1] -3 -2 -1 0 1 2 > > ## some transformations > as.set.func(a) set.func {} -3.000000 {1} -2.000000 {2} -2.000000 {3} -2.000000 {4} -2.000000 {5} -2.000000 {1,2} -1.000000 {1,3} -1.000000 {1,4} -1.000000 {1,5} -1.000000 {2,3} -1.000000 {2,4} -1.000000 {2,5} -1.000000 {3,4} -1.000000 {3,5} -1.000000 {4,5} -1.000000 {1,2,3} 0.000000 {1,2,4} 0.000000 {1,2,5} 0.000000 {1,3,4} 0.000000 {1,3,5} 0.000000 {1,4,5} 0.000000 {2,3,4} 0.000000 {2,3,5} 0.000000 {2,4,5} 0.000000 {3,4,5} 0.000000 {1,2,3,4} 1.000000 {1,2,3,5} 1.000000 {1,2,4,5} 1.000000 {1,3,4,5} 1.000000 {2,3,4,5} 1.000000 {1,2,3,4,5} 2.000000 > zeta(a) card.set.func 0 -3 1 -5 2 -8 3 -12 4 -16 5 -16 > ## let us check ... > Mobius(zeta(a)) Mobius.card.set.func 0 -3 1 -2 2 -1 3 0 4 1 5 2 > > > > cleanEx(); ..nameEx <- "Mobius.game-class" > > ### * Mobius.game-class > > flush(stderr()); flush(stdout()) > > ### Name: Mobius.game-class > ### Title: Class "Mobius.game" > ### Aliases: Mobius.game-class > ### Keywords: classes > > ### ** Examples > > ## a game (which is a capacity) > mu <- game(c(0,rep(1,15))) > ## and its Möbius representation > a <- Mobius(mu) > > # the attributes of object a > a@n [1] 4 > a@k [1] 4 > a@data [1] 0 1 1 1 1 -1 -1 -1 -1 -1 -1 1 1 1 1 -1 > a@subsets [1] 0 1 2 4 8 3 5 9 6 10 12 7 11 13 14 15 > > ## a transformation > zeta(a) game {} 0.000000 {1} 1.000000 {2} 1.000000 {3} 1.000000 {4} 1.000000 {1,2} 1.000000 {1,3} 1.000000 {1,4} 1.000000 {2,3} 1.000000 {2,4} 1.000000 {3,4} 1.000000 {1,2,3} 1.000000 {1,2,4} 1.000000 {1,3,4} 1.000000 {2,3,4} 1.000000 {1,2,3,4} 1.000000 > ## let us check ... > Mobius(zeta(a)) Mobius.game {} 0.000000 {1} 1.000000 {2} 1.000000 {3} 1.000000 {4} 1.000000 {1,2} -1.000000 {1,3} -1.000000 {1,4} -1.000000 {2,3} -1.000000 {2,4} -1.000000 {3,4} -1.000000 {1,2,3} 1.000000 {1,2,4} 1.000000 {1,3,4} 1.000000 {2,3,4} 1.000000 {1,2,3,4} -1.000000 > > ## integral calculations > f <- c(0.2,0.3,0.1,0.7) > Choquet.integral(a,f) [1] 0.7 > Sugeno.integral(a,f) [1] 0.7 > f <- c(0.2,-0.3,0.1,-0.7) > Sipos.integral(a,f) [1] -0.5 > > > > cleanEx(); ..nameEx <- "Mobius.gen" > > ### * Mobius.gen > > flush(stderr()); flush(stdout()) > > ### Name: Mobius.set.func > ### Title: Create objects representing the Möbius transform of a set > ### function. > ### Aliases: Mobius.set.func Mobius.game Mobius.capacity additive.capacity > ### Keywords: math > > ### ** Examples > > Mobius.set.func(c(0,1,1,2,1,2,1,2,2,3,2),4,2) Mobius.set.func {} 0.000000 {1} 1.000000 {2} 1.000000 {3} 2.000000 {4} 1.000000 {1,2} 2.000000 {1,3} 1.000000 {1,4} 2.000000 {2,3} 2.000000 {2,4} 3.000000 {3,4} 2.000000 > Mobius.game(c(0,1,1,2,1,2,1,2,2,3,2),4,2) Mobius.game {} 0.000000 {1} 1.000000 {2} 1.000000 {3} 2.000000 {4} 1.000000 {1,2} 2.000000 {1,3} 1.000000 {1,4} 2.000000 {2,3} 2.000000 {2,4} 3.000000 {3,4} 2.000000 > Mobius.capacity(c(0,1,1,2,1,2,1,2,2,3,2),4,2) Mobius.capacity {} 0.000000 {1} 1.000000 {2} 1.000000 {3} 2.000000 {4} 1.000000 {1,2} 2.000000 {1,3} 1.000000 {1,4} 2.000000 {2,3} 2.000000 {2,4} 3.000000 {3,4} 2.000000 > additive.capacity(c(1,2,3,4)) Mobius.capacity {} 0.000000 {1} 1.000000 {2} 2.000000 {3} 3.000000 {4} 4.000000 > > > > cleanEx(); ..nameEx <- "Mobius.set.func-class" > > ### * Mobius.set.func-class > > flush(stderr()); flush(stdout()) > > ### Name: Mobius.set.func-class > ### Title: Class "Mobius.set.func" > ### Aliases: Mobius.set.func-class > ### Keywords: classes > > ### ** Examples > > ## the Möbius transform of a set function directly > a <- Mobius.set.func(1:16,4,4) > > ## the attributes of the object > a@n [1] 4 > a@k [1] 4 > a@data [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 > a@subsets [1] 0 1 2 4 8 3 5 9 6 10 12 7 11 13 14 15 > > ## a set function > mu <- set.func(7:-8) > ## and its Möbius transform > a <- Mobius(mu) > > ## some conversions that cannot work > ## as.game(a) > ## as.capacity(a) > ## as.card.set.func(a) > > ## some tests > is.cardinal(a) [1] FALSE > is.kadditive(a,2) [1] FALSE > is.monotone(a) [1] FALSE > > ## some transformations > zeta(a) set.func {} 7.000000 {1} 6.000000 {2} 5.000000 {3} 4.000000 {4} 3.000000 {1,2} 2.000000 {1,3} 1.000000 {1,4} 0.000000 {2,3} -1.000000 {2,4} -2.000000 {3,4} -3.000000 {1,2,3} -4.000000 {1,2,4} -5.000000 {1,3,4} -6.000000 {2,3,4} -7.000000 {1,2,3,4} -8.000000 > k.truncate.Mobius(a,2) Mobius.set.func {} 7.000000 {1} -1.000000 {2} -2.000000 {3} -3.000000 {4} -4.000000 {1,2} -2.000000 {1,3} -2.000000 {1,4} -2.000000 {2,3} -3.000000 {2,4} -3.000000 {3,4} -3.000000 > > ## summary > Shapley.value(a) 1 2 3 4 -2.000000 -3.333333 -4.333333 -5.333333 > interaction.indices(a) 1 2 3 4 1 NA 0 0 0 2 0 NA 0 0 3 0 0 NA 0 4 0 0 0 NA > # the same > summary(a) Shapley value : 1 2 3 4 -2.000000 -3.333333 -4.333333 -5.333333 Shapley interaction indices : 1 2 3 4 1 NA 0 0 0 2 0 NA 0 0 3 0 0 NA 0 4 0 0 0 NA > > ## save the Möbius transform to a file > d <- to.data.frame(a) > write.table(d,"my.Mobius.set.func.csv",sep="\t") > > # finally, some conversions that should work > mu <- set.func(c(0,1,1,1,2,2,2,3)) > a <- Mobius(mu) > as.Mobius.game(a) Mobius.game {} 0.000000 {1} 1.000000 {2} 1.000000 {3} 1.000000 {1,2} 0.000000 {1,3} 0.000000 {2,3} 0.000000 {1,2,3} 0.000000 > as.Mobius.capacity(a) Mobius.capacity {} 0.000000 {1} 1.000000 {2} 1.000000 {3} 1.000000 {1,2} 0.000000 {1,3} 0.000000 {2,3} 0.000000 {1,2,3} 0.000000 > as.Mobius.card.set.func(a) Mobius.card.set.func 0 0 1 1 2 0 3 0 > > > > cleanEx(); ..nameEx <- "Shapley.value-methods" > > ### * Shapley.value-methods > > flush(stderr()); flush(stdout()) > > ### Name: Shapley.value-methods > ### Title: The Shapley value > ### Aliases: Shapley.value Shapley.value-methods > ### Shapley.value,Mobius.set.func-method > ### Shapley.value,card.set.func-method Shapley.value,set.func-method > ### Keywords: methods > > ### ** Examples > > ## a set function > mu <- set.func(c(0:13/13,1,1)) > > ## the Shapley value > Shapley.value(mu) 1 2 3 4 0.1346154 0.2115385 0.2884615 0.3653846 > > ## the efficiency property should be satisfied > sum(Shapley.value(mu)) [1] 1 > > ## a similar example using a Mobius.set.func object > a <- Mobius(mu) > Shapley.value(a) 1 2 3 4 0.1346154 0.2115385 0.2884615 0.3653846 > > ## a similar example using a card.set.func object > mu <- upper.capacity(6) > Shapley.value(mu) All 0.1666667 > ## the efficiency property should be satisfied > Shapley.value(mu)*6 All 1 > > > > cleanEx(); ..nameEx <- "Sipos.integral-methods" > > ### * Sipos.integral-methods > > flush(stderr()); flush(stdout()) > > ### Name: Sipos.integral-methods > ### Title: Sipos integral > ### Aliases: Sipos.integral Sipos.integral-methods > ### Sipos.integral,Mobius.game,numeric-method > ### Sipos.integral,card.game,numeric-method > ### Sipos.integral,game,numeric-method > ### Keywords: methods > > ### ** Examples > > ## a normalized capacity > mu <- capacity(c(0:13/13,1,1)) > > ## and its Möbius transform > a <- Mobius(mu) > > ## a discrete function f > f <- c(0.1,-0.9,-0.3,0.8) > > ## the Sugeno integral of f w.r.t mu > Sipos.integral(mu,f) [1] -0.007692308 > Sipos.integral(a,f) [1] -0.007692308 > > ## a similar example with a cardinal capacity > mu <- uniform.capacity(4) > Sipos.integral(mu,f) [1] -0.075 > > > > cleanEx(); ..nameEx <- "Sugeno.integral-methods" > > ### * Sugeno.integral-methods > > flush(stderr()); flush(stdout()) > > ### Name: Sugeno.integral-methods > ### Title: Sugeno integral > ### Aliases: Sugeno.integral Sugeno.integral-methods > ### Sugeno.integral,Mobius.game,numeric-method > ### Sugeno.integral,card.game,numeric-method > ### Sugeno.integral,game,numeric-method > ### Keywords: methods > > ### ** Examples > > ## a normalized capacity > mu <- capacity(c(0:13/13,1,1)) > > ## and its Möbius transform > a <- Mobius(mu) > > ## a discrete function f > f <- c(0.1,0.9,0.3,0.8) > > ## the Sugeno integral of f w.r.t mu > Sugeno.integral(mu,f) [1] 0.6923077 > Sugeno.integral(a,f) [1] 0.6923077 > > ## a similar example with a cardinal capacity > mu <- uniform.capacity(4) > Sugeno.integral(mu,f) [1] 0.5 > > > > cleanEx(); ..nameEx <- "capacity-class" > > ### * capacity-class > > flush(stderr()); flush(stdout()) > > ### Name: capacity-class > ### Title: Class "capacity" > ### Aliases: capacity-class > ### Keywords: classes > > ### ** Examples > > ## a capacity > mu <- capacity(c(0:13,13,13)/13) > > ## the attributes of the object > mu@n [1] 4 > mu@data [1] 0.00000000 0.07692308 0.15384615 0.38461538 0.23076923 0.46153846 [7] 0.61538462 0.84615385 0.30769231 0.53846154 0.69230769 0.92307692 [13] 0.76923077 1.00000000 1.00000000 1.00000000 > mu@subsets [1] 0 1 2 4 8 3 5 9 6 10 12 7 11 13 14 15 > > ## a test > is.normalized(mu) [1] TRUE > normalize(mu) capacity {} 0.000000 {1} 0.076923 {2} 0.153846 {3} 0.230769 {4} 0.307692 {1,2} 0.384615 {1,3} 0.461538 {1,4} 0.538462 {2,3} 0.615385 {2,4} 0.692308 {3,4} 0.769231 {1,2,3} 0.846154 {1,2,4} 0.923077 {1,3,4} 1.000000 {2,3,4} 1.000000 {1,2,3,4} 1.000000 > > ## a conversion that should not work > ## as.card.capacity(mu) > > ## some transformations > dual(mu) capacity {} 0.000000 {1} 0.000000 {2} 0.000000 {3} 0.076923 {4} 0.153846 {1,2} 0.230769 {1,3} 0.307692 {1,4} 0.384615 {2,3} 0.461538 {2,4} 0.538462 {3,4} 0.615385 {1,2,3} 0.692308 {1,2,4} 0.769231 {1,3,4} 0.846154 {2,3,4} 0.923077 {1,2,3,4} 1.000000 > Mobius(mu) Mobius.capacity {} 0.000000 {1} 0.076923 {2} 0.153846 {3} 0.230769 {4} 0.307692 {1,2} 0.153846 {1,3} 0.153846 {1,4} 0.153846 {2,3} 0.230769 {2,4} 0.230769 {3,4} 0.230769 {1,2,3} -0.153846 {1,2,4} -0.153846 {1,3,4} -0.153846 {2,3,4} -0.384615 {1,2,3,4} -0.076923 > ## let us check ... > zeta(Mobius(mu)) capacity {} 0.000000 {1} 0.076923 {2} 0.153846 {3} 0.230769 {4} 0.307692 {1,2} 0.384615 {1,3} 0.461538 {1,4} 0.538462 {2,3} 0.615385 {2,4} 0.692308 {3,4} 0.769231 {1,2,3} 0.846154 {1,2,4} 0.923077 {1,3,4} 1.000000 {2,3,4} 1.000000 {1,2,3,4} 1.000000 > > ## some summary indices > orness(mu) [1] 0.5705128 > veto(mu) 1 2 3 4 0.3589744 0.4017094 0.4529915 0.5042735 > favor(mu) 1 2 3 4 0.4871795 0.5470085 0.5982906 0.6495726 > variance(mu) [1] 0.1439842 > entropy(mu) [1] 0.8073944 > ## the same > summary(mu) Shapley value : 1 2 3 4 0.1346154 0.2115385 0.2884615 0.3653846 Shapley interaction indices : 1 2 3 4 1 NA -0.02564103 -0.02564103 -0.02564103 2 -0.02564103 NA -0.06410256 -0.06410256 3 -0.02564103 -0.06410256 NA -0.06410256 4 -0.02564103 -0.06410256 -0.06410256 NA Orness : 0.5705128 Veto indices : 1 2 3 4 0.3589744 0.4017094 0.4529915 0.5042735 Favor indices : 1 2 3 4 0.4871795 0.5470085 0.5982906 0.6495726 Normalized variance : 0.1439842 Normalized entropy : 0.8073944 > > > > cleanEx(); ..nameEx <- "card.capacity-class" > > ### * card.capacity-class > > flush(stderr()); flush(stdout()) > > ### Name: card.capacity-class > ### Title: Class "card.capacity" > ### Aliases: card.capacity-class > ### Keywords: classes > > ### ** Examples > > ## a capacity > mu <- card.capacity(0:6/6) > ## the same > mu <- uniform.capacity(6) > > # the attributes of the object > mu@n [1] 6 > mu@data [1] 0.0000000 0.1666667 0.3333333 0.5000000 0.6666667 0.8333333 1.0000000 > > ## a test > is.normalized(mu) [1] TRUE > normalize(mu) card.capacity 0 0.0000000 1 0.1666667 2 0.3333333 3 0.5000000 4 0.6666667 5 0.8333333 6 1.0000000 > > ## a transformation > dual(mu) card.capacity 0 0.0000000 1 0.1666667 2 0.3333333 3 0.5000000 4 0.6666667 5 0.8333333 6 1.0000000 > > ## some summary indices > orness(mu) [1] 0.5 > veto(mu) All 0.5 > favor(mu) All 0.5 > variance(mu) [1] 0 > entropy(mu) [1] 1 > ## the same > summary(mu) Shapley value : All 0.1666667 Shapley interaction indices : All All -5.551115e-18 Orness : 0.5 Veto indices : All 0.5 Favor indices : All 0.5 Normalized variance : 0 Normalized entropy : 1 > > > > cleanEx(); ..nameEx <- "card.game-class" > > ### * card.game-class > > flush(stderr()); flush(stdout()) > > ### Name: card.game-class > ### Title: Class "card.game" > ### Aliases: card.game-class > ### Keywords: classes > > ### ** Examples > > ## a cardinal game (which is a capacity) > mu <- card.game(c(0,rep(1,4))) > > # the attributes of the object > mu@n [1] 4 > mu@data [1] 0 1 1 1 1 > > ## a conversion > as.game(mu) game {} 0.000000 {1} 1.000000 {2} 1.000000 {3} 1.000000 {4} 1.000000 {1,2} 1.000000 {1,3} 1.000000 {1,4} 1.000000 {2,3} 1.000000 {2,4} 1.000000 {3,4} 1.000000 {1,2,3} 1.000000 {1,2,4} 1.000000 {1,3,4} 1.000000 {2,3,4} 1.000000 {1,2,3,4} 1.000000 > > ## integral calculations > f <- c(0.2,0.3,0.1,0.7) > Choquet.integral(mu,f) [1] 0.7 > Sugeno.integral(mu,f) [1] 0.7 > f <- c(0.2,-0.3,0.1,-0.7) > Sipos.integral(mu,f) [1] -0.5 > > > > cleanEx(); ..nameEx <- "card.set.func-class" > > ### * card.set.func-class > > flush(stderr()); flush(stdout()) > > ### Name: card.set.func-class > ### Title: Class "card.set.func" > ### Aliases: card.set.func-class > ### Keywords: classes > > ### ** Examples > > ## a cardinal set function > mu <- card.set.func(-3:2) > > # the attributes of the object > mu@n [1] 5 > mu@data [1] -3 -2 -1 0 1 2 > > ## some conversions that cannot work > ## Not run: as.card.game(mu) > ## Not run: as.card.capacityfunc(mu) > > ## the following should work > as.set.func(mu) set.func {} -3.000000 {1} -2.000000 {2} -2.000000 {3} -2.000000 {4} -2.000000 {5} -2.000000 {1,2} -1.000000 {1,3} -1.000000 {1,4} -1.000000 {1,5} -1.000000 {2,3} -1.000000 {2,4} -1.000000 {2,5} -1.000000 {3,4} -1.000000 {3,5} -1.000000 {4,5} -1.000000 {1,2,3} 0.000000 {1,2,4} 0.000000 {1,2,5} 0.000000 {1,3,4} 0.000000 {1,3,5} 0.000000 {1,4,5} 0.000000 {2,3,4} 0.000000 {2,3,5} 0.000000 {2,4,5} 0.000000 {3,4,5} 0.000000 {1,2,3,4} 1.000000 {1,2,3,5} 1.000000 {1,2,4,5} 1.000000 {1,3,4,5} 1.000000 {2,3,4,5} 1.000000 {1,2,3,4,5} 2.000000 > > ## some tests > is.cardinal(mu) [1] TRUE > is.kadditive(mu,2) [1] FALSE > is.monotone(mu) [1] TRUE > > ## some transformations > dual(mu) card.game 0 0 1 1 2 2 3 3 4 4 5 5 > Mobius(mu) Mobius.card.set.func 0 -3 1 1 2 0 3 0 4 0 5 0 > ## let us check ... > zeta(Mobius(mu)) card.set.func 0 -3 1 -2 2 -1 3 0 4 1 5 2 > > ## summary > Shapley.value(mu) All 1 > interaction.indices(mu) All All 0 > # the same > summary(mu) Shapley value : All 1 Shapley interaction indices : All All 0 > > ## save the set function to a file > d <- to.data.frame(mu) > write.table(d,"my.card.set.func.csv",sep="\t") > > # finally, some other conversions that should work > mu <- card.set.func(0:5) > as.card.game(mu) card.game 0 0 1 1 2 2 3 3 4 4 5 5 > as.card.capacity(mu) card.capacity 0 0 1 1 2 2 3 3 4 4 5 5 > > > > cleanEx(); ..nameEx <- "card.set.func.gen" > > ### * card.set.func.gen > > flush(stderr()); flush(stdout()) > > ### Name: card.set.func > ### Title: Create objects representing cardinal set functions. > ### Aliases: card.set.func card.game card.capacity lower.capacity > ### upper.capacity uniform.capacity > ### Keywords: math > > ### ** Examples > > card.set.func(4:-2) card.set.func 0 4 1 3 2 2 3 1 4 0 5 -1 6 -2 > card.game(c(0,-2:2)) card.game 0 0 1 -2 2 -1 3 0 4 1 5 2 > card.capacity(0:5) card.capacity 0 0 1 1 2 2 3 3 4 4 5 5 > lower.capacity(3) card.capacity 0 0 1 0 2 0 3 1 > upper.capacity(4) card.capacity 0 0 1 1 2 1 3 1 4 1 > uniform.capacity(5) card.capacity 0 0.0 1 0.2 2 0.4 3 0.6 4 0.8 5 1.0 > > > > cleanEx(); ..nameEx <- "dual-methods" > > ### * dual-methods > > flush(stderr()); flush(stdout()) > > ### Name: dual-methods > ### Title: The dual (or conjugate) transform > ### Aliases: dual dual-methods dual,capacity-method > ### dual,card.capacity-method dual,card.set.func-method > ### dual,set.func-method > ### Keywords: methods > > ### ** Examples > > ## a game > mu <- game(c(0,-7:7)) > mu game {} 0.000000 {1} -7.000000 {2} -6.000000 {3} -5.000000 {4} -4.000000 {1,2} -3.000000 {1,3} -2.000000 {1,4} -1.000000 {2,3} 0.000000 {2,4} 1.000000 {3,4} 2.000000 {1,2,3} 3.000000 {1,2,4} 4.000000 {1,3,4} 5.000000 {2,3,4} 6.000000 {1,2,3,4} 7.000000 > > ## its dual > dual(mu) game {} 0.000000 {1} 1.000000 {2} 2.000000 {3} 3.000000 {4} 4.000000 {1,2} 5.000000 {1,3} 6.000000 {1,4} 7.000000 {2,3} 8.000000 {2,4} 9.000000 {3,4} 10.000000 {1,2,3} 11.000000 {1,2,4} 12.000000 {1,3,4} 13.000000 {2,3,4} 14.000000 {1,2,3,4} 7.000000 > ## and mu again > dual(dual(mu)) game {} 0.000000 {1} -7.000000 {2} -6.000000 {3} -5.000000 {4} -4.000000 {1,2} -3.000000 {1,3} -2.000000 {1,4} -1.000000 {2,3} 0.000000 {2,4} 1.000000 {3,4} 2.000000 {1,2,3} 3.000000 {1,2,4} 4.000000 {1,3,4} 5.000000 {2,3,4} 6.000000 {1,2,3,4} 7.000000 > > ## a similar example with the upper capacity > mu <- capacity(c(0,rep(1,15))) > mu capacity {} 0.000000 {1} 1.000000 {2} 1.000000 {3} 1.000000 {4} 1.000000 {1,2} 1.000000 {1,3} 1.000000 {1,4} 1.000000 {2,3} 1.000000 {2,4} 1.000000 {3,4} 1.000000 {1,2,3} 1.000000 {1,2,4} 1.000000 {1,3,4} 1.000000 {2,3,4} 1.000000 {1,2,3,4} 1.000000 > dual(mu) capacity {} 0.000000 {1} 0.000000 {2} 0.000000 {3} 0.000000 {4} 0.000000 {1,2} 0.000000 {1,3} 0.000000 {1,4} 0.000000 {2,3} 0.000000 {2,4} 0.000000 {3,4} 0.000000 {1,2,3} 0.000000 {1,2,4} 0.000000 {1,3,4} 0.000000 {2,3,4} 0.000000 {1,2,3,4} 1.000000 > dual(dual(mu)) capacity {} 0.000000 {1} 1.000000 {2} 1.000000 {3} 1.000000 {4} 1.000000 {1,2} 1.000000 {1,3} 1.000000 {1,4} 1.000000 {2,3} 1.000000 {2,4} 1.000000 {3,4} 1.000000 {1,2,3} 1.000000 {1,2,4} 1.000000 {1,3,4} 1.000000 {2,3,4} 1.000000 {1,2,3,4} 1.000000 > > ## a similar example with an object of class card.capacity > mu <- upper.capacity(6) > mu card.capacity 0 0 1 1 2 1 3 1 4 1 5 1 6 1 > dual(mu) card.capacity 0 0 1 0 2 0 3 0 4 0 5 0 6 1 > dual(dual(mu)) card.capacity 0 0 1 1 2 1 3 1 4 1 5 1 6 1 > > ## the dual of a set function is a game > mu <- set.func(-7:8) > mu set.func {} -7.000000 {1} -6.000000 {2} -5.000000 {3} -4.000000 {4} -3.000000 {1,2} -2.000000 {1,3} -1.000000 {1,4} 0.000000 {2,3} 1.000000 {2,4} 2.000000 {3,4} 3.000000 {1,2,3} 4.000000 {1,2,4} 5.000000 {1,3,4} 6.000000 {2,3,4} 7.000000 {1,2,3,4} 8.000000 > dual(mu) game {} 0.000000 {1} 1.000000 {2} 2.000000 {3} 3.000000 {4} 4.000000 {1,2} 5.000000 {1,3} 6.000000 {1,4} 7.000000 {2,3} 8.000000 {2,4} 9.000000 {3,4} 10.000000 {1,2,3} 11.000000 {1,2,4} 12.000000 {1,3,4} 13.000000 {2,3,4} 14.000000 {1,2,3,4} 15.000000 > mu <- card.set.func(-2:5) > dual(mu) card.game 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 > > > > cleanEx(); ..nameEx <- "entropy-methods" > > ### * entropy-methods > > flush(stderr()); flush(stdout()) > > ### Name: entropy-methods > ### Title: Normalized entropy of a capacity > ### Aliases: entropy entropy-methods entropy,Mobius.capacity-method > ### entropy,capacity-method entropy,card.capacity-method > ### Keywords: methods > > ### ** Examples > > ## a capacity > mu <- capacity(c(0,0,0:13)) > > ## its Möbius transform > a <- Mobius(mu) > > ## their normalized entropy > entropy(mu) [1] 0.8073944 > entropy(a) [1] 0.8073944 > > ## similar examples with card.capacity objects > mu <- lower.capacity(4) > entropy(mu) [1] 0 > mu <- uniform.capacity(4) > entropy(mu) [1] 1 > > > > cleanEx(); ..nameEx <- "entropy.capa.ident" > > ### * entropy.capa.ident > > flush(stderr()); flush(stdout()) > > ### Name: entropy.capa.ident > ### Title: Unsupervised identification of a capacity from profiles > ### Aliases: entropy.capa.ident > ### Keywords: math > > ### ** Examples > > ## a set of randomly generated data > ## for instance, marks on a [0,20] scale > p <- data.frame(matrix(runif(500,0,20),100,5)) > names(p) <- c("Stat","Prob","Alg","Cal","Eng") > > ## discretization > p[p <= 5] <- 1 > p[p > 5 & p <= 10] <- 2 > p[p > 10 & p <= 15] <- 3 > p[p > 15] <- 4 > > d <- data.frame(factor(p[[1]]), + factor(p[[2]]), + factor(p[[3]]), + factor(p[[4]]), + factor(p[[5]])) > > ## associated unsupervised capacity > mu <- entropy.capa.ident(d) > mu capacity {} 0.000000 {1} 0.302819 {2} 0.303766 {3} 0.300483 {4} 0.300016 {5} 0.305746 {1,2} 0.596686 {1,3} 0.580858 {1,4} 0.585843 {1,5} 0.599376 {2,3} 0.590558 {2,4} 0.592248 {2,5} 0.602706 {3,4} 0.591646 {3,5} 0.598377 {4,5} 0.598055 {1,2,3} 0.826752 {1,2,4} 0.835746 {1,2,5} 0.828410 {1,3,4} 0.823276 {1,3,5} 0.838023 {1,4,5} 0.832737 {2,3,4} 0.826346 {2,3,5} 0.846925 {2,4,5} 0.842544 {3,4,5} 0.847677 {1,2,3,4} 0.968149 {1,2,3,5} 0.958942 {1,2,4,5} 0.952051 {1,3,4,5} 0.963922 {2,3,4,5} 0.962763 {1,2,3,4,5} 1.000000 > > > > cleanEx(); ..nameEx <- "favor-methods" > > ### * favor-methods > > flush(stderr()); flush(stdout()) > > ### Name: favor-methods > ### Title: Favor indices > ### Aliases: favor favor-methods favor,Mobius.capacity-method > ### favor,capacity-method favor,card.capacity-method > ### Keywords: methods > > ### ** Examples > > ## a capacity > mu <- capacity(c(0:13,13,13)) > > ## its Möbius transform > a <- Mobius(mu) > > ## their favor indices > favor(mu) 1 2 3 4 0.4871795 0.5470085 0.5982906 0.6495726 > favor(a) 1 2 3 4 0.4871795 0.5470085 0.5982906 0.6495726 > > ## the same with a card.capacity object > mu <- lower.capacity(4) > favor(mu) All 0 > > > > cleanEx(); ..nameEx <- "game-class" > > ### * game-class > > flush(stderr()); flush(stdout()) > > ### Name: game-class > ### Title: Class "game" > ### Aliases: game-class > ### Keywords: classes > > ### ** Examples > > ## a game (which is a capacity) > mu <- game(c(0,rep(1,15))) > > ## the attributes of the object > mu@n [1] 4 > mu@data [1] 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 > mu@subsets [1] 0 1 2 4 8 3 5 9 6 10 12 7 11 13 14 15 > > ## a conversion > as.card.game(mu) card.game 0 0 1 1 2 1 3 1 4 1 > > ## a transformation > Mobius(mu) Mobius.game {} 0.000000 {1} 1.000000 {2} 1.000000 {3} 1.000000 {4} 1.000000 {1,2} -1.000000 {1,3} -1.000000 {1,4} -1.000000 {2,3} -1.000000 {2,4} -1.000000 {3,4} -1.000000 {1,2,3} 1.000000 {1,2,4} 1.000000 {1,3,4} 1.000000 {2,3,4} 1.000000 {1,2,3,4} -1.000000 > ## let us check ... > zeta(Mobius(mu)) game {} 0.000000 {1} 1.000000 {2} 1.000000 {3} 1.000000 {4} 1.000000 {1,2} 1.000000 {1,3} 1.000000 {1,4} 1.000000 {2,3} 1.000000 {2,4} 1.000000 {3,4} 1.000000 {1,2,3} 1.000000 {1,2,4} 1.000000 {1,3,4} 1.000000 {2,3,4} 1.000000 {1,2,3,4} 1.000000 > > ## integral calculations > f <- c(0.2,0.3,0.1,0.7) > Choquet.integral(mu,f) [1] 0.7 > Sugeno.integral(mu,f) [1] 0.7 > f <- c(0.2,-0.3,0.1,-0.7) > Sipos.integral(mu,f) [1] -0.5 > > > > cleanEx(); ..nameEx <- "interaction.indices-methods" > > ### * interaction.indices-methods > > flush(stderr()); flush(stdout()) > > ### Name: interaction.indices-methods > ### Title: The Shapley interaction indices > ### Aliases: interaction.indices interaction.indices-methods > ### interaction.indices,Mobius.set.func-method > ### interaction.indices,card.set.func-method > ### interaction.indices,set.func-method > ### Keywords: methods > > ### ** Examples > > ## a set function > mu <- set.func(c(-7:6,6,6)) > > ## the associated interaction indices > interaction.indices(mu) 1 2 3 4 1 NA -0.3333333 -0.3333333 -0.3333333 2 -0.3333333 NA -0.8333333 -0.8333333 3 -0.3333333 -0.8333333 NA -0.8333333 4 -0.3333333 -0.8333333 -0.8333333 NA > > ## a similar example using a Mobius.set.func object > a <- Mobius(mu) > interaction.indices(a) 1 2 3 4 1 NA -0.3333333 -0.3333333 -0.3333333 2 -0.3333333 NA -0.8333333 -0.8333333 3 -0.3333333 -0.8333333 NA -0.8333333 4 -0.3333333 -0.8333333 -0.8333333 NA > > ## a similar example using a card.set.func object > mu <- upper.capacity(6) > interaction.indices(mu) All All -0.2 > > > > cleanEx(); ..nameEx <- "is.cardinal-methods" > > ### * is.cardinal-methods > > flush(stderr()); flush(stdout()) > > ### Name: is.cardinal-methods > ### Title: Test method > ### Aliases: is.cardinal is.cardinal-methods > ### is.cardinal,Mobius.set.func-method is.cardinal,card.set.func-method > ### is.cardinal,set.func-method > ### Keywords: methods > > ### ** Examples > > is.cardinal(set.func(-7:8)) [1] FALSE > is.cardinal(uniform.capacity(8)) [1] TRUE > is.cardinal(Mobius.game(0:10,4,2)) [1] FALSE > > > > cleanEx(); ..nameEx <- "is.kadditive-methods" > > ### * is.kadditive-methods > > flush(stderr()); flush(stdout()) > > ### Name: is.kadditive-methods > ### Title: Test method > ### Aliases: is.kadditive is.kadditive-methods > ### is.kadditive,Mobius.set.func,numeric-method > ### is.kadditive,card.set.func,numeric-method > ### is.kadditive,set.func,numeric-method > ### Keywords: methods > > ### ** Examples > > ## a set function > mu <- set.func(c(0,1,1,1,2,2,2,3)) > mu set.func {} 0.000000 {1} 1.000000 {2} 1.000000 {3} 1.000000 {1,2} 2.000000 {1,3} 2.000000 {2,3} 2.000000 {1,2,3} 3.000000 > is.kadditive(mu,2) [1] FALSE > is.kadditive(mu,1) [1] TRUE > > ## the Möbius representation of a set function, 2-additive by construction > a <- Mobius.set.func(c(0,1,2,1,3,1,2,1,2,3,1),4,2) > is.kadditive(a,2) [1] TRUE > is.kadditive(a,1) [1] FALSE > > > > cleanEx(); ..nameEx <- "is.monotone-methods" > > ### * is.monotone-methods > > flush(stderr()); flush(stdout()) > > ### Name: is.monotone-methods > ### Title: Test method > ### Aliases: is.monotone is.monotone-methods > ### is.monotone,Mobius.set.func-method is.monotone,card.set.func-method > ### is.monotone,set.func-method > ### Keywords: methods > > ### ** Examples > > ## a monotone set function > mu <- set.func(c(0,1,1,1,2,2,2,3)) > mu set.func {} 0.000000 {1} 1.000000 {2} 1.000000 {3} 1.000000 {1,2} 2.000000 {1,3} 2.000000 {2,3} 2.000000 {1,2,3} 3.000000 > is.monotone(mu) [1] TRUE > > ## the Möbius representation of a monotone set function > a <- Mobius.set.func(c(0,1,2,1,3,1,2,1,2,3,1),4,2) > is.monotone(a) [1] TRUE > > ## non-monotone examples > mu <- set.func(c(0,-7:7)) > is.monotone(mu,verbose=TRUE) Violation of monotonicity constraint between { } and { 1 }. Violation of monotonicity constraint between { } and { 2 }. Violation of monotonicity constraint between { } and { 3 }. Violation of monotonicity constraint between { } and { 4 }. [1] FALSE > a <- Mobius(mu) > is.monotone(a,verbose=TRUE) Violation of monotonicity constraint between { } and { 1 }. Violation of monotonicity constraint between { } and { 2 }. Violation of monotonicity constraint between { } and { 3 }. Violation of monotonicity constraint between { } and { 4 }. [1] FALSE > > > > cleanEx(); ..nameEx <- "is.normalized-methods" > > ### * is.normalized-methods > > flush(stderr()); flush(stdout()) > > ### Name: is.normalized-methods > ### Title: Test method > ### Aliases: is.normalized is.normalized-methods > ### is.normalized,Mobius.capacity-method is.normalized,capacity-method > ### is.normalized,card.capacity-method > ### Keywords: methods > > ### ** Examples > > ## a capacity > mu <- capacity(0:15) > is.normalized(mu) [1] FALSE > normalize(mu) capacity {} 0.000000 {1} 0.066667 {2} 0.133333 {3} 0.200000 {4} 0.266667 {1,2} 0.333333 {1,3} 0.400000 {1,4} 0.466667 {2,3} 0.533333 {2,4} 0.600000 {3,4} 0.666667 {1,2,3} 0.733333 {1,2,4} 0.800000 {1,3,4} 0.866667 {2,3,4} 0.933333 {1,2,3,4} 1.000000 > > ## its Möbius transform > a <- Mobius(mu) > is.normalized(a) [1] FALSE > normalize(a) Mobius.capacity {} 0.000000 {1} 0.066667 {2} 0.133333 {3} 0.200000 {4} 0.266667 {1,2} 0.133333 {1,3} 0.133333 {1,4} 0.133333 {2,3} 0.200000 {2,4} 0.200000 {3,4} 0.200000 {1,2,3} -0.133333 {1,2,4} -0.133333 {1,3,4} -0.133333 {2,3,4} -0.266667 {1,2,3,4} 0.000000 > > ## a cardinal capacity > mu <- uniform.capacity(7) > is.normalized(mu) [1] TRUE > > > > cleanEx(); ..nameEx <- "k.truncate.Mobius-methods" > > ### * k.truncate.Mobius-methods > > flush(stderr()); flush(stdout()) > > ### Name: k.truncate.Mobius-methods > ### Title: k-order truncation of the Möbius representation of a set > ### function. > ### Aliases: k.truncate.Mobius k.truncate.Mobius-methods > ### k.truncate.Mobius,set.func,numeric-method > ### k.truncate.Mobius,Mobius.set.func,numeric-method > ### Keywords: methods > > ### ** Examples > > ## a set function > mu <- set.func(c(0,1,1,1,2,2,2,3)) > mu set.func {} 0.000000 {1} 1.000000 {2} 1.000000 {3} 1.000000 {1,2} 2.000000 {1,3} 2.000000 {2,3} 2.000000 {1,2,3} 3.000000 > > ## 2-truncate it > k.truncate.Mobius(mu,2) Mobius.set.func {} 0.000000 {1} 1.000000 {2} 1.000000 {3} 1.000000 {1,2} 0.000000 {1,3} 0.000000 {2,3} 0.000000 > ## 2-truncate it > k.truncate.Mobius(Mobius(mu),2) Mobius.set.func {} 0.000000 {1} 1.000000 {2} 1.000000 {3} 1.000000 {1,2} 0.000000 {1,3} 0.000000 {2,3} 0.000000 > > > > cleanEx(); ..nameEx <- "least.squares.capa.ident" > > ### * least.squares.capa.ident > > flush(stderr()); flush(stdout()) > > ### Name: least.squares.capa.ident > ### Title: Least squares capacity identification > ### Aliases: least.squares.capa.ident > ### Keywords: math > > ### ** Examples > > > ## the number of data > n.d <- 20 > > ## a randomly generated 5-criteria matrix > C <- matrix(rnorm(5*n.d,10,2),n.d,5) > > ## the corresponding global scores > g <- numeric(n.d) > mu <- capacity(c(0:29,29,29)/29) > for (i in 1:n.d) + g[i] <- Choquet.integral(mu,C[i,]) > > ## Not run: > ##D ## the full solution > ##D lsc <- least.squares.capa.ident(5,5,C,g) > ##D a <- lsc$solution > ##D a > ##D mu.sol <- zeta(a) > ##D > ##D ## the difference between mu and mu.sol > ##D mu@data - mu.sol@data > ##D > ##D ## the residuals > ##D lsc$residuals > ##D > ##D ## the mean square error > ##D mean(lsc$residuals^2) > ##D > ##D ## a 3-additive solution > ##D lsc <- least.squares.capa.ident(5,3,C,g) > ##D a <- lsc$solution > ##D mu.sol <- zeta(a) > ##D mu@data - mu.sol@data > ##D lsc$residuals > ## End(Not run) > > > ## a similar example based on the Sipos integral > > ## a randomly generated 5-criteria matrix > C <- matrix(rnorm(5*n.d,0,2),n.d,5) > > ## the corresponding global scores > g <- numeric(n.d) > mu <- capacity(c(0:29,29,29)/29) > for (i in 1:n.d) + g[i] <- Sipos.integral(mu,C[i,]) > > ## Not run: > ##D ## the full solution > ##D lsc <- least.squares.capa.ident(5,5,C,g,Integral = "Sipos") > ##D a <- lsc$solution > ##D mu.sol <- zeta(a) > ##D mu@data - mu.sol@data > ##D lsc$residuals > ##D > ##D ## a 3-additive solution > ##D lsc <- least.squares.capa.ident(5,3,C,g,Integral = "Sipos") > ##D a <- lsc$solution > ##D mu.sol <- zeta(a) > ##D mu@data - mu.sol@data > ##D lsc$residuals > ## End(Not run) > > > ## additional constraints > > ## a Shapley preorder constraint matrix > ## Sh(1) - Sh(2) >= -delta.S > ## Sh(2) - Sh(1) >= -delta.S > ## Sh(3) - Sh(4) >= -delta.S > ## Sh(4) - Sh(3) >= -delta.S > ## i.e. criteria 1,2 and criteria 3,4 > ## should have the same global importances > delta.S <- 0.01 > Asp <- rbind(c(1,2,-delta.S), + c(2,1,-delta.S), + c(3,4,-delta.S), + c(4,3,-delta.S) + ) > > ## a Shapley interval constraint matrix > ## 0.3 <= Sh(1) <= 0.9 > Asi <- rbind(c(1,0.3,0.9)) > > ## an interaction preorder constraint matrix > ## such that I(12) = I(45) > delta.I <- 0.01 > Aip <- rbind(c(1,2,4,5,-delta.I), + c(4,5,1,2,-delta.I)) > > ## an interaction interval constraint matrix > ## i.e. -0.20 <= I(12) <= -0.15 > delta.I <- 0.01 > Aii <- rbind(c(1,2,-0.2,-0.15)) > > ## an inter-additive partition constraint > ## criteria 1,2,3 and criteria 4,5 are independent > Aiap <- c(1,1,1,2,2) > > > > ## a more constrained solution > > lsc <- least.squares.capa.ident(5,5,C,g,Integral = "Sipos", + A.Shapley.preorder = Asp, + A.Shapley.interval = Asi, + A.interaction.preorder = Aip, + A.interaction.interval = Aii, + A.inter.additive.partition = Aiap, + sigf = 5) Warning in rbind(sigma, beta) : number of columns of result not a multiple of vector length (arg 2) > > a <- lsc$solution > mu.sol <- zeta(a) > mu@data - mu.sol@data [1] 0.000000e+00 -1.934924e-01 -3.629596e-01 -4.794334e-01 2.840685e-02 [6] -4.144969e-01 -8.709869e-02 -1.346071e-01 -2.840028e-02 -1.184444e-01 [11] -2.189461e-01 -2.664544e-01 2.069031e-01 -1.670351e-01 1.603631e-01 [16] 4.388912e-02 -1.349237e-01 -2.249678e-01 -3.254695e-01 -3.729778e-01 [21] 1.003798e-01 -2.735585e-01 5.383972e-02 -6.263425e-02 2.035727e-01 [26] 1.824940e-01 8.199237e-02 -3.448144e-02 4.733588e-01 3.045509e-02 [31] 2.544050e-01 2.240198e-10 > lsc$residuals [1] -0.05963137 -0.04470915 0.63410159 0.11569759 0.02709655 -0.72004795 [7] -0.16408733 -0.62527005 -0.24347211 -0.81616139 0.33233613 0.48537466 [13] -0.61578720 0.39969224 -0.54639406 0.31388259 0.96522926 -0.02193253 [19] 0.17259077 0.68902569 > summary(a) Shapley value : 1 2 3 4 5 0.30000001 0.29000001 0.09633127 0.08633129 0.22733742 Shapley interaction indices : 1 2 3 4 5 1 NA -1.500001e-01 1.764299e-01 1.494118e-09 1.653554e-09 2 -1.500001e-01 NA -2.514700e-01 1.243012e-09 1.348793e-09 3 1.764299e-01 -2.514700e-01 NA 1.071158e-09 1.006189e-09 4 1.494118e-09 1.243012e-09 1.071158e-09 NA -1.600001e-01 5 1.653554e-09 1.348793e-09 1.006189e-09 -1.600001e-01 NA Orness : 0.59626 Veto indices : 1 2 3 4 5 0.4850364 0.4342135 0.3471737 0.3320737 0.4202025 Favor indices : 1 2 3 4 5 0.6399636 0.6782865 0.5232404 0.5258404 0.6139693 Normalized variance : 0.1612258 Normalized entropy : 0.763725 > > > > cleanEx(); ..nameEx <- "ls.sorting.capa.ident" > > ### * ls.sorting.capa.ident > > flush(stderr()); flush(stdout()) > > ### Name: ls.sorting.capa.ident > ### Title: Least squares capacity identification in the framework of a > ### sorting procedure > ### Aliases: ls.sorting.capa.ident > ### Keywords: math > > ### ** Examples > > > ## generate a random problem with 10 prototypes and 4 criteria > n.proto <- 10 ## prototypes > n <- 4 ## criteria > k <- 4 > d <- 0.1 > > ## generating random data for the prototypes > C <- matrix(runif(n.proto*n,0,1),n.proto,n) > cl <- numeric(n.proto) > > ## the corresponding global evaluations > glob.eval <- numeric(n.proto) > a <- capacity(c(0:(2^n-3),(2^n-3),(2^n-3))/(2^n-3)) > for (i in 1:n.proto) + glob.eval[i] <- Choquet.integral(a,C[i,]) > > ## and the classes for the prototypes > cl[glob.eval <= 0.33] <- 1 > cl[glob.eval > 0.33 & glob.eval <= 0.66] <-2 > cl[glob.eval > 0.66] <- 3 > > cl [1] 2 2 2 1 2 2 3 2 3 2 > > ## Not run: > ##D # starting the calculations > ##D # search for a capacity which satisfies the constraints > ##D lsc <- ls.sorting.capa.ident(n ,k, C, cl, d) > ##D > ##D ## output of the quadratic program (ipop, package kernlab) > ##D lsc$how > ##D > ##D ## the capacity satisfying the constraints > ##D lsc$solution > ##D summary(lsc$solution) > ##D ## the global evaluations satisfying the constraints > ##D lsc$glob.eval > ## End(Not run) > > ## let us now add some constraints > > ## a Shapley preorder constraint matrix > ## Sh(1) > Sh(2) > ## Sh(3) > Sh(4) > delta.S <-0.01 > Asp <- rbind(c(1,2,delta.S), c(3,4,delta.S)) > > ## a Shapley interval constraint matrix > ## 0.1 <= Sh(1) <= 0.2 > Asi <- rbind(c(1,0.1,0.2)) > > ## an interaction preorder constraint matrix > ## such that I(12) > I(34) > delta.I <- 0.01 > Aip <- rbind(c(1,2,3,4,delta.I)) > > ## an interaction interval constraint matrix > ## i.e. 0.2 <= I(12) <= 0.4 > ## and 0 < I(34) <= 1 > Aii <- rbind(c(1,2,0.2,0.4), c(3,4,delta.I,1)) > > ## an inter-additive partition constraint > ## criteria 1,2 and criteria 3,4 are independent > Aiap <- c(1,1,2,2) > > ## starting the calculations > ## search for a capacity which satisfies the constraints > lsc <- ls.sorting.capa.ident(n ,k, C, cl, d, + A.Shapley.preorder = Asp, + A.Shapley.interval = Asi, + A.interaction.preorder = Aip, + A.interaction.interval = Aii, + A.inter.additive.partition = Aiap) Warning in rbind(sigma, beta) : number of columns of result not a multiple of vector length (arg 2) > > ## output of ipop > lsc$how [1] "converged" > ## the capacity satisfying the constraints > lsc$solution Mobius.capacity {} 0.000000 {1} 0.099999 {2} 0.089999 {3} 0.305000 {4} 0.295000 {1,2} 0.200002 {1,3} 0.000000 {1,4} -0.000000 {2,3} 0.000000 {2,4} -0.000000 {3,4} 0.010000 {1,2,3} 0.000000 {1,2,4} 0.000000 {1,3,4} 0.000000 {2,3,4} 0.000000 {1,2,3,4} 0.000000 > summary(lsc$solution) Shapley value : 1 2 3 4 0.1999998 0.1899998 0.3100002 0.3000002 Shapley interaction indices : 1 2 3 4 1 NA 2.000015e-01 2.979399e-13 2.816738e-13 2 2.000015e-01 NA 4.244533e-13 3.864737e-13 3 2.979399e-13 4.244533e-13 NA 1.000003e-02 4 2.816738e-13 3.864737e-13 1.000003e-02 NA Orness : 0.4416662 Veto indices : 1 2 3 4 0.5355559 0.5288892 0.5877783 0.5811116 Favor indices : 1 2 3 4 0.3977771 0.3911104 0.4922220 0.4855553 Normalized variance : 0.04300053 Normalized entropy : 0.9433422 > ## the global evaluations satisfying the constraints > lsc$glob.eval [1] 0.5183923 0.3486155 0.5256927 0.2486147 0.4580393 0.5256926 0.6256929 [8] 0.4370614 0.6591117 0.3486151 > > > > > cleanEx(); ..nameEx <- "ls.sorting.treatment" > > ### * ls.sorting.treatment > > flush(stderr()); flush(stdout()) > > ### Name: ls.sorting.treatment > ### Title: Least squares capacity identification in the framework of a > ### sorting procedure: evaluation of the determined capacity > ### Aliases: ls.sorting.treatment > ### Keywords: math > > ### ** Examples > > > ## generate a random problem with 10 prototypes and 4 criteria > n.proto <- 10 ## prototypes > n <- 4 ## criteria > P <- matrix(runif(n.proto*n,0,1),n.proto,n) > > ## the corresponding global scores, based on a randomly generated > ## capacity a > glob.eval <- numeric(n.proto) > a <- capacity(c(0:(2^n-3),(2^n-3),(2^n-3))/(2^n-3)) > for (i in 1:n.proto) + glob.eval[i] <- Choquet.integral(a,P[i,]) > > ## based on these global scores, let us create a classification (3 classes) > cl.proto<-numeric(n.proto) > cl.proto[glob.eval <= 0.33] <- 1 > cl.proto[glob.eval > 0.33 & glob.eval<=0.66] <-2 > cl.proto[glob.eval > 0.66] <- 3 > > ## search for a capacity which satisfies the constraints > lsc <- ls.sorting.capa.ident(n ,4, P, cl.proto, 0.1) Warning in rbind(sigma, beta) : number of columns of result not a multiple of vector length (arg 2) > > ## output of the QP > lsc$how [1] "converged" > > ## analyse the quality of the model (classify the prototypes by the > ## model and compare both assignments) > lst <- ls.sorting.treatment(P,cl.proto,lsc$solution,P,cl.proto) > > ## assignments of the prototypes > lst$class.A [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 2 2 2 1 2 2 3 2 3 2 [2,] 2 2 2 1 2 2 3 2 3 2 > ## assignment types > lst$correct.A [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 1 1 1 1 1 1 1 1 1 1 [2,] 0 0 0 0 0 0 0 0 0 0 [3,] 0 0 0 0 0 0 0 0 0 0 [4,] 0 0 0 0 0 0 0 0 0 0 > ## evaluation > lst$eval.correct [1] 1 0 0 0 > > ## generate a second set of random alternatives (A) > ## their "correct" class is determined as beforehand with the > ## randomly generated capacity a > ## the goal is to see if we can reproduce this classification > ## by the capacity learnt from the prototypes > > ## a randomly generated criteria matrix of 10 alternatives > A <- matrix(runif(10*n,0,1),10,n) > cl.orig.A <-numeric(10) > > ## the corresponding global scores > glob.eval.A <- numeric(10) > for (i in 1:10) + glob.eval.A[i] <- Choquet.integral(a,A[i,]) > > ## based on these global scores, let us determine a classification > cl.orig.A[glob.eval.A <= 0.33] <- 1 > cl.orig.A[glob.eval.A>0.33 & glob.eval.A<=0.66] <-2 > cl.orig.A[glob.eval.A > 0.66] <- 3 > > ## let us now classify the alternatives of A according to the model > ## built on P > > lst <- ls.sorting.treatment(P,cl.proto,lsc$solution,A,cl.orig.A) > > ## assignment of the alternatives of A > lst$class.A [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 2 2 2 1 2 2 2 2 2 3 [2,] 3 3 2 2 2 2 3 2 3 3 > ## type of assignments > lst$correct.A [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 0 0 1 0 1 1 0 1 0 1 [2,] 1 1 0 1 0 0 1 0 1 0 [3,] 0 0 0 0 0 0 0 0 0 0 [4,] 0 0 0 0 0 0 0 0 0 0 > ## evaluation > lst$eval.correct [1] 0.5 0.5 0.0 0.0 > > ## show the learnt capacity > ## x11() > ## barplot(Shapley.value(lsc$solution), main="Learnt capacity", sub="Shapley") > ## summary of the learnt capacity > lsc$solution Mobius.capacity {} 0.000000 {1} 0.002993 {2} 0.042950 {3} 0.171595 {4} 0.347543 {1,2} 0.011565 {1,3} 0.290460 {1,4} 0.167683 {2,3} -0.013151 {2,4} -0.013469 {3,4} 0.422559 {1,2,3} 0.355518 {1,2,4} 0.439593 {1,3,4} -0.408164 {2,3,4} 0.029024 {1,2,3,4} -0.846697 > summary(lsc$solution) Shapley value : 1 2 3 4 0.15515489 0.09845918 0.30198049 0.44440544 Shapley interaction indices : 1 2 3 4 1 NA 0.12688808 -0.01809540 -0.09883497 2 0.12688808 NA -0.10311271 -0.06139333 3 -0.01809540 -0.10311271 NA -0.04924372 4 -0.09883497 -0.06139333 -0.04924372 NA Orness : 0.5095702 Veto indices : 1 2 3 4 0.4396280 0.3965446 0.5174662 0.6080806 Favor indices : 1 2 3 4 0.4339119 0.4014009 0.5518411 0.6511267 Normalized variance : 0.3824951 Normalized entropy : 0.572115 > > > > > cleanEx(); ..nameEx <- "mini.var.capa.ident" > > ### * mini.var.capa.ident > > flush(stderr()); flush(stdout()) > > ### Name: mini.var.capa.ident > ### Title: Minimum variance capacity identification > ### Aliases: mini.var.capa.ident > ### Keywords: math > > ### ** Examples > > ## some alternatives > a <- c(18,11,18,11,11) > b <- c(18,18,11,11,11) > c <- c(11,11,18,18,11) > d <- c(18,11,11,11,18) > e <- c(11,11,18,11,18) > > ## preference threshold relative > ## to the preorder of the alternatives > delta.C <- 1 > > ## corresponding Choquet preorder constraint matrix > Acp <- rbind(c(d,a,delta.C), + c(a,e,delta.C), + c(e,b,delta.C), + c(b,c,delta.C) + ) > > ## a Shapley preorder constraint matrix > ## Sh(1) - Sh(2) >= -delta.S > ## Sh(2) - Sh(1) >= -delta.S > ## Sh(3) - Sh(4) >= -delta.S > ## Sh(4) - Sh(3) >= -delta.S > ## i.e. criteria 1,2 and criteria 3,4 > ## should have the same global importances > delta.S <- 0.01 > Asp <- rbind(c(1,2,-delta.S), + c(2,1,-delta.S), + c(3,4,-delta.S), + c(4,3,-delta.S) + ) > > ## a Shapley interval constraint matrix > ## 0.3 <= Sh(1) <= 0.9 > Asi <- rbind(c(1,0.3,0.9)) > > ## an interaction preorder constraint matrix > ## such that I(12) = I(34) > delta.I <- 0.01 > Aip <- rbind(c(1,2,3,4,-delta.I), + c(3,4,1,2,-delta.I)) > > ## an interaction interval constraint matrix > ## i.e. -0.20 <= I(12) <= -0.15 > delta.I <- 0.01 > Aii <- rbind(c(1,2,-0.2,-0.15)) > > ## a minimum variance 2-additive solution > min.var <- mini.var.capa.ident(5,2,A.Choquet.preorder = Acp) > m <- min.var$solution > m Mobius.capacity {} 0.000000 {1} 0.291962 {2} 0.183746 {3} 0.149105 {4} 0.036238 {5} 0.398582 {1,2} -0.183745 {1,3} 0.136610 {1,4} -0.000000 {1,5} 0.029991 {2,3} 0.005046 {2,4} 0.101568 {2,5} -0.000000 {3,4} -0.036237 {3,5} -0.112867 {4,5} 0.000000 > > ## the resulting global evaluations > rbind(c(a,mean(a),Choquet.integral(m,a)), + c(b,mean(b),Choquet.integral(m,b)), + c(c,mean(c),Choquet.integral(m,c)), + c(d,mean(d),Choquet.integral(m,d)), + c(e,mean(e),Choquet.integral(m,e))) [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 18 11 18 11 11 13.8 15.04374 [2,] 18 18 11 11 11 13.8 13.04374 [3,] 11 11 18 18 11 13.8 12.04374 [4,] 18 11 11 11 18 13.8 16.04374 [5,] 11 11 18 11 18 13.8 14.04374 > > ## the Shapley value > Shapley.value(m) 1 2 3 4 5 0.28339006 0.14518087 0.14538137 0.06890384 0.35714386 > > ## a minimum variance 3-additive more constrained solution > min.var2 <- mini.var.capa.ident(5,3, + A.Choquet.preorder = Acp, + A.Shapley.preorder = Asp) > m <- min.var2$solution > m Mobius.capacity {} 0.000000 {1} 0.244167 {2} 0.240948 {3} 0.118006 {4} 0.118006 {5} 0.289053 {1,2} -0.224250 {1,3} 0.184406 {1,4} -0.009865 {1,5} 0.156216 {2,3} 0.055736 {2,4} 0.111378 {2,5} -0.070164 {3,4} -0.118005 {3,5} -0.003337 {4,5} 0.001006 {1,2,3} -0.005691 {1,2,4} 0.086434 {1,2,5} 0.064969 {1,3,4} 0.009865 {1,3,5} -0.261833 {1,4,5} -0.109146 {2,3,4} -0.000039 {2,3,5} 0.021339 {2,4,5} -0.052047 {3,4,5} 0.152851 > rbind(c(a,mean(a),Choquet.integral(m,a)), + c(b,mean(b),Choquet.integral(m,b)), + c(c,mean(c),Choquet.integral(m,c)), + c(d,mean(d),Choquet.integral(m,d)), + c(e,mean(e),Choquet.integral(m,e))) [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 18 11 18 11 11 13.8 14.82605 [2,] 18 18 11 11 11 13.8 12.82605 [3,] 11 11 18 18 11 13.8 11.82605 [4,] 18 11 11 11 18 13.8 15.82605 [5,] 11 11 18 11 18 13.8 13.82605 > Shapley.value(m) 1 2 3 4 5 0.2256191 0.2156191 0.1495690 0.1395690 0.2696237 > > ## a minimum variance 5-additive more constrained solution > min.var3 <- mini.var.capa.ident(5,5, + A.Choquet.preorder = Acp, + A.Shapley.preorder = Asp, + A.Shapley.interval = Asi, + A.interaction.preorder = Aip, + A.interaction.interval = Aii) > > m <- min.var3$solution > m Mobius.capacity {} 0.000000 {1} 0.277968 {2} 0.277968 {3} 0.117798 {4} 0.116752 {5} 0.141094 {1,2} -0.277967 {1,3} 0.167917 {1,4} 0.095170 {1,5} 0.287479 {2,3} 0.118908 {2,4} 0.139738 {2,5} 0.098626 {3,4} -0.099439 {3,5} 0.161934 {4,5} -0.000044 {1,2,3} 0.096023 {1,2,4} 0.164392 {1,2,5} -0.024410 {1,3,4} -0.112483 {1,3,5} -0.447648 {1,4,5} -0.211878 {2,3,4} -0.061228 {2,3,5} -0.237635 {2,4,5} -0.094907 {3,4,5} -0.017268 {1,2,3,4} -0.113658 {1,2,3,5} 0.184804 {1,2,4,5} -0.019047 {1,3,4,5} 0.229190 {2,3,4,5} 0.071460 {1,2,3,4,5} -0.029610 > rbind(c(a,mean(a),Choquet.integral(m,a)), + c(b,mean(b),Choquet.integral(m,b)), + c(c,mean(c),Choquet.integral(m,c)), + c(d,mean(d),Choquet.integral(m,d)), + c(e,mean(e),Choquet.integral(m,e))) [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 18 11 18 11 11 13.8 14.94578 [2,] 18 18 11 11 11 13.8 12.94578 [3,] 11 11 18 18 11 13.8 11.94578 [4,] 18 11 11 11 18 13.8 15.94578 [5,] 11 11 18 11 18 13.8 13.94578 > summary(m) Shapley value : 1 2 3 4 5 0.3000000 0.2900000 0.1194055 0.1094055 0.1811889 Shapley interaction indices : 1 2 3 4 5 1 NA -0.150000000 0.02857307 0.03994551 0.069757382 2 -0.15000000 NA 0.05762099 0.11604925 -0.008179734 3 0.02857307 0.057620989 NA -0.14000000 -0.034926277 4 0.03994551 0.116049246 -0.14000000 NA -0.075605322 5 0.06975738 -0.008179734 -0.03492628 -0.07560532 NA Orness : 0.5381275 Veto indices : 1 2 3 4 5 0.5271926 0.5254204 0.4053566 0.4042635 0.4471292 Favor indices : 1 2 3 4 5 0.5978074 0.5870796 0.4939004 0.4824934 0.5293569 Normalized variance : 0.108694 Normalized entropy : 0.8465558 > > > > > cleanEx(); ..nameEx <- "normalize-methods" > > ### * normalize-methods > > flush(stderr()); flush(stdout()) > > ### Name: normalize-methods > ### Title: Normalizes a capacity. > ### Aliases: normalize normalize-methods normalize,Mobius.capacity-method > ### normalize,capacity-method normalize,card.capacity-method > ### Keywords: methods > > ### ** Examples > > ## a capacity > mu <- capacity(0:15) > > ## normalize it > is.normalized(mu) [1] FALSE > normalize(mu) capacity {} 0.000000 {1} 0.066667 {2} 0.133333 {3} 0.200000 {4} 0.266667 {1,2} 0.333333 {1,3} 0.400000 {1,4} 0.466667 {2,3} 0.533333 {2,4} 0.600000 {3,4} 0.666667 {1,2,3} 0.733333 {1,2,4} 0.800000 {1,3,4} 0.866667 {2,3,4} 0.933333 {1,2,3,4} 1.000000 > > ## a similar example with a Mobius.capacity object > a <- Mobius(mu) > is.normalized(a) [1] FALSE > normalize(a) Mobius.capacity {} 0.000000 {1} 0.066667 {2} 0.133333 {3} 0.200000 {4} 0.266667 {1,2} 0.133333 {1,3} 0.133333 {1,4} 0.133333 {2,3} 0.200000 {2,4} 0.200000 {3,4} 0.200000 {1,2,3} -0.133333 {1,2,4} -0.133333 {1,3,4} -0.133333 {2,3,4} -0.266667 {1,2,3,4} 0.000000 > zeta(normalize(a)) capacity {} 0.000000 {1} 0.066667 {2} 0.133333 {3} 0.200000 {4} 0.266667 {1,2} 0.333333 {1,3} 0.400000 {1,4} 0.466667 {2,3} 0.533333 {2,4} 0.600000 {3,4} 0.666667 {1,2,3} 0.733333 {1,2,4} 0.800000 {1,3,4} 0.866667 {2,3,4} 0.933333 {1,2,3,4} 1.000000 > > ## a similar example with a card.capacity object > mu <- card.capacity(0:6) > is.normalized(mu) [1] FALSE > normalize(mu) card.capacity 0 0.0000000 1 0.1666667 2 0.3333333 3 0.5000000 4 0.6666667 5 0.8333333 6 1.0000000 > Mobius(normalize(mu)) Mobius.card.set.func 0 0.000000e+00 1 1.666667e-01 2 0.000000e+00 3 0.000000e+00 4 -1.110223e-16 5 6.661338e-16 6 0.000000e+00 > > > > > cleanEx(); ..nameEx <- "orness-methods" > > ### * orness-methods > > flush(stderr()); flush(stdout()) > > ### Name: orness-methods > ### Title: Orness degree > ### Aliases: orness orness-methods orness,Mobius.capacity-method > ### orness,capacity-method orness,card.capacity-method > ### Keywords: methods > > ### ** Examples > > ## the upper capacity > mu <- capacity(c(0,rep(1,15))) > > ## the Choquet integral w.r.t mu behaves like the maximum operator > f <- c(0.1,0.1,0,0.9) > Choquet.integral(mu,f) [1] 0.9 > > ## its orness is 1 > orness(mu) [1] 1 > > ## the same example with a Mobius.capacity object > a <- Mobius(mu) > Choquet.integral(a,f) [1] 0.9 > orness(a) [1] 1 > > ## the same example with a card.capacity object > mu <- upper.capacity(4) > Choquet.integral(mu,f) [1] 0.9 > orness(mu) [1] 1 > > > > cleanEx(); ..nameEx <- "round-methods" > > ### * round-methods > > flush(stderr()); flush(stdout()) > > ### Name: round-methods > ### Title: Rounding of set function coefficients > ### Aliases: round-methods round,superclass.set.func-method > ### Keywords: methods > > ### ** Examples > > ## a capacity > mu <- capacity(0:15/15) > mu capacity {} 0.000000 {1} 0.066667 {2} 0.133333 {3} 0.200000 {4} 0.266667 {1,2} 0.333333 {1,3} 0.400000 {1,4} 0.466667 {2,3} 0.533333 {2,4} 0.600000 {3,4} 0.666667 {1,2,3} 0.733333 {1,2,4} 0.800000 {1,3,4} 0.866667 {2,3,4} 0.933333 {1,2,3,4} 1.000000 > round(mu,2) capacity {} 0.000000 {1} 0.070000 {2} 0.130000 {3} 0.200000 {4} 0.270000 {1,2} 0.330000 {1,3} 0.400000 {1,4} 0.470000 {2,3} 0.530000 {2,4} 0.600000 {3,4} 0.670000 {1,2,3} 0.730000 {1,2,4} 0.800000 {1,3,4} 0.870000 {2,3,4} 0.930000 {1,2,3,4} 1.000000 > > ## a similar example with a Mobius.capacity object > a <- Mobius(mu) > a Mobius.capacity {} 0.000000 {1} 0.066667 {2} 0.133333 {3} 0.200000 {4} 0.266667 {1,2} 0.133333 {1,3} 0.133333 {1,4} 0.133333 {2,3} 0.200000 {2,4} 0.200000 {3,4} 0.200000 {1,2,3} -0.133333 {1,2,4} -0.133333 {1,3,4} -0.133333 {2,3,4} -0.266667 {1,2,3,4} -0.000000 > round(a,1) Mobius.capacity {} 0.000000 {1} 0.100000 {2} 0.100000 {3} 0.200000 {4} 0.300000 {1,2} 0.100000 {1,3} 0.100000 {1,4} 0.100000 {2,3} 0.200000 {2,4} 0.200000 {3,4} 0.200000 {1,2,3} -0.100000 {1,2,4} -0.100000 {1,3,4} -0.100000 {2,3,4} -0.300000 {1,2,3,4} -0.000000 > > ## a similar example with a card.capacity object > mu <- uniform.capacity(6) > mu card.capacity 0 0.0000000 1 0.1666667 2 0.3333333 3 0.5000000 4 0.6666667 5 0.8333333 6 1.0000000 > round(mu) card.capacity 0 0 1 0 2 0 3 0 4 1 5 1 6 1 > > > > cleanEx(); ..nameEx <- "set.func-class" > > ### * set.func-class > > flush(stderr()); flush(stdout()) > > ### Name: set.func-class > ### Title: Class "set.func" > ### Aliases: set.func-class > ### Keywords: classes > > ### ** Examples > > ## a set function > mu <- set.func(c(1:8,8:1)/8) > > ## the attributes of the object > mu@n [1] 4 > mu@data [1] 0.125 0.250 0.375 0.750 0.500 0.875 1.000 0.625 0.625 1.000 0.875 0.500 [13] 0.750 0.375 0.250 0.125 > mu@subsets [1] 0 1 2 4 8 3 5 9 6 10 12 7 11 13 14 15 > > ## some conversions that cannot work > ## Not run: as.game(mu) > ## Not run: as.capacity(mu) > ## Not run: as.card.set.func(mu) > > ## some tests > is.cardinal(mu) [1] FALSE > is.kadditive(mu,2) [1] FALSE > is.monotone(mu) [1] FALSE > > ## some transformations > dual(mu) game {} 0.000000 {1} -0.125000 {2} -0.250000 {3} -0.375000 {4} -0.500000 {1,2} -0.625000 {1,3} -0.750000 {1,4} -0.875000 {2,3} -0.875000 {2,4} -0.750000 {3,4} -0.625000 {1,2,3} -0.500000 {1,2,4} -0.375000 {1,3,4} -0.250000 {2,3,4} -0.125000 {1,2,3,4} 0.000000 > Mobius(mu) Mobius.set.func {} 0.125000 {1} 0.125000 {2} 0.250000 {3} 0.375000 {4} 0.500000 {1,2} 0.250000 {1,3} 0.250000 {1,4} 0.250000 {2,3} 0.250000 {2,4} 0.000000 {3,4} -0.250000 {1,2,3} -1.000000 {1,2,4} -1.000000 {1,3,4} -1.000000 {2,3,4} -1.000000 {1,2,3,4} 2.000000 > k.truncate.Mobius(mu,2) Mobius.set.func {} 0.125000 {1} 0.125000 {2} 0.250000 {3} 0.375000 {4} 0.500000 {1,2} 0.250000 {1,3} 0.250000 {1,4} 0.250000 {2,3} 0.250000 {2,4} 0.000000 {3,4} -0.250000 > > ## summary > Shapley.value(mu) 1 2 3 4 0.000000e+00 -6.938894e-18 1.387779e-17 0.000000e+00 > interaction.indices(mu) 1 2 3 4 1 NA -0.08333333 -0.08333333 -0.08333333 2 -0.08333333 NA -0.08333333 -0.33333333 3 -0.08333333 -0.08333333 NA -0.58333333 4 -0.08333333 -0.33333333 -0.58333333 NA > # the same > summary(mu) Shapley value : 1 2 3 4 0.000000e+00 -6.938894e-18 1.387779e-17 0.000000e+00 Shapley interaction indices : 1 2 3 4 1 NA -0.08333333 -0.08333333 -0.08333333 2 -0.08333333 NA -0.08333333 -0.33333333 3 -0.08333333 -0.08333333 NA -0.58333333 4 -0.08333333 -0.33333333 -0.58333333 NA > > ## save the set function to a file > d <- to.data.frame(mu) > write.table(d,"my.set.func.csv",sep="\t") > > # finally, some conversions that should work > mu <- set.func(c(0,1,1,1,2,2,2,3)) > as.game(mu) game {} 0.000000 {1} 1.000000 {2} 1.000000 {3} 1.000000 {1,2} 2.000000 {1,3} 2.000000 {2,3} 2.000000 {1,2,3} 3.000000 > as.capacity(mu) capacity {} 0.000000 {1} 1.000000 {2} 1.000000 {3} 1.000000 {1,2} 2.000000 {1,3} 2.000000 {2,3} 2.000000 {1,2,3} 3.000000 > as.card.set.func(mu) card.set.func 0 0 1 1 2 2 3 3 > > > > cleanEx(); ..nameEx <- "set.func.gen" > > ### * set.func.gen > > flush(stderr()); flush(stdout()) > > ### Name: set.func > ### Title: Create objects of class "set.func", "game", or "capacity". > ### Aliases: set.func game capacity > ### Keywords: math > > ### ** Examples > > set.func(-12:3) set.func {} -12.000000 {1} -11.000000 {2} -10.000000 {3} -9.000000 {4} -8.000000 {1,2} -7.000000 {1,3} -6.000000 {1,4} -5.000000 {2,3} -4.000000 {2,4} -3.000000 {3,4} -2.000000 {1,2,3} -1.000000 {1,2,4} 0.000000 {1,3,4} 1.000000 {2,3,4} 2.000000 {1,2,3,4} 3.000000 > game(c(0,rep(-1,15))) game {} 0.000000 {1} -1.000000 {2} -1.000000 {3} -1.000000 {4} -1.000000 {1,2} -1.000000 {1,3} -1.000000 {1,4} -1.000000 {2,3} -1.000000 {2,4} -1.000000 {3,4} -1.000000 {1,2,3} -1.000000 {1,2,4} -1.000000 {1,3,4} -1.000000 {2,3,4} -1.000000 {1,2,3,4} -1.000000 > capacity(0:15) capacity {} 0.000000 {1} 1.000000 {2} 2.000000 {3} 3.000000 {4} 4.000000 {1,2} 5.000000 {1,3} 6.000000 {1,4} 7.000000 {2,3} 8.000000 {2,4} 9.000000 {3,4} 10.000000 {1,2,3} 11.000000 {1,2,4} 12.000000 {1,3,4} 13.000000 {2,3,4} 14.000000 {1,2,3,4} 15.000000 > > > > cleanEx(); ..nameEx <- "show-methods" > > ### * show-methods > > flush(stderr()); flush(stdout()) > > ### Name: show-methods > ### Title: Methods for Function show in Package `kappalab' > ### Aliases: show-methods show,superclass.set.func-method > ### show,set.func-method show,Mobius.set.func-method > ### show,summary.superclass.set.func-method > ### show,summary.superclass.capacity-method > ### Keywords: methods > > ### ** Examples > > ## a set function > mu <- set.func(0:15/15) > show(mu) set.func {} 0.000000 {1} 0.066667 {2} 0.133333 {3} 0.200000 {4} 0.266667 {1,2} 0.333333 {1,3} 0.400000 {1,4} 0.466667 {2,3} 0.533333 {2,4} 0.600000 {3,4} 0.666667 {1,2,3} 0.733333 {1,2,4} 0.800000 {1,3,4} 0.866667 {2,3,4} 0.933333 {1,2,3,4} 1.000000 > ## the same > mu set.func {} 0.000000 {1} 0.066667 {2} 0.133333 {3} 0.200000 {4} 0.266667 {1,2} 0.333333 {1,3} 0.400000 {1,4} 0.466667 {2,3} 0.533333 {2,4} 0.600000 {3,4} 0.666667 {1,2,3} 0.733333 {1,2,4} 0.800000 {1,3,4} 0.866667 {2,3,4} 0.933333 {1,2,3,4} 1.000000 > > ## a Möbius transform > a <- Mobius.set.func(0:10,4,2) > show(a) Mobius.set.func {} 0.000000 {1} 1.000000 {2} 2.000000 {3} 3.000000 {4} 4.000000 {1,2} 5.000000 {1,3} 6.000000 {1,4} 7.000000 {2,3} 8.000000 {2,4} 9.000000 {3,4} 10.000000 > a Mobius.set.func {} 0.000000 {1} 1.000000 {2} 2.000000 {3} 3.000000 {4} 4.000000 {1,2} 5.000000 {1,3} 6.000000 {1,4} 7.000000 {2,3} 8.000000 {2,4} 9.000000 {3,4} 10.000000 > > ## a cardinal capacity > mu <- lower.capacity(5) > show(mu) card.capacity 0 0 1 0 2 0 3 0 4 0 5 1 > mu card.capacity 0 0 1 0 2 0 3 0 4 0 5 1 > > > > cleanEx(); ..nameEx <- "summary.superclass.capacity-class" > > ### * summary.superclass.capacity-class > > flush(stderr()); flush(stdout()) > > ### Name: summary.superclass.capacity-class > ### Title: Class "summary.superclass.capacity" > ### Aliases: summary.superclass.capacity-class > ### Keywords: classes > > ### ** Examples > > ## a capacity > mu <- capacity(c(0:13,13,13)/13) > a <- Mobius(mu) > > ## its summary > summary(mu) Shapley value : 1 2 3 4 0.1346154 0.2115385 0.2884615 0.3653846 Shapley interaction indices : 1 2 3 4 1 NA -0.02564103 -0.02564103 -0.02564103 2 -0.02564103 NA -0.06410256 -0.06410256 3 -0.02564103 -0.06410256 NA -0.06410256 4 -0.02564103 -0.06410256 -0.06410256 NA Orness : 0.5705128 Veto indices : 1 2 3 4 0.3589744 0.4017094 0.4529915 0.5042735 Favor indices : 1 2 3 4 0.4871795 0.5470085 0.5982906 0.6495726 Normalized variance : 0.1439842 Normalized entropy : 0.8073944 > summary(a) Shapley value : 1 2 3 4 0.1346154 0.2115385 0.2884615 0.3653846 Shapley interaction indices : 1 2 3 4 1 NA -0.02564103 -0.02564103 -0.02564103 2 -0.02564103 NA -0.06410256 -0.06410256 3 -0.02564103 -0.06410256 NA -0.06410256 4 -0.02564103 -0.06410256 -0.06410256 NA Orness : 0.5705128 Veto indices : 1 2 3 4 0.3589744 0.4017094 0.4529915 0.5042735 Favor indices : 1 2 3 4 0.4871795 0.5470085 0.5982906 0.6495726 Normalized variance : 0.1439842 Normalized entropy : 0.8073944 > > > > cleanEx(); ..nameEx <- "summary.superclass.set.func-class" > > ### * summary.superclass.set.func-class > > flush(stderr()); flush(stdout()) > > ### Name: summary.superclass.set.func-class > ### Title: Class "summary.superclass.set.func" > ### Aliases: summary.superclass.set.func-class > ### Keywords: classes > > ### ** Examples > > ## a capacity > mu <- set.func(c(0:13,13,13)/13) > a <- Mobius(mu) > > ## its summary > summary(mu) Shapley value : 1 2 3 4 0.1346154 0.2115385 0.2884615 0.3653846 Shapley interaction indices : 1 2 3 4 1 NA -0.02564103 -0.02564103 -0.02564103 2 -0.02564103 NA -0.06410256 -0.06410256 3 -0.02564103 -0.06410256 NA -0.06410256 4 -0.02564103 -0.06410256 -0.06410256 NA > summary(a) Shapley value : 1 2 3 4 0.1346154 0.2115385 0.2884615 0.3653846 Shapley interaction indices : 1 2 3 4 1 NA -0.02564103 -0.02564103 -0.02564103 2 -0.02564103 NA -0.06410256 -0.06410256 3 -0.02564103 -0.06410256 NA -0.06410256 4 -0.02564103 -0.06410256 -0.06410256 NA > > > > cleanEx(); ..nameEx <- "superclass.capacity-class" > > ### * superclass.capacity-class > > flush(stderr()); flush(stdout()) > > ### Name: superclass.capacity-class > ### Title: Class "superclass.capacity" > ### Aliases: superclass.capacity-class > ### Keywords: classes > > ### ** Examples > > ## three capacities > mu1 <- uniform.capacity(5) > mu2 <- capacity(c(0,0,0:13)) > a <- Mobius(mu2) > > ## compute indices to summarize them > summary(mu1) Shapley value : All 0.2 Shapley interaction indices : All All -1.387779e-17 Orness : 0.5 Veto indices : All 0.5 Favor indices : All 0.5 Normalized variance : 0 Normalized entropy : 1 > summary(mu2) Shapley value : 1 2 3 4 1.75 2.75 3.75 4.75 Shapley interaction indices : 1 2 3 4 1 NA 0.3333333 0.3333333 0.3333333 2 0.3333333 NA 0.8333333 0.8333333 3 0.3333333 0.8333333 NA 0.8333333 4 0.3333333 0.8333333 0.8333333 NA Orness : 0.4294872 Veto indices : 1 2 3 4 0.4871795 0.5470085 0.5982906 0.6495726 Favor indices : 1 2 3 4 0.3589744 0.4017094 0.4529915 0.5042735 Normalized variance : 0.1439842 Normalized entropy : 0.8073944 > summary(a) Shapley value : 1 2 3 4 1.75 2.75 3.75 4.75 Shapley interaction indices : 1 2 3 4 1 NA 0.3333333 0.3333333 0.3333333 2 0.3333333 NA 0.8333333 0.8333333 3 0.3333333 0.8333333 NA 0.8333333 4 0.3333333 0.8333333 0.8333333 NA Orness : 0.4294872 Veto indices : 1 2 3 4 0.4871795 0.5470085 0.5982906 0.6495726 Favor indices : 1 2 3 4 0.3589744 0.4017094 0.4529915 0.5042735 Normalized variance : 0.1439842 Normalized entropy : 0.8073944 > > > > cleanEx(); ..nameEx <- "superclass.set.func-class" > > ### * superclass.set.func-class > > flush(stderr()); flush(stdout()) > > ### Name: superclass.set.func-class > ### Title: Class "superclass.set.func" > ### Aliases: superclass.set.func-class > ### Keywords: classes > > ### ** Examples > > ## three set functions > mu1 <- card.set.func(-2:4) > mu2 <- set.func(c(-2,-2,-2:11/11)) > mu3 <- Mobius.set.func(c(-7:6,6,6),4,4) > > ## print mu1 > show(mu1) card.set.func 0 -2 1 -1 2 0 3 1 4 2 5 3 6 4 > ## the same > mu1 card.set.func 0 -2 1 -1 2 0 3 1 4 2 5 3 6 4 > ## the others > mu2 set.func {} -2.000000 {1} -2.000000 {2} -0.181818 {3} -0.090909 {4} 0.000000 {1,2} 0.090909 {1,3} 0.181818 {1,4} 0.272727 {2,3} 0.363636 {2,4} 0.454545 {3,4} 0.545455 {1,2,3} 0.636364 {1,2,4} 0.727273 {1,3,4} 0.818182 {2,3,4} 0.909091 {1,2,3,4} 1.000000 > mu3 Mobius.set.func {} -7.000000 {1} -6.000000 {2} -5.000000 {3} -4.000000 {4} -3.000000 {1,2} -2.000000 {1,3} -1.000000 {1,4} 0.000000 {2,3} 1.000000 {2,4} 2.000000 {3,4} 3.000000 {1,2,3} 4.000000 {1,2,4} 5.000000 {1,3,4} 6.000000 {2,3,4} 6.000000 {1,2,3,4} 6.000000 > > ## round mu2 > round(mu2,2) set.func {} -2.000000 {1} -2.000000 {2} -0.180000 {3} -0.090000 {4} 0.000000 {1,2} 0.090000 {1,3} 0.180000 {1,4} 0.270000 {2,3} 0.360000 {2,4} 0.450000 {3,4} 0.550000 {1,2,3} 0.640000 {1,2,4} 0.730000 {1,3,4} 0.820000 {2,3,4} 0.910000 {1,2,3,4} 1.000000 > > ## compute indices to summarize them > summary(mu1) Shapley value : All 1 Shapley interaction indices : All All 0 > summary(mu2) Shapley value : 1 2 3 4 0.1590909 0.8560606 0.9469697 1.0378788 Shapley interaction indices : 1 2 3 4 1 NA 0.03030303 0.03030303 0.03030303 2 0.03030303 NA -0.83333333 -0.83333333 3 0.03030303 -0.83333333 NA -0.83333333 4 0.03030303 -0.83333333 -0.83333333 NA > summary(mu3) Shapley value : 1 2 3 4 -1.000000 2.000000 4.333333 6.666667 Shapley interaction indices : 1 2 3 4 1 NA 4.5 6 7.5 2 4.5 NA 8 9.5 3 6.0 8.0 NA 11.0 4 7.5 9.5 11 NA > > > > cleanEx(); ..nameEx <- "to.data.frame-methods" > > ### * to.data.frame-methods > > flush(stderr()); flush(stdout()) > > ### Name: to.data.frame-methods > ### Title: Puts a set function under the form of a data.frame > ### Aliases: to.data.frame to.data.frame-methods > ### to.data.frame,Mobius.card.set.func-method > ### to.data.frame,Mobius.set.func-method > ### to.data.frame,card.set.func-method to.data.frame,set.func-method > ### Keywords: methods > > ### ** Examples > > ## the Möbius representation of set function > a <- Mobius.set.func(-1:-16,4,4) > > ## to data.frame > d <- to.data.frame(a) > write.table(d,"my.set.func.csv",sep="\t") > > > > cleanEx(); ..nameEx <- "variance-methods" > > ### * variance-methods > > flush(stderr()); flush(stdout()) > > ### Name: variance-methods > ### Title: Normalized variance of a capacity > ### Aliases: variance variance-methods variance,Mobius.capacity-method > ### variance,capacity-method variance,card.capacity-method > ### Keywords: methods > > ### ** Examples > > ## a capacity > mu <- capacity(c(0,0,0,0:12)/12) > > ## its Möbius transform > a <- Mobius(mu) > > ## their normalized variance > variance(mu) [1] 0.1790123 > variance(a) [1] 0.1790123 > > ## similar examples with card.capacity objects > mu <- lower.capacity(4) > variance(mu) [1] 1 > mu <- uniform.capacity(4) > variance(mu) [1] 0 > > > > cleanEx(); ..nameEx <- "veto-methods" > > ### * veto-methods > > flush(stderr()); flush(stdout()) > > ### Name: veto-methods > ### Title: Veto indices > ### Aliases: veto veto-methods veto,Mobius.capacity-method > ### veto,capacity-method veto,card.capacity-method > ### Keywords: methods > > ### ** Examples > > ## a capacity > mu <- capacity(c(0:13,13,13)/13) > > ## its Möbius transform > a <- Mobius(mu) > > ## their veto indices > veto(mu) 1 2 3 4 0.3589744 0.4017094 0.4529915 0.5042735 > veto(a) 1 2 3 4 0.3589744 0.4017094 0.4529915 0.5042735 > > ## the same with a card.capacity object > mu <- lower.capacity(4) > veto(mu) All 1 > > > > cleanEx(); ..nameEx <- "zeta-methods" > > ### * zeta-methods > > flush(stderr()); flush(stdout()) > > ### Name: zeta-methods > ### Title: The zeta transform > ### Aliases: zeta zeta-methods zeta,Mobius.capacity-method > ### zeta,Mobius.card.set.func-method zeta,Mobius.game-method > ### zeta,Mobius.set.func-method > ### Keywords: methods > > ### ** Examples > > ## the Möbius transform of a capacity > a <- Mobius.capacity(c(rep(0,15),1),4,4) > a Mobius.capacity {} 0.000000 {1} 0.000000 {2} 0.000000 {3} 0.000000 {4} 0.000000 {1,2} 0.000000 {1,3} 0.000000 {1,4} 0.000000 {2,3} 0.000000 {2,4} 0.000000 {3,4} 0.000000 {1,2,3} 0.000000 {1,2,4} 0.000000 {1,3,4} 0.000000 {2,3,4} 0.000000 {1,2,3,4} 1.000000 > > ## its zeta transform > zeta(a) capacity {} 0.000000 {1} 0.000000 {2} 0.000000 {3} 0.000000 {4} 0.000000 {1,2} 0.000000 {1,3} 0.000000 {1,4} 0.000000 {2,3} 0.000000 {2,4} 0.000000 {3,4} 0.000000 {1,2,3} 0.000000 {1,2,4} 0.000000 {1,3,4} 0.000000 {2,3,4} 0.000000 {1,2,3,4} 1.000000 > > ## let us check > Mobius(zeta(a)) Mobius.capacity {} 0.000000 {1} 0.000000 {2} 0.000000 {3} 0.000000 {4} 0.000000 {1,2} 0.000000 {1,3} 0.000000 {1,4} 0.000000 {2,3} 0.000000 {2,4} 0.000000 {3,4} 0.000000 {1,2,3} 0.000000 {1,2,4} 0.000000 {1,3,4} 0.000000 {2,3,4} 0.000000 {1,2,3,4} 1.000000 > > ## a similar example with a Mobius.card.set.func object > mu <- card.set.func(-3:4) > a <- Mobius(mu) > zeta(a) card.set.func 0 -3 1 -2 2 -1 3 0 4 1 5 2 6 3 7 4 > > > > ### *