hMeanChiSqCI: Computes a confidence interval by inverting the harmonic mean...

Description Usage Arguments Details Value Author(s) References Examples

View source: R/hMeanChiSqCI.R

Description

A confidence interval by inverting the harmonic mean chi-squared test based on study-specific estimates and standard errors.

Usage

1
2
hMeanChiSqCI(thetahat, se, w=rep(1, length(thetahat)),
                         alternative="two.sided", level=0.95)

Arguments

thetahat

A vector of parameter estimates.

se

A vector of standard errors.

w

A vector of weights.

alternative

Either "greater", "less", "two.sided" or "none". Defaults to "two.sided". Specifies the alternative to be considered in the computation of the confidence interval.

level

The level of the confidence interval. Defaults to 0.95.

Details

If alternative is "none", then the function may return a set of (non-overlapping) confidence intervals. The output then is a vector of length 2n where n is the number of confidence intervals.

Value

The p-value from the harmonic mean chi-squared test

Author(s)

Leonhard Held

References

Held, L. (2020). The harmonic mean chi-squared test to substantiate scientific findings. Journal of the Royal Statistical Society: Series C (Applied Statistics), 69, 697-708. https://doi.org/10.1111/rssc.12410

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
    
## Example from Fisher (1999) as discussed in Held (2020)
pvalues <- c(0.0245, 0.1305, 0.00025, 0.2575, 0.128)
lower <- c(0.04, 0.21, 0.12, 0.07, 0.41)
upper <- c(1.14, 1.54, 0.60, 3.75, 1.27)
se <- ci2se(lower, upper, ratio=TRUE)
estimate <- ci2estimate(lower, upper, ratio=TRUE)

## two-sided
CI1 <- hMeanChiSqCI(thetahat=estimate, se=se, w=1/se^2, alternative="two.sided")
CI2 <- hMeanChiSqCI(thetahat=estimate, se=se, w=1/se^2, alternative="two.sided", level=0.99875)
## one-sided
CI1b <- hMeanChiSqCI(thetahat=estimate, se=se, w=1/se^2, alternative="less", level=0.975)
CI2b <- hMeanChiSqCI(thetahat=estimate, se=se, w=1/se^2, alternative="less", level=1-0.025^2)

## confidence intervals on hazard ratio scale
print(round(exp(CI1),2))
print(round(exp(CI2),2))
print(round(exp(CI1b),2))
print(round(exp(CI2b),2))

ReplicationSuccess documentation built on Dec. 2, 2020, 3 p.m.