A shared service organization, SSO, performs transactions for various
clients.
Each transaction can potential be wrong, or partially wrong.
To get an estimate of the error rate of all the transactions we can take a
random sample of the transactions from the SSO.
This random sample is defined by the number of transactions, n_SSO
, in the
sample, and the sum of partial and full errors found, k_SSO
.
Given the number of transactions for a specific client, N_client
,
we can then estimate the error rate for that specific client.
This function makes such an estimation, based on the assumption that we can
consider the transactions of the client to be a random sample of all the
transactions performed by the SSO.
The function returns the probability graph of the error fraction in the
client transactions, and the probability graph of the error fraction in
the SSO transactions.
Usage
SSO_estimate(
fun_prior_SSO = unity,
k_SSO = 0,
n_SSO = 350,
fun_prior_client = unity,
N_client = 1000,
S = 2000,
MC = 50000
)
Arguments
- fun_prior_SSO
The a priori chance function of the error fraction in the SSO transactions. fun_prior_SSO should be a one argument function of [0, 1] to [0, infinity). The function should be defined for the arguments
(1-0.5)/S
,(2-0.5)/S
, ...(S-0.5)/S
. In other words, the function should be defined for the members of the vectorpartition_0_1(S)
. Default isunity()
, a function that returns 1 for all values in [0, 1], so a flat prior.- k_SSO
The sum of partial and full errors found in the sample from the SSO.
k_SSO
is a non negative real number.k_SSO <= n_SSO
.- n_SSO
The number of transactions in the sample from the SSO.
n_SSO
is a positive integer. Note that we follow the convention to use a lower case n for the number of transactions in the sample (in this case from the SSO transactions).- fun_prior_client
The a priori chance function of the error fraction in the client transactions.
fun_prior_client
should be a one argument function of [0, 1] to [0, infinity). The function should be defined for the arguments(1-0.5)/S
,(2-0.5)/S
, ...(S-0.5)/S
. In other words, the function should be defined for the members of the vectorpartition_0_1(S)
. Default isunity()
, a function that returns 1 for all values in [0, 1], so a flat prior.- N_client
The total number of transaction done by the SSO for the client.
N_client
is a positive integer. Note that we follow the convention to use an upper case N for the number of transactions in the mass of all transactions (in this case of the client).- S
The number of segments, represented by their midpoints, in which is divided each of the dimensions of the two dimensional grid used for computing the probability graphs of the error fraction of the transactions in the client, and the errors in the transactions of the SSO So
S
is the granularity of the grid.S
is a positive integer. Default 2000, implying 2000*2000 = 4 million grid points.- MC
For Monte Carlo. The number of data points used to construct the graph for the client from.
Value
A list of named elements. This list can be used as input
to SSO_graph_plot()
, which transforms it into
a form that is more easily interpreted by humans. The list consists of:
prior_SSO
, a numeric representation of the prior probability graph of the error fraction in the SSO transactionsposterior_SSO
, a numeric representation of the posterior probability graph of the error fraction in the SSO transactionsprior_client
, a numeric representation of the prior probability graph of the error fraction in the client transactionsposterior_client
, a numeric representation of the posterior probability graph of the error fraction in the client transactionsthe input parameters
Details
For the estimation, the function uses a two dimensional grid of
postulated values for the error fractions of client and SSO.
Both dimensions of the grid have the same granularity: S
;
this makes it easier to compare the two resulting probability curves.
Note that this function only works for the error fraction of the total number of transactions and not for the error fraction of the total monetary amount. For more info see README.
Examples
# Flat priors for SSO and client.
# More complex situation with non flat priors.
# Prior for the whole of SSO transactions e.g. based on what we found
# last year.
fun_prior_SSO <- function(p) {dbinom(1, 300, p)}
# Prior for client e.g. result of preliminary investigations of client transactions.
fun_prior_client <- function(p) {dbinom(0, 20, p)}
x2 <- SSO_estimate(fun_prior_SSO = fun_prior_SSO,
k_SSO = 1,
n_SSO = 400,
fun_prior_client = fun_prior_client,
N_client = 500,
S = 500)