abcCLES: Approximate Bayesian algorithm for the Common Language Effect...

View source: R/abcCLES.R

abcCLESR Documentation

Approximate Bayesian algorithm for the Common Language Effect Size (CLES) estimator

Description

Computes the posterior CLES without a likelihood function via an ABC-rejection algorithm. CLES (McGraw and Wong, 1992) also called Exceedance probability (Huang, 2021), Probability of Superiority or Area Undere the Curve (AUC; Ruscio, 2008; Ruscio and Mullen, 2010) is a metric that calculates the proportion of samples from group y that exceeds a random sample of group x. While often Confidence intervals are calculated, this is not inference based on the posterior probability, but on the likelihood, thus the data. This function is a simple ABC-rejection algorithmn to calculate posterior mean and sd of x and y an infer CLES.

Usage

abcCLES(
  x,
  y,
  prior = NULL,
  qtol = 0.005,
  adjustment = "LM",
  print.progress = T,
  timing = T,
  seed = 666
)

Arguments

x

A numeric vector for sample x.

y

A numeric vector for sample y.

prior

A list with two priors for location an scale parameters.

qtol

The value for the quantile tolerance. A lower value selects simulated parameters that fall closer to the observed parameters. Default is 0.01 and indicates that the closest 1 percent is accepted and the rest rejected.

adjustment

The adjustment method to act if the simulated values actually originated closer from the prior. The current method is the Linear Method (LM), but will also be accompanied by a non-linear RF model.

print.progress

Prints the progress of the number of simulations (nsim) completed. By default is TRUE

timing

Prints the time that was needed to complete the simulations. By default is TRUE.

seed

Default is the Devil. Devils seed.

Value

Values for CLES derived from the posterior means of samples x and y.

Examples

## Not run: 
#Create random example for CLES P(y > x)
set.seed(666)
x   <- rnorm(20, 23, 2)
y   <- rnorm(20, 32, 2)
sdx <- mean(x)
sdy <- mean(y)
nsim<- 250000

#Create priors
set.seed(666)
priors <- list(prior1  = rlnorm(nsim, 3.2, 0.15),
              prior2  = rgamma(nsim, sdx),
              prior3  = rlnorm(nsim, 3.4, 0.15),
              prior4  = rgamma(nsim, sdy))

#Control the priors by eye-balling
par(mfrow=c(2,2))
hist(priors[[1]], xlab = "", main="Prior1")
hist(priors[[2]], xlab = "", main="Prior2")
hist(priors[[3]], xlab = "", main="Prior3")
hist(priors[[4]], xlab = "", main="Prior4")
dev.off()

res <- abcCLES(x, y, prior = priors)

hist(res, breaks=20, main="CLES (Posterior)", xlab="")
## End(Not run)

snwikaij/NEMO documentation built on March 18, 2022, 12:03 a.m.