Version: 0.6
Date: 2025-06-04
Author: Samuel Pawel ORCID iD [aut, cre]
Maintainer: Samuel Pawel <samuel.pawel@uzh.ch>
Title: Compatible Point Estimates, Confidence Intervals, and P-Values for Two Trials
Description: Implements combined p-value functions for two trials along with compatible combined point and interval estimates as described in Pawel, Roos, and Held (2025) <doi:10.48550/arXiv.2503.10246>.
License: GPL-3
Encoding: UTF-8
Suggests: roxygen2, tinytest
NeedsCompilation: no
RoxygenNote: 7.3.1
URL: https://github.com/SamCH93/twotrials
BugReports: https://github.com/SamCH93/twotrials/issues
Packaged: 2025-06-04 08:10:38 UTC; sam
Repository: CRAN
Date/Publication: 2025-06-06 12:40:02 UTC

Combined estimation function from the two-trials rule

Description

This function computes parameter estimates from the combined estimation function based on the two-trials rule

Usage

mu2TR(a = 0.5, t1, t2, se1, se2, alternative = "greater", ...)

Arguments

a

P-value function quantile corresponding to the parameter estimate. Defaults to 0.5, which corresponds to the median estimate. Set to a = c(0.025, 0.975) to obtain limits of a 95% confidence interval

t1

Parameter estimate from trial 1

t2

Parameter estimate from trial 2

se1

Standard error of the parameter estimate from trial 1

se2

Standard error of the parameter estimate from trial 2

alternative

One-sided alternative hypothesis. Can be either "greater" or "less". Defaults to "greater"

...

Additional arguments (for consistency with other estimation functions)

Value

The parameter estimate based on the two-trials rule

Author(s)

Samuel Pawel

See Also

p2TR

Examples

## 95% CI and median estimate for logRR in RESPIRE trials
mu2TR(a = c(0.975, 0.5, 0.025), t1 = -0.4942, t2 = -0.1847, se1 = 0.1833,
      se2 = 0.1738, alternative = "less")


Combined estimation function from Edgington's method

Description

This function computes parameter estimates from the combined estimation function based on Edgington's method

Usage

muEdgington(a = 0.5, t1, t2, se1, se2, alternative = "greater", ...)

Arguments

a

P-value function quantile corresponding to the parameter estimate. Defaults to 0.5, which corresponds to the median estimate. Set to a = c(0.025, 0.975) to obtain limits of a 95% confidence interval

t1

Parameter estimate from trial 1

t2

Parameter estimate from trial 2

se1

Standard error of the parameter estimate from trial 1

se2

Standard error of the parameter estimate from trial 2

alternative

One-sided alternative hypothesis. Can be either "greater" or "less". Defaults to "greater"

...

Additional arguments for stats::uniroot

Value

The parameter estimate based on Edgington's method

Author(s)

Samuel Pawel

See Also

pEdgington

Examples

## 95% CI and median estimate for logRR in RESPIRE trials
muEdgington(a = c(0.975, 0.5, 0.025), t1 = -0.4942, t2 = -0.1847, se1 = 0.1833,
            se2 = 0.1738, alternative = "less")


Combined estimation function from Fisher's method

Description

This function computes parameter estimates from the combined estimation function based on Fisher's method

Usage

muFisher(a = 0.5, t1, t2, se1, se2, alternative = "greater", ...)

Arguments

a

P-value function quantile corresponding to the parameter estimate. Defaults to 0.5, which corresponds to the median estimate. Set to a = c(0.025, 0.975) to obtain limits of a 95% confidence interval

t1

Parameter estimate from trial 1

t2

Parameter estimate from trial 2

se1

Standard error of the parameter estimate from trial 1

se2

Standard error of the parameter estimate from trial 2

alternative

One-sided alternative hypothesis. Can be either "greater" or "less". Defaults to "greater"

...

Additional arguments for stats::uniroot

Value

The parameter estimate based on Fisher's method

Author(s)

Samuel Pawel

See Also

pFisher

Examples

## 95% CI and median estimate for logRR in RESPIRE trials
muFisher(a = c(0.975, 0.5, 0.025), t1 = -0.4942, t2 = -0.1847, se1 = 0.1833,
         se2 = 0.1738, alternative = "less")


