| Title: | Compares Random Distributions using Stochastic Dominance |
|---|---|
| Description: | The Stochastic Dominance (SD) is the classical way of comparing two random prospects, using their distribution functions. Almost Stochastic Dominance (ASD) has also been developed to cover the SD failures due to the extreme utility functions. This package focuses on classical and heuristic methods for testing the first and second SD and ASD methods given the probability mass function (PMF) of the random prospects. The goal is to apply these methods easily, efficiently, and effectively on real-world datasets. For more details see Hanoch and Levy (1969) <doi:10.2307/2296431>, Leshno and Levy (2002) <doi:10.1287/mnsc.48.8.1074.169>, and Tzeng et al. (2012) <doi:10.1287/mnsc.1120.1616>. |
| Authors: | Shayan Tohidi [aut, cre] (ORCID: <https://orcid.org/0000-0002-6386-889X>), Sigurdur Olafsson [aut] (ORCID: <https://orcid.org/0000-0002-0088-6898>) |
| Maintainer: | Shayan Tohidi <[email protected]> |
| License: | GPL (>= 3) |
| Version: | 0.3.0 |
| Built: | 2026-06-04 09:34:49 UTC |
| Source: | https://github.com/shayantohidi/rsd |
It compares two prospects using AFSD criteria, that is the prospect having the minimum violation area from a classic FSD.
afsd.test(sd.obj)afsd.test(sd.obj)
sd.obj |
StochasticDominance object. |
The returned list has six elements: 'winner' indicates the dominant prospect index. It will be zero if neither dominates the other. 'epsilon' is the ratio of violated area to the total area between the CDFs. 'area' is a vector, where the values show the area between the CDFs correspond to each segment. 'total.area' is the total area between the CDFs. 'positive.area' is the amount of area where the 'area' vector is positive, meaning the 'cdf1' is larger than 'cdf2'. 'negative.area' is like 'positive.area' for negative values.
If neither distribution dominates the other by AFSD, the 'winner' output will be zero, and it happens only when the expected value of distributions are equal.
The 'epsilon' and 'winner' output parameters are the ones that should be taken most. The others are the calculation details and are provided for further investigation. A lower the 'epsilon', lower the violation ratio of the dominant distribution, lower the eliminated extreme utilities, higher the number of decision-makers who agree on the dominant distribution.
A list, including all the calculation details.
[area.btwn.cdfs.calc()] for area calculations.
sd = createStochasticDominance(outcome1 = c(1,4,7), outcome2 = c(2,3,5), prob1 = c(1/3,1/3,1/3), prob2 = c(1/6,1/6,2/3)) afsd.test(sd)sd = createStochasticDominance(outcome1 = c(1,4,7), outcome2 = c(2,3,5), prob1 = c(1/3,1/3,1/3), prob2 = c(1/6,1/6,2/3)) afsd.test(sd)
For every segment, the area below SSD function will be computed.
area.below.ssd.calc(outcome, ssd)area.below.ssd.calc(outcome, ssd)
outcome |
Numeric vector, including outcome values. |
ssd |
Numeric vector, including SSD values. |
Numeric vector, including area below every segment of SSD function.
[calc.area.below.line()] for area below line.
It calculates the area between the CDFs of two prospects divided by the CDFs and outcomes segments.
area.btwn.cdfs.calc(sd.obj)area.btwn.cdfs.calc(sd.obj)
sd.obj |
StochasticDominance object. |
A numeric vector, including the area between the segments of CDFs.
For every segments, the area between SSD functions will be computed.
area.btwn.ssd.calc(sd.obj)area.btwn.ssd.calc(sd.obj)
sd.obj |
StochasticDominance object. |
Numeric vector, including area differences in every segments.
[modif.outcome.ssd.calc(), area.below.ssd.calc()] for more details.
It uses the test result, corresponding epsilon, and the epsilon threshold to create the inefficient set.
asd.screen(data, test, epsilon.threshold)asd.screen(data, test, epsilon.threshold)
data |
A data frame, including variable pairs, distributions, and results of the tests. |
test |
A string that indicates the name of the test. |
epsilon.threshold |
A number that indicates the threshold for considering the result to be valid or not. |
The inefficient set includes all variable names that are dominated by at least one other variable. The domination defines as the test result where the corresponding epsilon is smaller than or equal to epsilon threshold ('epsilon'). If the epsilon is smaller than the threshold, it is assumed that by some relaxation the domination exists because a very small ratio of the decision-makers do not agree with this result.
A character vector as the inefficient set of variables based on the 'test' result and 'epsilon.threshold'.
It uses the positive and negative areas that are computed by ASSD-LL and the expected values of the prospects to compare them based on the ASSD-LL rule. If the violation area ratio is less than 0.5 for a prospect, and its expected value is larger, it dominates the other by ASSD-LL.
assd.ll.test(sd.obj)assd.ll.test(sd.obj)
sd.obj |
StochasticDominance object. |
epsilon shows the ratio of the violation. Smaller epsilon means more decision-makers agree with the result.
The returned list has six elements: 'winner' indicates the dominant prospect index. It will be zero if neither dominates the other. 'epsilon' is the ratio of violated area to the total area between the CDFs. 'area' is a vector, where the values show the area between the CDFs correspond to each segment. 'total.area' is the total area between the CDFs. 'positive.area' is the amount of area where the 'area' vector is positive, meaning the 'cdf1' is larger than 'cdf2' and 'ssd1' is larger than 'ssd2'. 'negative.area' is like 'positive.area' for negative values.
If neither distribution dominates the other by ASSD-LL, the 'winner' output will be zero, and it happens only when the distribution with a higher expected value has the 'epsilon' which is larger than 0.5.
A list, including all the calculation details.
[expected.values(), pos.neg.area.assd.ll(), afsd.test()] for more details.
It compares two prospects using ASSD criteria, that is the prospect having the minimum violation area from a classic SSD.
assd.test(sd.obj, type)assd.test(sd.obj, type)
sd.obj |
StochasticDominance object. |
type |
A character vector, including the name of ASSD methods. |
The ‘type' argument must be one of the ’ll' or 'ths', otherwise it will raise an error.
The 'epsilon' and 'winner' output parameters are the ones that should be taken most. The others are the calculation details and are provided for further investigation. A lower the 'epsilon', lower the violation ratio of the dominant distribution, lower the eliminated extreme utilities, higher the number of decision-makers who agree on the dominant distribution.
A list, including calculation details.
[assd.ll.test(), assd.ths.test] for more details.
sd = createStochasticDominance(outcome1 = c(1,4,7), outcome2 = c(2,3,5), prob1 = c(1/3,1/3,1/3), prob2 = c(1/6,1/6,2/3)) assd.test(sd, 'll') assd.test(sd, 'ths')sd = createStochasticDominance(outcome1 = c(1,4,7), outcome2 = c(2,3,5), prob1 = c(1/3,1/3,1/3), prob2 = c(1/6,1/6,2/3)) assd.test(sd, 'll') assd.test(sd, 'ths')
It uses the areas between the SSD functions, and the expected values of the prospects to compare them based on the ASSD-THS rule. If the violation area ratio is less than 0.5 for a prospect, and its expected value is larger, it dominates the other by ASSD-THS.
assd.ths.test(sd.obj)assd.ths.test(sd.obj)
sd.obj |
StochasticDominance object. |
epsilon shows the ratio of the violation. Smaller epsilon means more decision-makers agree with the result.
The returned list has six elements: 'winner' indicates the dominant prospect index. It will be zero if neither dominates the other. 'epsilon' is the ratio of violated area to the total area between the SSDs. 'area' is a vector, where the values show the area between the SSDs correspond to each segment. 'total.area' is the total area between the SSDs. 'positive.area' is the amount of area where the 'area' vector is positive, meaning the 'ssd1' is larger than 'ssds2'. 'negative.area' is like 'positive.area' for negative values.
If neither distribution dominates the other by ASSD-THS, the 'winner' output will be zero, and it happens only when the distribution with a higher expected value has the 'epsilon' which is larger than 0.5.
A list, including all the calculation details.
[expected.values(), area.btwn.ssd.calc()] for more details.
It takes four parameters as the coordinates of two points at the beginning and end of a straight line, and calculates the area exactly below the line (between the line and the x-axis).
calc.area.below.line(x1, x2, y1, y2)calc.area.below.line(x1, x2, y1, y2)
x1, x2
|
Float values, indicating the first coordinates of start and end points, respectively. |
y1, y2
|
Float values, indicating the second coordinates of start and end points, respectively. |
A float.
Given the start and end coordinates of two straight lines, we calculate the intersection point of them.
calc.intersection(x1, x2, y11, y12, y21, y22)calc.intersection(x1, x2, y11, y12, y21, y22)
x1, x2
|
Float values. |
y11, y12
|
Float values, corresponding to the first line. |
y21, y22
|
Float values, corresponding to the second line. |
Having intersection point has been checked before.
A list, including the coordinates of the intersection point.
[has.intersect()]
It creates a data frame of unique unordered pairs of variables, collects corresponding distributions, tests all SD and ASD rules on every pairs, and finds the efficient and inefficient sets for all those rules.
compare.all( variable, probability, outcome, afsd.epsilon.threshold = 0.1, assd.ll.epsilon.threshold = 0.1, assd.ths.epsilon.threshold = 0.1, include.details = TRUE )compare.all( variable, probability, outcome, afsd.epsilon.threshold = 0.1, assd.ll.epsilon.threshold = 0.1, assd.ths.epsilon.threshold = 0.1, include.details = TRUE )
variable |
A character vector containing the name of all variables. |
probability |
A numeric vector containing the probability for each variable to achieve a particular outcome. |
outcome |
A numeric vector containing the outcome values. |
afsd.epsilon.threshold |
A number that shows the upper limit for epsilon of afsd rule. If the epsilon is smaller than or equal to this value, the result is accepted. The default value is '0.1'. |
assd.ll.epsilon.threshold |
A number that shows the upper limit for epsilon of assd.ll rule. If the epsilon is smaller than or equal to this value, the result is accepted. The default value is '0.1'. |
assd.ths.epsilon.threshold |
A number that shows the upper limit for epsilon of assd.ths rule. If the epsilon is smaller than or equal to this value, the result is accepted. The default value is '0.1'. |
include.details |
A logical that affects the output data to contain distributions. The default value is 'TRUE'. |
If the type of each input parameter is incorrect, it will raise an error.
The output is a list that contains 6 elements: 'data' is a data frame including all unique unordered pairs of variables, corresponding distributions, result of each rule, and epsilon of ASD rule. The rest 5 elements are lists as well, corresponding to each rule that includes the efficient and inefficient sets.
The 'data' is a nested data frame, and stores the distribution of each variable in a single cell. The distribution contains two columns: probability and outcome.
A list of 6 elements, including a data frame and the efficient and inefficient sets of all rules.
[compare.paired.distributions(), screen.by.sd(), screen.by.asd()]
result = compare.all(data_ex$gen, rep(1/29,377), data_ex$yield)result = compare.all(data_ex$gen, rep(1/29,377), data_ex$yield)
It creates a data frame including all unordered pairs of the variables, where the first variable has higher or equal mean outcome. Then, all available SD and ASD rules are tested on them.
compare.paired.distributions( variable, probability, outcome, include.details = TRUE )compare.paired.distributions( variable, probability, outcome, include.details = TRUE )
variable |
A character vector containing the name of all variables. |
probability |
A numeric vector containing the probability for each variable to achieve a particular outcome. |
outcome |
A numeric vector containing the outcome values. |
include.details |
A logical that affects the output data to contain distributions. The default value is 'TRUE'. |
If the type of each input parameter is incorrect, it will raise an error.
The length of the input parameters 'variable', 'probability', and 'outcome' must be equal, otherwise it will raise an error.
A data frame, including all distribution pairs and the results of the tests.
[create.paired.distributions(), sd.asd.test.all()]
result = compare.paired.distributions(data_ex$gen, rep(1/29,377), data_ex$yield)result = compare.paired.distributions(data_ex$gen, rep(1/29,377), data_ex$yield)
This function compares two numeric vectors. The vector whose all elements smaller or equal to all elements of the other one where at least one element is smaller, will be the winner.
comparison(x, y)comparison(x, y)
x, y
|
Numeric vectors. |
The function returns the index of the winner, meaning 1 or 2, corresponding to parameters 'x' and 'y', respectively. If no vector meets the condition, 0 will be returned.
An integer, among 0, 1, 2.
create a data frame from input parameters
create.dataframe(variable, probability, outcome)create.dataframe(variable, probability, outcome)
variable |
A character vector. |
probability |
A numeric vector. |
outcome |
A numeric vector. |
A data frame with three columns.
with the input parameters and four other functions, it will create a data frame that includes all pairs of variables and their corresponding probability and outcome values.
create.paired.distributions(variable, probability, outcome)create.paired.distributions(variable, probability, outcome)
variable |
A character vector. |
probability |
A numeric vector. |
outcome |
A numeric vector. |
Here, we first sort variables based on their outcome in ascending order, and then create unordered unique pairs. So, the first element (variable) of any pair has larger mean outcome than the second element.
The output has four columns. The first two represent the two elements of each pair. The last two are the corresponding probability and outcome for the elements, respectively. These are in nested format, meaning each cell of the last two columns includes a data frame with two columns: probability and outcome.
A data frame with four columns.
[create.dataframe(), sort.variables(), pair.variables(), pair.distributions()]
It is much easier to use this constructor to create an instance of the StochasticDominance class. It handles calculation of the cdf and ssd values in an efficient way.
createStochasticDominance(outcome1, outcome2, prob1, prob2)createStochasticDominance(outcome1, outcome2, prob1, prob2)
outcome1, outcome2
|
Numeric vectors. The outcomes corresponding to each prospect. |
prob1, prob2
|
Numeric vectors. The probabilities corresponding to each prospect. |
StochasticDominance object.
[StochasticDominance()]
createStochasticDominance(outcome1 = c(1,4,7), outcome2 = c(2,3,5), prob1 = c(1/3,1/3,1/3), prob2 = c(1/6,1/6,2/3))createStochasticDominance(outcome1 = c(1,4,7), outcome2 = c(2,3,5), prob1 = c(1/3,1/3,1/3), prob2 = c(1/6,1/6,2/3))
It is a real dataset in agriculture, which includes planted cultivars in multi-environment and the resulting yield.
data_exdata_ex
A data frame with 377 rows and 3 columns:
Character vector of genotype (cultivar) names
Character vector of environment names
Numeric vector of yield of planting each cultivar in each environment
The phenotypic data from G2F initiative in 2018: <https://doi.org/10.25739/anqq-sg86>
It calculates the expected value of both prospects given their distributions.
expected.values(sd.obj)expected.values(sd.obj)
sd.obj |
StochasticDominance object. |
A list, including two double elements as the expected value of each prospect.
It visualizes the CDFs of both prospects.
fsd.plot(sd.obj, names = c("1", "2"))fsd.plot(sd.obj, names = c("1", "2"))
sd.obj |
StochasticDominance object. |
names |
A character vector, including the names of prospects in order. |
The parameter 'names' only accepts character vector, otherwise an error will be raised.
The function shows the step plot, and returns its object for further modifications.
A list, including plot elements.
sd = createStochasticDominance(outcome1 = c(1,4,7), outcome2 = c(2,3,5), prob1 = c(1/3,1/3,1/3), prob2 = c(1/6,1/6,2/3)) fsd.plot(sd, names = c('First', 'Second'))sd = createStochasticDominance(outcome1 = c(1,4,7), outcome2 = c(2,3,5), prob1 = c(1/3,1/3,1/3), prob2 = c(1/6,1/6,2/3)) fsd.plot(sd, names = c('First', 'Second'))
It compares two random prospects by the first-order stochastic dominance (FSD).
fsd.test(sd.obj)fsd.test(sd.obj)
sd.obj |
StochasticDominance object. |
A prospect dominates when its CDF is below the other one. It means that all element of the CDF vector must be equal or smaller, and at least one element should be smaller for the dominant prospect.
If neither prospect dominates the other by FSD, it returns 0. It means that the CDFs intersect each other.
An integer, indicating the index of the dominant prospect.
sd = createStochasticDominance(outcome1 = c(1,4,7), outcome2 = c(2,3,5), prob1 = c(1/3,1/3,1/3), prob2 = c(1/6,1/6,2/3)) fsd.test(sd)sd = createStochasticDominance(outcome1 = c(1,4,7), outcome2 = c(2,3,5), prob1 = c(1/3,1/3,1/3), prob2 = c(1/6,1/6,2/3)) fsd.test(sd)
It determines if two lines have intersection point or not. The start and end points of both lines have equal first coordinate value (the one corresponds to the x-axis).
has.intersection(x1, x2, y11, y12, y21, y22)has.intersection(x1, x2, y11, y12, y21, y22)
x1, x2
|
Float values. |
y11, y12
|
Float values, corresponding to the first line. |
y21, y22
|
Float values, corresponding to the second line. |
A Boolean.
It modifies outcome vector to have all original plus intersection points in ascending order. The corresponding SSD vectors will also be returned.
modif.outcome.ssd.calc(sd.obj)modif.outcome.ssd.calc(sd.obj)
sd.obj |
StochasticDominance object. |
A list of three elements.
It uses paired variables and collects all the related information (probability and outcome) corresponding to each variable of every pairs.
pair.distributions(org.data, paired.vars)pair.distributions(org.data, paired.vars)
org.data |
A data frame that includes all variables, probabilities, and outcomes. |
paired.vars |
A data frame that includes all unique pairs of variables. |
A data frame that includes all unique pairs of variables with their corresponding distributions in the nested format.
It uses a vector of variables and creates unique unordered pairs.
pair.variables(variables)pair.variables(variables)
variables |
A character vector, including the variable names. |
These pairs are unique unordered pairs, meaning the order of variables does not matter. So if we have pair {x,y} we do not create another pair {y,x}, because they are technically the same. If the number of variables is n, the number of pairs is n(n-1)/2.
A data frame, that includes two columns; every row represents a pair of variables.
It calculates the positive and negative areas between CDFs. The positive is where both CDF and SSD of the first prospect is larger, and vice versa for the negative case.
pos.neg.area.assd.ll(sd.obj)pos.neg.area.assd.ll(sd.obj)
sd.obj |
StochasticDominance object. |
A list, including three elements corresponding to the positive and negative areas, respectively, and the area vector at the end.
[modif.outcome.ssd.calc()] for more details.
A wrapper for computing inefficient and efficient sets
screen(data, test, epsilon.threshold)screen(data, test, epsilon.threshold)
data |
A data frame, including variable pairs, distributions, and results of the tests. |
test |
A string that indicates the name of the test. |
epsilon.threshold |
A number that indicates the threshold for considering the result to be valid or not for ASD tests. |
A list of two elements, efficient and inefficient sets.
[sd.screen(), asd.screen()]
It checks all available ASD rules (i.e. afsd, assd.ll, and assd.ths) based on their results, and creates the corresponding efficient and inefficient sets.
screen.by.asd( data, afsd.epsilon.threshold = 0.1, assd.ll.epsilon.threshold = 0.1, assd.ths.epsilon.threshold = 0.1 )screen.by.asd( data, afsd.epsilon.threshold = 0.1, assd.ll.epsilon.threshold = 0.1, assd.ths.epsilon.threshold = 0.1 )
data |
A data frame, including the results of all ASD rules. |
afsd.epsilon.threshold |
A number that shows the upper limit for epsilon of afsd rule. If the epsilon is smaller than or equal to this value, the result is accepted. The default value is '0.1'. |
assd.ll.epsilon.threshold |
A number that shows the upper limit for epsilon of assd.ll rule. If the epsilon is smaller than or equal to this value, the result is accepted. The default value is '0.1'. |
assd.ths.epsilon.threshold |
A number that shows the upper limit for epsilon of assd.ths rule. If the epsilon is smaller than or equal to this value, the result is accepted. The default value is '0.1'. |
The input parameter 'data' must contain columns corresponding to ASD rules. These columns contain the index of the dominated variable, where 1 or 2 means the first or the second variable dominates, and 0 means the domination does not exist. Also, corresponding to each rule, we must have a column that includes the epsilon values for each rule. The best practice is to use the output of 'compare.paired.distributions'.
A list, including three elements corresponding to each ASD rule.
[screen()]
data = compare.paired.distributions(data_ex$gen, rep(1/29,377), data_ex$yield) asd.sets = screen.by.asd(data)data = compare.paired.distributions(data_ex$gen, rep(1/29,377), data_ex$yield) asd.sets = screen.by.asd(data)
It checks all available SD rules (i.e. fsd and ssd) based on their results, and creates the corresponding efficient and inefficient sets.
screen.by.sd(data)screen.by.sd(data)
data |
A data frame, including the results of all SD rules. |
The input parameter 'data' must contain columns corresponding to SD rules. These columns contain the index of the dominated variable, where 1 or 2 means the first or the second variable dominates, and 0 means the domination does not exist. The best practice is to use the output of 'compare.paired.distributions'.
A list, including two elements corresponding to each SD rule.
[screen()]
data = compare.paired.distributions(data_ex$gen, rep(1/29,377), data_ex$yield) sd.sets = screen.by.sd(data)data = compare.paired.distributions(data_ex$gen, rep(1/29,377), data_ex$yield) sd.sets = screen.by.sd(data)
Performing all SD and ASD methods on a pair
sd.asd.test(data1, data2)sd.asd.test(data1, data2)
data1, data2
|
Data frames corresponding to each element of a pair, respectively. |
The input parameters are two data frames corresponding to each element of a pair, respectively. Each data frame has two columns: probability and outcome, which represents the distribution of the element (variable).
First, a stochastic dominance object is created using the columns of the two input parameters. Then, all available SD and ASD tests that are implemented inside the package are performed.
The output list contains 8 elements: 'fsd', 'ssd', 'afsd', 'assd.ll', and 'assd.ths' indicate the index of the dominant element (variable). If the first variable dominates, they show 1, else they show 2. If neither dominates they return 0. The other output parameters that end with 'eps' (e.g. 'afsd.eps', 'assd.ll.eps', and 'assd.ths.eps') show the epsilon corresponding to each of those ASD tests.
A list of 8 elements indicating the result of each test and the epsilon values for almost tests.
[createStochasticDominance(), fsd.test(), ssd.test(), afsd.test(), assd.test()]
Performing SD and ASD tests on distribution pairs
sd.asd.test.all(paired.dists, include.details)sd.asd.test.all(paired.dists, include.details)
paired.dists |
A data frame that includes paired distributions. |
include.details |
A Boolean. |
'paired.dists' is a data frame including the distributions of all pairs. 'include.details' is a Boolean value. If it is TRUE, the distributions are included in the output, otherwise they will be discarded.
The output includes the SD and ASD test results, which are the index of the dominant variable and the epsilon of the ASD tests.
A data frame that includes the result of tests for each pair.
[sd.test()]
It uses the test result to create the inefficient set.
sd.screen(data, test)sd.screen(data, test)
data |
A data frame, including variable pairs, distributions, and results of the tests. |
test |
A string that indicates the name of the test. |
The inefficient set includes all variable names that are dominated by at least one other variable. The domination defines as the test result of the corresponding 'test' column.
A character vector as the inefficient set of variables based on the 'test' result.
Sorting all variables based on their outcomes
sorting.variables(variable, outcome)sorting.variables(variable, outcome)
variable |
A character vector, includes variable names. |
outcome |
A numeric vector, includes outcome values. |
A character vector, includes all variable names sorted by their outcomes.
Calculates the SSD values for a prospect.
ssd.calc(outcome, cdf)ssd.calc(outcome, cdf)
outcome |
Numeric vector, indicating the outcome values. |
cdf |
Numeric vector, indicating the cumulative probabilities. |
Numeric vector, indicating the SSD values.
It visualize the SSD values of both prospects.
ssd.plot(sd.obj, names = c("1", "2"))ssd.plot(sd.obj, names = c("1", "2"))
sd.obj |
StochasticDominance object. |
names |
A character vector, including the names of prospects in order. |
The parameter 'names' only accepts character vector, otherwise an error will be raised.
The function shows the line plot and returns its object for further modification.
A list, including plot elements.
sd = createStochasticDominance(outcome1 = c(1,4,7), outcome2 = c(2,3,5), prob1 = c(1/3,1/3,1/3), prob2 = c(1/6,1/6,2/3)) ssd.plot(sd, names = c('First', 'Second'))sd = createStochasticDominance(outcome1 = c(1,4,7), outcome2 = c(2,3,5), prob1 = c(1/3,1/3,1/3), prob2 = c(1/6,1/6,2/3)) ssd.plot(sd, names = c('First', 'Second'))
It compares two random prospects by the second-order stochastic dominance (SSD).
ssd.test(sd.obj)ssd.test(sd.obj)
sd.obj |
StochasticDominance object. |
A prospect dominates when its SSD is below the other one. It means that all element of the SSD vector must be equal or smaller, and at least one element should be smaller for the dominant prospect.
If neither prospect dominates the other by SSD, it returns 0. It means the SSDs intersect each other.
A number. Indicating dominant prospect index.
[ssd.calc()] for the calculation.
sd = createStochasticDominance(outcome1 = c(1,4,7), outcome2 = c(2,3,5), prob1 = c(1/3,1/3,1/3), prob2 = c(1/6,1/6,2/3)) ssd.test(sd)sd = createStochasticDominance(outcome1 = c(1,4,7), outcome2 = c(2,3,5), prob1 = c(1/3,1/3,1/3), prob2 = c(1/6,1/6,2/3)) ssd.test(sd)
Represents two distributions (prospects) that are going to be compared using Stochastic Dominance (SD).
It contains the input validation needed for comparing two prospects. For example, having sorted 'outcome', each of 'prob1' and 'prob2' adds up to one, arguments having the same lengths, and having matched probability, cumulative, and ssd arguments.
outcomeNumeric vector. The combined outcome values in ascending order.
prob1,prob2Numeric vectors. Probabilities corresponding to the prospects.
cdf1,cdf2Numeric vectors. Cumulative values corresponding to the prospects.
ssd1,ssd2Numeric vectors. SSD values corresponding to the prospects.