Learn R Programming

OVL.CI (version 0.1.1)

OVL.Delta.mix: EM-Delta

Description

Computes a confidence interval for the OVL between two populations under Gaussian and two-component Gaussian mixture models, or both populations modeled as two-component Gaussian mixtures, using EM-based estimation and the delta method.

Usage

OVL.Delta.mix(
  x,
  y,
  alpha = 0.05,
  h = 10^(-5),
  interv = c(0, 20),
  all_mix = FALSE
)

Value

A list containing a confidence interval. Additional elements (e.g., var_OVL, parameter estimates, OVL_hat) may also be returned.

Arguments

x

Numeric vector. Data from the first group. When all_mix = FALSE, this group is modeled as Gaussian.

y

Numeric vector. Data from the second group, modeled as a two-component Gaussian mixture.

alpha

confidence level.

h

Step size used to compute numerical derivatives.

interv

Numeric vector of length 2. Search interval for intersection points between the corresponding densities.

all_mix

Logical. If TRUE, both groups are modeled as two-component Gaussian mixtures. If FALSE, only y is modeled as a mixture and x is Gaussian.

Examples

Run this code
set.seed(1)
x <- ifelse(runif(100) < 0.5, rnorm(100, mean = 0, sd = 1), rnorm(100, mean = 2, sd = 1))
y <- ifelse(runif(100) < 0.5, rnorm(100, mean = 2.5, sd = 1), rnorm(100, mean = 2, sd = 1))
res <- OVL.Delta.mix(x, y, all_mix = TRUE, interv = c(-10, 10))
res$IC1
res$IC2

Run the code above in your browser using DataLab