Combined estimation function from fixed-effect meta-analysis

Description

This function computes parameter estimates from the combined estimation function based on fixed-effect meta-analysis

Usage

muMA(a = 0.5, t1, t2, se1, se2, alternative = "greater", ...)

Arguments

a

P-value function quantile corresponding to the parameter estimate. Defaults to 0.5, which corresponds to the median estimate. Set to a = c(0.025, 0.975) to obtain limits of a 95% confidence interval

t1

Parameter estimate from trial 1

t2

Parameter estimate from trial 2

se1

Standard error of the parameter estimate from trial 1

se2

Standard error of the parameter estimate from trial 2

alternative

One-sided alternative hypothesis. Can be either "greater" or "less". Defaults to "greater"

...

Additional arguments (for consistency with other estimation functions)

Value

The parameter estimate based on fixed-effect meta-analysis

Author(s)

Samuel Pawel

See Also

muMA

Examples

## 95% CI and median estimate for logRR in RESPIRE trials
muMA(a = c(0.975, 0.5, 0.025), t1 = -0.4942, t2 = -0.1847, se1 = 0.1833,
     se2 = 0.1738, alternative = "less")


Combined estimation function from Pearson's method

Description

This function computes parameter estimates from the combined estimation function based on Pearson's method

Usage

muPearson(a = 0.5, t1, t2, se1, se2, alternative = "greater", ...)

Arguments

a

P-value function quantile corresponding to the parameter estimate. Defaults to 0.5, which corresponds to the median estimate. Set to a = c(0.025, 0.975) to obtain limits of a 95% confidence interval

t1

Parameter estimate from trial 1

t2

Parameter estimate from trial 2

se1

Standard error of the parameter estimate from trial 1

se2

Standard error of the parameter estimate from trial 2

alternative

One-sided alternative hypothesis. Can be either "greater" or "less". Defaults to "greater"

...

Additional arguments for stats::uniroot

Value

The parameter estimate based on Pearson's method

Author(s)

Samuel Pawel

See Also

pPearson

Examples

## 95% CI and median estimate for logRR in RESPIRE trials
muPearson(a = c(0.975, 0.5, 0.025), t1 = -0.4942, t2 = -0.1847, se1 = 0.1833,
          se2 = 0.1738, alternative = "less")


Combined estimation function from Tippett's method

Description

This function computes parameter estimates from the combined estimation function based on Tippett's method

Usage

muTippett(a = 0.5, t1, t2, se1, se2, alternative = "greater", ...)

Arguments

a

P-value function quantile corresponding to the parameter estimate. Defaults to 0.5, which corresponds to the median estimate. Set to a = c(0.025, 0.975) to obtain limits of a 95% confidence interval

t1

Parameter estimate from trial 1

t2

Parameter estimate from trial 2

se1

Standard error of the parameter estimate from trial 1

se2

Standard error of the parameter estimate from trial 2

alternative

One-sided alternative hypothesis. Can be either "greater" or "less". Defaults to "greater"

...

Additional arguments (for consistency with other estimation functions)

Value

The parameter estimate based on Tippett's method

Author(s)

Samuel Pawel

See Also

pTippett

Examples

## 95% CI and median estimate for logRR in RESPIRE trials
muTippett(a = c(0.975, 0.5, 0.025), t1 = -0.491, t2 = -0.185, se1 = 0.179,
          se2 = 0.174, alternative = "less")


Combined p-value from the two-trials rule

Description

This function computes the combined p-value based on two parameter estimates using the two-trials rule (also known as the maximum method)

Usage

p2TR(mu = 0, t1, t2, se1, se2, alternative = "greater")

Arguments

mu

Null value. Defaults to 0

t1

Parameter estimate from trial 1

t2

Parameter estimate from trial 2

se1

Standard error of the parameter estimate from trial 1

se2

Standard error of the parameter estimate from trial 2

alternative

One-sided alternative hypothesis. Can be either "greater" or "less". Defaults to "greater"

Value

The combined p-value based on the two-trials rule

Author(s)

Samuel Pawel

