Title: | Estimating Consistent Tests for Stochastic Dominance |
---|---|
Description: | Stochastic dominance tests help ranking different distributions. The package implements the consistent test for stochastic dominance by Barrett and Donald (2003) <doi:10.1111/1468-0262.00390>. Specifically, it implements Barrett and Donald's Kolmogorov-Smirnov type tests for first- and second-order stochastic dominance based on bootstrapping 2 and 1. |
Authors: | Sergei Schaub [aut, cre] , Agroscope [cph] |
Maintainer: | Sergei Schaub <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.0.1 |
Built: | 2024-11-29 08:47:02 UTC |
Source: | CRAN |
This function computes the values of the cumulative difference of two empirical cumulative distribution function and plots the values.
dif_ecdf_plot(data_1, data_2, bins_size)
dif_ecdf_plot(data_1, data_2, bins_size)
data_1 |
data 1. |
data_2 |
data 2. |
bins_size |
bin size. |
This function computes the values of the cumulative difference of two empirical cumulative distribution function and plots the values. This relates two showing second-order stochastic dominance.
The function returns a plot as a ggplot2 object.
# load stodom require(stodom) data_a <- rnorm(500, 3, 2) data_b <- rnorm(500, 1, 2) # plot cumulative difference between two ecdfs dif_ecdf_plot(data_1 = data_a, data_2 = data_b, bins_size = 0.1)
# load stodom require(stodom) data_a <- rnorm(500, 3, 2) data_b <- rnorm(500, 1, 2) # plot cumulative difference between two ecdfs dif_ecdf_plot(data_1 = data_a, data_2 = data_b, bins_size = 0.1)
This function computes the values of two empirical cumulative distribution function as well as their cumulative differences.
ecdf_dat_g(data_1, data_2, bins_size)
ecdf_dat_g(data_1, data_2, bins_size)
data_1 |
data 1. |
data_2 |
data 2. |
bins_size |
bin size. |
This function computes the values of two empirical cumulative distribution function as well as their cumulative differences.
The function returns a data table.
# load stodom require(stodom) data_a <- rnorm(500, 3, 2) data_b <- rnorm(500, 1, 2) # compute the values of two ecdfs and their cumulative differences. ecdf_dat_g(data_1 = data_a, data_2 = data_b, bins_size = 1)
# load stodom require(stodom) data_a <- rnorm(500, 3, 2) data_b <- rnorm(500, 1, 2) # compute the values of two ecdfs and their cumulative differences. ecdf_dat_g(data_1 = data_a, data_2 = data_b, bins_size = 1)
This function computes the values of two empirical cumulative distribution function and plots the values.
ecdf_plot(data_1, data_2, bins_size)
ecdf_plot(data_1, data_2, bins_size)
data_1 |
data 1. |
data_2 |
data 2. |
bins_size |
bin size. |
This function computes the values of two empirical cumulative distribution function and plots the values.
The function returns a plot as a ggplot2 object.
# load stodom require(stodom) data_a <- rnorm(500, 3, 2) data_b <- rnorm(500, 1, 2) # plot ecdfs ecdf_plot(data_1 = data_a, data_2 = data_b, bins_size = 0.1)
# load stodom require(stodom) data_a <- rnorm(500, 3, 2) data_b <- rnorm(500, 1, 2) # plot ecdfs ecdf_plot(data_1 = data_a, data_2 = data_b, bins_size = 0.1)
This function tests for first-order stochastic dominance.
fo_stodom(data_1, data_2, bins_size, n_draws, useed, variable_1, variable_2, type)
fo_stodom(data_1, data_2, bins_size, n_draws, useed, variable_1, variable_2, type)
data_1 |
data 1. |
data_2 |
data 2. |
bins_size |
bin size. |
n_draws |
number of draws to compute p values (default = 500). |
useed |
user defined seed |
variable_1 |
name of a (as a string); only for the output table (default = "a"). |
variable_2 |
name of b (as a string); only for the output table (default = "b"). |
type |
type of bootstrapped test, bootstrapping 1 and 2 of Barrett and Donald (2003) are available (default = "boot2"). |
This function computes the consistent test of first-order stochastic dominance following Barrett and Donald (2003). In detail, this function estimate their Kolmogorov-Smirnov type tests based on bootstrapping 2. The function was implemented as part of Schaub xxx
The function returns a list object containing the p-values of two dominance tests (i.e., variable 1 vs. variable 1 and variable 2 vs. variable 1).
Barrett, G. F., & Donald, S. G. (2003). Consistent tests for stochastic dominance. Econometrica, 71(1), 71-104.
Schaub, S. & El Benni, N. (2024). How do price (risk) changes influence farmers’ preference to reduce fertilizer application?
# load stodom require(stodom) data_a <- rnorm(500, 3, 2) data_b <- rnorm(500, 1, 2) # estimate first-order stochastic dominance fo_stodom(data_1 = data_a, data_2 = data_b, n_draws = 100, useed = 1, bins_size = 1)
# load stodom require(stodom) data_a <- rnorm(500, 3, 2) data_b <- rnorm(500, 1, 2) # estimate first-order stochastic dominance fo_stodom(data_1 = data_a, data_2 = data_b, n_draws = 100, useed = 1, bins_size = 1)
This function tests for second-order stochastic dominance.
so_stodom(data_1, data_2, bins_size, n_draws, useed, variable_1, variable_2, type)
so_stodom(data_1, data_2, bins_size, n_draws, useed, variable_1, variable_2, type)
data_1 |
data 1. |
data_2 |
data 2. |
bins_size |
bin size. |
n_draws |
number of draws to compute p values (default = 500). |
useed |
user defined seed |
variable_1 |
name of a (as a string); only for the output table (default = "a"). |
variable_2 |
name of b (as a string); only for the output table (default = "b"). |
type |
type of bootstrapped test, bootstrapping 1 and 2 of Barrett and Donald (2003) are available (default = "boot2"). |
This function computes the consistent test of second-order stochastic dominance following Barrett and Donald (2003). In detail, this function estimate their Kolmogorov-Smirnov type tests based on bootstrapping 2. The function was implemented as part of Schaub xxx
The function returns a list object containing the p-values of two dominance tests (i.e., variable 1 vs. variable 1 and variable 2 vs. variable 1).
Barrett, G. F., & Donald, S. G. (2003). Consistent tests for stochastic dominance. Econometrica, 71(1), 71-104.
Schaub, S. & El Benni, N. (2024). How do price (risk) changes influence farmers’ preference to reduce fertilizer application?
# load stodom require(stodom) data_a <- rnorm(500, 3, 2) data_b <- rnorm(500, 1, 2) # estimate second-order stochastic dominance so_stodom(data_1 = data_a, data_2 = data_b, n_draws = 100, useed = 1, bins_size = 1)
# load stodom require(stodom) data_a <- rnorm(500, 3, 2) data_b <- rnorm(500, 1, 2) # estimate second-order stochastic dominance so_stodom(data_1 = data_a, data_2 = data_b, n_draws = 100, useed = 1, bins_size = 1)