Compare EASE of correlated sets of estimates

compareEase(
logRr1,
seLogRr1,
logRr2,
seLogRr2,
alpha = 0.05,
sampleSize = 1000
)

## Arguments

logRr1

A numeric vector of effect estimates generated using the first method on the log scale.

seLogRr1

The standard error of the log of the effect estimates generated using the first method.

logRr2

A numeric vector of effect estimates generated using the second method on the log scale.

seLogRr2

The standard error of the log of the effect estimates generated using the second method.

alpha

The expected type I error for computing confidence intervals and p-values.

sampleSize

The number of samples in the bootstraps.

## Value

A data frame with 4 columns: the point estimate, confidence interval lower bound, and upper bound for the difference between EASE in the two sets of negative controls, and a p value against the null hypothesis that the EASE is the same for the two sets.

The data frame has two attributes: ease1 and ease2, providing the EASE estimates (and confidence intervals) for the two sets, computed using bootstrapping. Note that these estimates may somewhat different from those generated using computeExpectedAbsoluteSystematicError, because a different approach is used to compute the confidence interval. The approach used here will more closely align with the computation of the difference in EASE.

## Details

Compare the expected absolute systematic error (EASE) of two sets of estimates for the same set of negative controls.

Important: the two sets of estimates (logRr1 + seLogRr1 and logRr2 + seLogRr2) should be in identical order, so that for example the first item in each vector corresponds to the same negative control.

## Examples

# Simulate results of first method:
ncs1 <- simulateControls(n = 50)

# Simulate second method to be more biased:
ncs2 <- ncs1
ncs2$logRr <- ncs2$logRr + rnorm(nrow(ncs2), mean = 0.1, sd = 0.1)

delta <- compareEase(
logRr1 = ncs1$logRr, seLogRr1 = ncs1$seLogRr,
logRr2 = ncs2$logRr, seLogRr2 = ncs2$seLogRr
)
delta
#>        delta        ciLb        ciUb     p
#> 1 -0.0547409 -0.08363382 -0.02116511 0.001
attr(delta, "ease1")
#>         ease       ciLb      ciUb
#> 1 0.08771109 0.04816934 0.1286349
attr(delta, "ease2")
#>       ease      ciLb      ciUb
#> 1 0.142452 0.1068133 0.1740856