See Also

mu2TR

Examples

## p-value for H0: logRR = 0 in RESPIRE trials
p2TR(mu = 0, t1 = -0.4942, t2 = -0.1847, se1 = 0.1833, se2 = 0.1738,
     alternative = "less")


Combined p-value from Edgington's method

Description

This function computes the combined p-value based on two parameter estimates using Edgington's method (also known as the sum method)

Usage

pEdgington(mu = 0, t1, t2, se1, se2, alternative = "greater")

Arguments

mu

Null value. Defaults to 0

t1

Parameter estimate from trial 1

t2

Parameter estimate from trial 2

se1

Standard error of the parameter estimate from trial 1

se2

Standard error of the parameter estimate from trial 2

alternative

One-sided alternative hypothesis. Can be either "greater" or "less". Defaults to "greater"

Value

The combined p-value based on Edgington's method

Author(s)

Samuel Pawel

See Also

muEdgington

Examples

## p-value for H0: logRR = 0 in RESPIRE trials
pEdgington(mu = 0, t1 = -0.4942, t2 = -0.1847, se1 = 0.1833, se2 = 0.1738,
           alternative = "less")


Combined p-value from Fisher's method

Description

This function computes the combined p-value based on two parameter estimates using the Fisher's method (also known as the product method)

Usage

pFisher(mu = 0, t1, t2, se1, se2, alternative = "greater")

Arguments

mu

Null value. Defaults to 0

t1

Parameter estimate from trial 1

t2

Parameter estimate from trial 2

se1

Standard error of the parameter estimate from trial 1

se2

Standard error of the parameter estimate from trial 2

alternative

One-sided alternative hypothesis. Can be either "greater" or "less". Defaults to "greater"

Value

The combined p-value based on Fisher's method

Author(s)

Samuel Pawel

See Also

muFisher

Examples

## p-value for H0: logRR = 0 in RESPIRE trials
pFisher(mu = 0, t1 = -0.4942, t2 = -0.1847, se1 = 0.1833, se2 = 0.1738,
        alternative = "less")


Combined p-value from fixed-effect meta-analysis

Description

