Package 'WRestimates'

Title: Sample Size, Power and CI for the Win Ratio
Description: Calculates non-parametric estimates of the sample size, power and confidence intervals for the win-ratio. For more detail on the theory behind the methodologies implemented see Yu, R. X. and Ganju, J. (2022) <doi:10.1002/sim.9297>.
Authors: Autumn O'Donnell [aut, cre, cph]
Maintainer: Autumn O'Donnell <[email protected]>
License: MIT + file LICENSE
Version: 0.1.0
Built: 2024-10-31 22:23:33 UTC
Source: CRAN

Help Index


Confidence Interval (CI) for Win Ratio

Description

Calculate the confidence interval for a win ratio.

CI=exp((ln(WR)+/Zvar)CI = exp((ln(WR) +/- Z\sqrt{var})

Where;

ln(WR)ln(WR) = Natural log of the true or assumed win ratio.

ZZ = Z-score from normal distribution.

var\sqrt{var} = Standard deviation of the natural log of the win ratio.

Usage

wr.ci(WR = 1, Z = 1.96, var.ln.WR, N, sigma.sqr, k, p.tie)

Arguments

WR

Win ratio; Default: WR = 1 for an assumed true win ratio where H0 is assumed true.

Z

Z-score from normal distribution; Default: Z = 1.96 for a 95% CI.

var.ln.WR

Variance of the natural log (lnln) of the win ratio.

N

Sample size.

sigma.sqr

Population variance of the natural log (lnln) of the win ratio.

k

The proportion of subjects allocated to one group i.e. the proportion of patients allocated to treatment.

p.tie

The proportion of ties.

Value

wr.ci returns an object of class "list" containing the following components:

ci

The confidence interval of a win ratio.

WR

The win ratio.

Z

Z-score from normal distribution.

var.ln.WR

Variance of the natural log (lnln) of the win ratio.

N

Sample size.

sigma.sqr

Population variance of the natural log (lnln) of the win ratio.

k

The proportion of subjects allocated to one group.

p.tie

The proportion of ties.

Author(s)

Autumn O'Donnell [email protected]

References

Yu, R. X. and Ganju, J. (2022). Sample size formula for a win ratio endpoint. Statistics in medicine, 41(6), 950-963. doi:10.1002/sim.9297.

See Also

wr.sigma.sqr; wr.var

Examples

## N = 100 patients, 1:1 allocation, one-sided alpha = 2.5%, power = 90%
## (beta = 10%), a small proportion of ties p.tie = 0.1, and 50% more wins
## on treatment than control.

### Calculation 95% CI
wr.ci(N = 100, WR = 1.5, k = 0.5, p.tie = 0.1)

Power of a Win Ratio

Description

Calculate the power of a win ratio.

Power=1Φ(Z[α]ln(WR[true])(N/σ))Power = 1 - \Phi(Z[\alpha] - ln(WR[true])(\sqrt{N}/\sigma))

Usage

wr.power(N, alpha = 0.025, WR.true = 1, sigma.sqr, k, p.tie)

Arguments

N

Sample size.

alpha

Level of significance (Type I error rate); Default: α\alpha = 0.025.

WR.true

True or assumed win ratio; Default: WR.true = 1 where H0 is assumed true.

sigma.sqr

Population variance of the natural log (lnln) of the win ratio.

k

The proportion of subjects allocated to one group i.e. the proportion of patients allocated to treatment.

p.tie

The proportion of ties.

Value

wr.power returns an object of class "list" containing the following components:

power

Power of the win ratio.

N

Sample size.

alpha

Level of significance.

WR.true

True or assumed win ratio.

sigma.sqr

Population variance of the natural log (lnln) of the win ratio.

k

The proportion of subjects allocated to one group.

p.tie

The proportion of ties.

Author(s)

Autumn O'Donnell [email protected]

References

Yu, R. X. and Ganju, J. (2022). Sample size formula for a win ratio endpoint. Statistics in medicine, 41(6), 950-963. doi: 10.1002/sim.9297.

See Also

wr.sigma.sqr

Examples

## N = 100 patients, 1:1 allocation, one-sided alpha = 2.5%, small
## proportion of ties p.tie = 0.1, and 50% more wins on treatment
## than control.

### Calculate the Power
wr.power(N = 100, WR.true = 1.5, k = 0.5, p.tie = 0.1)

Assumed Population Variance of a Win Ratio

Description

Calculate the assumed population variance of a win ratio.

σ2=(4(1+p[tie]))/(3k(1k)(1p[tie])\sigma^2 = (4 * (1 + p[tie]))/(3 * k * (1 - k) * (1 - p[tie])

Where;

p[tie]=Theproportionofties.p[tie] = The proportion of ties.

k=Theproportionofsubjectsallocatedtoonegroup.k = The proportion of subjects allocated to one group.

Usage

wr.sigma.sqr(k, p.tie)

Arguments

k

The proportion of subjects allocated to one group i.e. the proportion of patients allocated to treatment.

p.tie

The proportion of ties.

Value

wr.sigma.sqr returns an object of class "list" containing the following components:

sigma.sqr

Population variance of the natural log (lnln) of the win ratio.

k

The proportion of subjects allocated to one group.

p.tie

The proportion of ties.

Author(s)

Autumn O'Donnell [email protected]

References

Yu, R. X. and Ganju, J. (2022). Sample size formula for a win ratio endpoint. Statistics in medicine, 41(6), 950-963. doi: 10.1002/sim.9297.

See Also

wr.var


Approximate Sample Size of a Win Ratio

Description

Calculates the approximate required sample size of a win ratio.

N  (σ2(Z[1α]+Z[1β])2)/(ln2(WR[true]))N ~~ (\sigma^2 * (Z[1-\alpha] + Z[1-\beta])^2)/(ln^2(WR[true]))

Usage

wr.ss(alpha = 0.025, beta = 0.1, WR.true = 1, k, p.tie, sigma.sqr)

Arguments

alpha

Level of significance (Type I error rate); Default: α\alpha = 0.025.

beta

Type II error rate; Default: β\beta = 0.1.

WR.true

True or assumed win ratio; Default: WR.true = 1 where H0 is assumed true.

k

The proportion of subjects allocated to one group i.e. the proportion of patients allocated to treatment.

p.tie

The proportion of ties.

sigma.sqr

Population variance of the natural log (lnln) of the win ratio.

Value

wr.ss returns an object of class "list" containing the following components:

N

Sample size.

alpha

Level of significance (Type I error rate).

beta

Type II error rate.

WR.true

True or assumed win ratio.

k

The proportion of subjects allocated to one group.

p.tie

The proportion of ties.

sigma.sqr

Population variance of the natural log (lnln) of the win ratio.

Author(s)

Autumn O'Donnell [email protected]

References

Yu, R. X. and Ganju, J. (2022). Sample size formula for a win ratio endpoint. Statistics in medicine, 41(6), 950-963. doi: 10.1002/sim.9297.

See Also

wr.sigma.sqr

Examples

## 1:1 allocation, one-sided alpha = 2.5%, power = 90% (beta = 10%),
## a small proportion of ties p.tie = 0.1, and 50% more wins on treatment
## than control

### Calculate Sample Size
wr.ss(WR.true = 1.5, k = 0.5, p.tie = 0.1)

Approximate Variance of the Natural Log (lnln) of the Win Ratio.

Description

Calculating the approximate variance of the natural log (lnln) a win ratio.

Var(ln(WR))  σ2/NVar(ln(WR)) ~~ \sigma^2/N

Where;

σ2=(4(1+p[tie]))/(3k(1k)(1p[tie])\sigma^2 = (4 * (1 + p[tie]))/(3 * k * (1 - k) * (1 - p[tie])

Usage

wr.var(N, sigma.sqr, k, p.tie)

Arguments

N

Sample size.

sigma.sqr

Population variance of the natural log (lnln) of the win ratio.

k

The proportion of subjects allocated to one group i.e. the proportion of patients allocated to treatment.

p.tie

The proportion of ties.

Value

wr.var returns an object of class "list" containing the following components:

var.ln.WR

Approximate variance of the natural log (lnln) a win ratio.

N

Sample size.

sigma.sqr

Population variance of the natural log (lnln) of the win ratio.

k

The proportion of subjects allocated to one group.

p.tie

The proportion of ties.

Author(s)

Autumn O'Donnell [email protected]

References

Yu, R. X. and Ganju, J. (2022). Sample size formula for a win ratio endpoint. Statistics in medicine, 41(6), 950-963. doi: 10.1002/sim.9297.

See Also

wr.sigma.sqr