This function computes the combined p-value based on two parameter estimates using fixed-effect meta-analysis (equivalent to Stouffer's p-value combination method with suitable weights)

Usage

pMA(mu = 0, t1, t2, se1, se2, alternative = "greater")

Arguments

mu

Null value. Defaults to 0

t1

Parameter estimate from trial 1

t2

Parameter estimate from trial 2

se1

Standard error of the parameter estimate from trial 1

se2

Standard error of the parameter estimate from trial 2

alternative

One-sided alternative hypothesis. Can be either "greater" or "less". Defaults to "greater"

Value

The combined p-value based on fixed-effect meta-analysis

Author(s)

Samuel Pawel

See Also

pMA

Examples

## p-value for H0: logRR = 0 in RESPIRE trials
pMA(mu = 0, t1 = -0.4942, t2 = -0.1847, se1 = 0.1833, se2 = 0.1738,
    alternative = "less")


Combined p-value from Pearson's method

Description

This function computes the combined p-value based on two parameter estimates using Pearson's method

Usage

pPearson(mu = 0, t1, t2, se1, se2, alternative = "greater")

Arguments

mu

Null value. Defaults to 0

t1

Parameter estimate from trial 1

t2

Parameter estimate from trial 2

se1

Standard error of the parameter estimate from trial 1

se2

Standard error of the parameter estimate from trial 2

alternative

One-sided alternative hypothesis. Can be either "greater" or "less". Defaults to "greater"

Value

The combined p-value based on Pearson's method

Author(s)

Samuel Pawel

See Also

muPearson

Examples

## p-value for H0: logRR = 0 in RESPIRE trials
pPearson(mu = 0, t1 = -0.4942, t2 = -0.1847, se1 = 0.1833, se2 = 0.1738,
         alternative = "less")


Combined p-value from Tippett's method

Description

This function computes the combined p-value based on two parameter estimates using Tippett's method (also known as the minimum method)

Usage

pTippett(mu = 0, t1, t2, se1, se2, alternative = "greater")

Arguments

mu

Null value. Defaults to 0

t1

Parameter estimate from trial 1

t2

Parameter estimate from trial 2

se1

Standard error of the parameter estimate from trial 1

se2

Standard error of the parameter estimate from trial 2

alternative

One-sided alternative hypothesis. Can be either "greater" or "less". Defaults to "greater"

Value

The combined p-value based on Tippett's method

Author(s)

Samuel Pawel

See Also

muTippett

Examples

## p-value for H0: logRR = 0 in RESPIRE trials
pTippett(mu = 0, t1 = -0.491, t2 = -0.185, se1 = 0.179, se2 = 0.174,
         alternative = "less")


Plot method for class "twotrials"

Description

Plot method for class "twotrials"

Usage

## S3 method for class 'twotrials'
plot(
  x,
  xlim = c(min(x$isummaries$lower), max(x$isummaries$upper)),
  two.sided = FALSE,
  plot = TRUE,
  ...
)

Arguments

x

Object of class "twotrials"

xlim

x-axis limits. Defaults to the confidence interval range of trial 1 and trial 2

two.sided

Logical indicating whether the p-value functions should be converted to a two-sided p-value function via the centrality function 2min(p, 1 - p). Defaults to FALSE

plot

Logical indicating whether p-value functions should be plotted. Defaults to TRUE

...

Other arguments (for consistency with the generic)

Value

Plots combined p-value functions and invisibly returns a data frame containing the data underlying the plot

Author(s)

Samuel Pawel

See Also

twotrials

Examples

## logRR estimates from RESPIRE trials
res <- twotrials(null = 0, t1 = -0.4942, t2 = -0.1847, se1 = 0.1833, se2 = 0.1738,
                 alternative = "less", level = 0.95)
plot(res) # one-sided p-value functions
plot(res, two.sided = TRUE) # two-sided p-value functions


Print method for class "twotrials"

Description

Print method for class "twotrials"

Usage

## S3 method for class 'twotrials'
print(x, digits = 3, ...)

Arguments

x

Object of class "twotrials"

digits

Number of digits for formatting of numbers

...

Other arguments (for consistency with the generic)

Value

Prints text summary in the console and invisibly returns the "twotrials" object

Author(s)

Samuel Pawel

See Also

twotrials

Examples

## logRR estimates from RESPIRE trials
twotrials(null = 0, t1 = -0.4942, t2 = -0.1847, se1 = 0.1833, se2 = 0.1738,
          alternative = "less", level = 0.95)


Combined p-value function inference for two trials

Description

This function computes combined p-values, point estimates, and confidence intervals based on two parameter estimates using fixed-effect meta-analysis, the two-trials rule, Edgington's, Fisher's, Pearson's, and Tippett's combination methods

Usage

twotrials(null = 0, t1, t2, se1, se2, alternative = "greater", level = 0.95)

Arguments

null

Null value for which p-values should be computed. Defaults to 0

t1

Parameter estimate from trial 1

t2

Parameter estimate from trial 2

se1

Standard error of the parameter estimate from trial 1

se2

Standard error of the parameter estimate from trial 2

alternative

One-sided alternative hypothesis. Can be either "greater" or "less". Defaults to "greater"

level

Confidence interval level. Defaults to 0.95

Value

Object of class "twotrials", which is a list of the supplied arguments augmented with pfuns and ipfuns (combined and individual p-value functions), mufuns and imufuns (combined and individual estimation functions), and summaries and isummaries (combined and individual confidence intervals, point estimates, p-values, implicit weights) elements

Author(s)

Samuel Pawel

See Also

pEdgington, muEdgington, pMA, muMA, pTippett, muTippett, p2TR, mu2TR, pFisher, muFisher, pPearson, muPearson, plot.twotrials, print.twotrials

Examples

## logRR estimates from RESPIRE trials
twotrials(null = 0, t1 = -0.4942, t2 = -0.1847, se1 = 0.1833, se2 = 0.1738,
          alternative = "less", level = 0.95)

## compute 99.875% CIs instead
twotrials(null = 0, t1 = -0.4942, t2 = -0.1847, se1 = 0.1833, se2 = 0.1738,
          alternative = "less", level = 0.99875)