Type: Package
Title: Design and Analysis of Hierarchical Composite Endpoints
Version: 0.8.0
Description: Simulate and analyze hierarchical composite endpoints. Includes implementation for the kidney hierarchical composite endpoint as defined in Heerspink HL et al (2023) “Development and validation of a new hierarchical composite end point for clinical trials of kidney disease progression” (Journal of the American Society of Nephrology 34 (2): 2025–2038, <doi:10.1681/ASN.0000000000000243>). Win odds, also called Wilcoxon-Mann-Whitney or success odds, is the main analysis method. Other win statistics (win probability, win ratio, net benefit) are also implemented in the univariate case, provided there is no censoring. The win probability analysis is based on the Brunner-Munzel test and uses the DeLong-DeLong-Clarke-Pearson variance estimator, as described by Brunner and Konietschke (2025) in “An unbiased rank-based estimator of the Mann–Whitney variance including the case of ties” (Statistical Papers 66 (1): 20, <doi:10.1007/s00362-024-01635-0>). Stratification and covariate adjustment are performed based on the methodology presented by Koch GG et al. in “Issues for covariance analysis of dichotomous and ordered categorical data from randomized clinical trials and non-parametric strategies for addressing them” (Statistics in Medicine 17 (15-16): 1863–92). For a review, see Gasparyan SB et al (2021) “Adjusted win ratio with stratification: Calculation methods and interpretation” (Statistical Methods in Medical Research 30 (2): 580–611, <doi:10.1177/0962280220942558>).
License: MIT + file LICENSE
Depends: R (≥ 3.5)
Imports: base, stats
Suggests: knitr, rmarkdown, testthat (≥ 3.0.0)
Config/testthat/edition: 3
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.3.2
VignetteBuilder: knitr
NeedsCompilation: no
Packaged: 2025-07-11 01:00:07 UTC; r148404
Author: Samvel B. Gasparyan ORCID iD [aut, cre]
Maintainer: Samvel B. Gasparyan <gasparyan.co@gmail.com>
Repository: CRAN
Date/Publication: 2025-07-11 15:00:02 UTC

Event-Time dataset for kidney outcomes.

Description

A dataset with multiple kidney outcomes over time scale outcomes of 1500 patients in the ADSL dataset.

Usage

ADET

Format

a data frame with 604 rows (events) and 6 variables:

ID

patient identifiers, numeric

AVAL

occurence time of the event, numeric

PARAM

name of the event, character

PARAMCD

coded name of the event, character

PARAMN

type of the event, outcomes 1-7, where a higher value means a better outcome, numeric

TRTPN

treatment values, 1 Active or 2 Placebo, numeric

Source

Heerspink HL et al "Development and validation of a new hierarchical composite endpoint for clinical trials of kidney disease progression." Journal of the American Society of Nephrology (2023): doi:10.1681/ASN.0000000000000243.

Examples

head(ADET)
# Number of unique patients
length(unique(ADET$ID)) 
# Number of events per event type
barplot(table(ADET$PARAM))

Laboratory dataset for Glomerular Filtration Rate (GFR) measurements.

Description

A dataset of laboratory measurements of kidney function over time for the 1500 patients in the ADSL dataset.

Usage

ADLB

Format

a data frame with 13980 rows and 8 variables:

ID

patient identifiers, numeric

TRTPN

treatment values, 1 Active or 2 Placebo, numeric

AVAL

measurement value, numeric

ADAY

measurement day in the study, numeric

AVISITN

hospital visit number, numeric

PARAM

name of the event, GFR measurements, character

PARAMCD

coded name of the event, GFR, character

PARAMN

type of the event is set to 7 for all measurements, numeric

Source

Heerspink HL et al "Development and validation of a new hierarchical composite endpoint for clinical trials of kidney disease progression." Journal of the American Society of Nephrology (2023): doi:10.1681/ASN.0000000000000243.

Examples

head(ADLB)

Baseline characteristics dataset of patients with kidney function assessments.

Description

A data frame with baseline characteristics for 1500 patients used to derive KHCE dataset.

Usage

ADSL

Format

a data frame with 1500 rows and 4 variables:

ID

patient identifiers, numeric

TRTPN

treatment values, 1 Active or 2 Placebo, numeric

EGFRBL

Baseline GFR values of patients, numeric

STRATAN

strata 1-4, higher value means a higher risk for kidney disease progression, numeric

Source

Heerspink HL et al "Development and validation of a new hierarchical composite endpoint for clinical trials of kidney disease progression." Journal of the American Society of Nephrology (2023): doi:10.1681/ASN.0000000000000243.

Examples

head(ADSL)

COVID-19 ordinal scale dataset (full report).

Description

A dataset with COVID-19 ordinal scale outcomes for 1062 patients.

Usage

COVID19

Format

a data frame with 1062 rows and 2 variables:

GROUP

type of the event, ordinal outcomes 1-8, where a higher value means a better outcome

TRTP

treatment values, A Active or P Placebo, character

Source

Beigel JH et al. "Remdesivir for the treatment of Covid-19-final report." New England Journal of Medicine 383.19 (2020): 1813-1836. doi:10.1056/NEJMoa2007764.

Examples

#Frequencies
table(COVID19)
mosaicplot(table(COVID19), col = c(1, 8, 6, 2, 4, 5, 3, 7), 
xlab = "Treatment", ylab = "Ordinal Scale", main = "COVID-19 ordinal scale")
# Convert to an hce object
COVID19HCE <- hce(GROUP = COVID19$GROUP, TRTP = COVID19$TRTP)
# Summary wins, losses, and ties with win odds
summaryWO(COVID19HCE, ref = "Placebo")

COVID-19 ordinal scale dataset (preliminary report).

Description

A dataset with COVID-19 ordinal scale outcomes for 844 patients.

Usage

COVID19b

Format

a data frame with 844 rows and 2 variables:

GROUP

type of the event, ordinal outcomes 1-8, where a higher value means a better outcome

TRTP

treatment values, Active or Placebo, character

Source

Beigel JH et al. "Remdesivir for the treatment of Covid-19-final report." New England Journal of Medicine 383.19 (2020): 1813-1836. doi:10.1056/NEJMoa2007764.

Examples

#Frequencies
table(COVID19b)
mosaicplot(table(COVID19b), col = c(1, 8, 6, 2, 4, 5, 3, 7), 
xlab = "Treatment", ylab = "Ordinal Scale", main = "COVID-19 ordinal scale")
# Calculate win statistics
calcWINS(x = COVID19b, AVAL = "GROUP", TRTP = "TRTP", ref = "Placebo")

COVID-19 ordinal scale dataset for a combination therapy.

Description

A dataset with COVID-19 ordinal scale outcomes for 1033 patients.

Usage

COVID19plus

Format

a data frame with 1033 rows and 4 variables:

ID

patient identifiers, numeric

TRTP

treatment values, A Active or P Placebo, character

GROUP

type of the event, ordinal outcomes 1-8, where a higher value means a better outcome

BASE

baseline ordinal values

Source

Kalil AC et al. "Baricitinib plus Remdesivir for Hospitalized Adults with Covid-19." New England Journal of Medicine 384.9 (2021): 795-807. doi:10.1056/NEJMoa2031994.

Examples

COVID19HCE <- hce(GROUP = COVID19plus$GROUP, TRTP = COVID19plus$TRTP)
# Summary wins, losses, and ties with win odds
summaryWO(COVID19HCE, ref = "P")

HCE1, HCE2, HCE3, HCE4 datasets for 1000 patients with different treatment effects.

Description

A simulated dataset containing the ordinal values and other attributes for 1000 patients. HCE1

Usage

HCE1

Format

a data frame with 1000 rows and 6 variables:

ID

subject ID, numbers from 1 to 1000

TRTP

treatment values, A Active or P Placebo, character

GROUP

type of the event, either Time-To-Event (TTE) or Continuous (C), character

GROUPN

type of the event, for the ordering of outcomes in the GROUP variable, numeric

AVALT

the timing of the time-to-event outcomes, numeric

AVAL0

original values for each type of the event, time for TTE outcomes, numeric values for Continuous outcomes, numeric

AVAL

AVAL = AVAL0 + GROUPN, ordinal analysis values for the HCE analysis. For the continuous outcome the values of AVAL0 are shifted to start always from 0. Numeric, but caution NOT to apply numeric operations; will give meaningless results

PADY

primary analysis day, the length of fixed follow-up in days, numeric


HCE1, HCE2, HCE3, HCE4 datasets for 1000 patients with different treatment effects.

Description

A simulated dataset containing the ordinal values and other attributes for 1000 patients. HCE2

Usage

HCE2

Format

a data frame with 1000 rows and 6 variables:

ID

subject ID, numbers from 1 to 1000

TRTP

treatment values, A Active or P Placebo, character

GROUP

type of the event, either Time-To-Event (TTE) or Continuous (C), character

GROUPN

type of the event, for the ordering of outcomes in the GROUP variable, numeric

AVALT

the timing of the time-to-event outcomes, numeric

AVAL0

original values for each type of the event, time for TTE outcomes, numeric values for Continuous outcomes, numeric

AVAL

AVAL = AVAL0 + GROUPN, ordinal analysis values for the HCE analysis. For the continuous outcome the values of AVAL0 are shifted to start always from 0. Numeric, but caution NOT to apply numeric operations; will give meaningless results

PADY

primary analysis day, the length of fixed follow-up in days, numeric


HCE1, HCE2, HCE3, HCE4 datasets for 1000 patients with different treatment effects.

Description

A simulated dataset containing the ordinal values and other attributes for 1000 patients. HCE3

Usage

HCE3

Format

a data frame with 1000 rows and 6 variables:

ID

subject ID, numbers from 1 to 1000

TRTP

treatment values, A Active or P Placebo, character

GROUP

type of the event, either Time-To-Event (TTE) or Continuous (C), character

GROUPN

type of the event, for the ordering of outcomes in the GROUP variable, numeric

AVALT

the timing of the time-to-event outcomes, numeric

AVAL0

original values for each type of the event, time for TTE outcomes, numeric values for Continuous outcomes, numeric

AVAL

AVAL = AVAL0 + GROUPN, ordinal analysis values for the HCE analysis. For the continuous outcome the values of AVAL0 are shifted to start always from 0. Numeric, but caution NOT to apply numeric operations; will give meaningless results

PADY

primary analysis day, the length of fixed follow-up in days, numeric


HCE1, HCE2, HCE3, HCE4 datasets for 1000 patients with different treatment effects.

Description

A simulated dataset containing the ordinal values and other attributes for 1000 patients. HCE4

Usage

HCE4

Format

a data frame with 1000 rows and 6 variables:

ID

subject ID, numbers from 1 to 1000

TRTP

treatment values, A Active or P Placebo, character

GROUP

type of the event, either Time-To-Event (TTE) or Continuous (C), character

GROUPN

type of the event, for the ordering of outcomes in the GROUP variable, numeric

AVALT

the timing of the time-to-event outcomes, numeric

AVAL0

original values for each type of the event, time for TTE outcomes, numeric values for Continuous outcomes, numeric

AVAL

AVAL = AVAL0 + GROUPN, ordinal analysis values for the HCE analysis. For the continuous outcome the values of AVAL0 are shifted to start always from 0. Numeric, but caution NOT to apply numeric operations; will give meaningless results

PADY

primary analysis day, the length of fixed follow-up in days, numeric


Calculates patient-level individual win proportions

Description

Calculates patient-level individual win proportions

Usage

IWP(data, AVAL, TRTP, ref)

Arguments

data

a data frame containing subject-level data.

AVAL

variable in the data with ordinal analysis values.

TRTP

the treatment variable in the data.

ref

the reference treatment group.

Value

the input data frame with a new column of individual win proportions named using the input AVAL value with ⁠_⁠.

References

Gasparyan SB et al. "Adjusted win ratio with stratification: calculation methods and interpretation." Statistical Methods in Medical Research 30.2 (2021): 580-611. doi:10.1177/0962280220942558

See Also

calcWO(), calcWO.hce(), calcWO.formula().

Examples

KHCE1 <- IWP(data = KHCE, AVAL = "EGFRBL", TRTP = "TRTPN", ref = 2)
WP <- tapply(KHCE1$EGFRBL_, KHCE1$TRTPN, mean)
VAR <- tapply(KHCE1$EGFRBL_, KHCE1$TRTPN, function(x) (length(x)-1)*var(x)/length(x))
N <- tapply(KHCE1$EGFRBL_, KHCE1$TRTPN, length)
SE <- sqrt(sum(VAR/N))
c(WP = WP[[1]], SE = SE)
calcWO(EGFRBL ~ TRTP, data = KHCE)[c("WP", "SE_WP")]

Kidney Hierarchical Composite Endpoint dataset.

Description

A dataset with kidney ordinal scale outcomes of 1500 patients in the ADSL dataset.

Usage

KHCE

Format

a data frame with 1500 rows and 11 variables:

ID

patient identifiers, numeric

TRTPN

treatment values, 1 Active or 2 Placebo, numeric

AVAL0

original values for each type of the event, time for TTE outcomes 1-6, numeric values for Continuous outcome 7, numeric

AVAL

AVAL = AVAL0 + GROUPN, ordinal analysis values for the HCE analysis, numeric, but caution NOT to apply numeric operations; will give meaningless results

GROUP

name of the event, character

GROUPN

ordinal outcomes corresponding to PARAMN values, numeric

PARAMCD

coded name of the event, character

PARAMN

severity of the event, outcomes 1-7, where a higher value means a better outcome, character

STRATAN

strata 1-4, higher value means more severe kidney disease, numeric

EGFRBL

Baseline GFR values of patients, numeric

TRTP

treatment values, A Active or P Placebo, character

PADY

primary analysis day (in years), length of the fixed follow-up, numeric

Source

Heerspink HL et al "Development and validation of a new hierarchical composite endpoint for clinical trials of kidney disease progression." Journal of the American Society of Nephrology (2023): doi:10.1681/ASN.0000000000000243.

Examples

# Adjusted win odds
res <- regWO(x = KHCE, AVAL = "AVAL", TRTP = "TRTP", COVAR = "STRATAN", ref = "P")
res

A generic function for coercing data structures to hce objects

Description

A generic function for coercing data structures to hce objects

Usage

as_hce(x, ...)

Arguments

x

an object used to select a method.

...

additional parameters.

Value

an hce object.

See Also

as_hce.data.frame().

Examples

### data frames 
data(HCE1)
HCE <- as_hce(HCE1)
calcWINS(HCE)

Coerce a data frame to an hce object

Description

Coerce a data frame to an hce object

Usage

## S3 method for class 'data.frame'
as_hce(x, ...)

Arguments

x

a data frame.

...

additional parameters.

Value

an hce object.

See Also

as_hce(), as_hce.default().

Examples

KHCE <- as_hce(KHCE)
calcWO(KHCE)

Coerce a data frame to an hce object

Description

Coerce a data frame to an hce object

Usage

## Default S3 method:
as_hce(x, ...)

Arguments

x

an object.

...

additional parameters.

Value

an hce object.

See Also

as_hce(), as_hce.data.frame().

Examples

dat <- KHCE
class(dat) <- "moo" # non-existent class
as_hce(dat) # tries to convert to an hce object

A generic function for calculating win statistics

Description

A generic function for calculating win statistics

Usage

calcWINS(x, ...)

Arguments

x

an object used to select a method.

...

further arguments passed to or from other methods.

Value

a data frame containing calculated values.

See Also

calcWINS.hce(), calcWINS.formula(), calcWINS.data.frame() methods.


Win statistics calculation using a data frame

Description

Win statistics calculation using a data frame

Usage

## S3 method for class 'data.frame'
calcWINS(
  x,
  AVAL,
  TRTP,
  ref,
  alpha = 0.05,
  WOnull = 1,
  SE_WP_Type = c("biased", "unbiased"),
  ...
)

Arguments

x

a data frame containing subject-level data.

AVAL

variable in the data with ordinal analysis values.

TRTP

the treatment variable in the data.

ref

the reference treatment group.

alpha

2-sided significance level. The default is 0.05.

WOnull

the null hypothesis. The default is 1.

SE_WP_Type

biased or unbiased standard error for win probability. The default is biased.

...

additional parameters.

Details

When SE_WP_Type = "unbiased", the calculations for win proportion, net benefit, and win odds utilize the unbiased standard error from Brunner-Konietschke (2025) paper which is a reformulation of the original formula proposed by Bamber (1975).

Value

a list containing win statistics and their confidence intervals. It contains the following named data frames:

References

The theory of win statistics is covered in the following papers:

See Also

calcWINS(), calcWINS.hce(), calcWINS.formula().

Examples

calcWINS(x = COVID19b, AVAL = "GROUP", TRTP = "TRTP", ref = "Placebo")
## Biased vs unbiased
n0 <- 5; n1 <- 7; p0 <- 0.2; p1 <- 0.5; x <- 1:20; delta <- 0.5
WP0 <- (p1 - p0)/2 + 0.5
DAT <- NULL
for(i in x){
  dat <- data.frame(AVAL = c(rbinom(n1, size = 1, p1), rbinom(n0, size = 1, p0)), 
  TRTP = c(rep("A", n1), rep("P", n0)))
  CL1 <- calcWINS(x = dat, AVAL = "AVAL", TRTP = "TRTP", ref = "P")$WP
  CL1$Type <- "biased"
  CL2 <- calcWINS(x = dat, AVAL = "AVAL", TRTP = "TRTP", 
                  ref = "P", SE_WP_Type = "unbiased")$WP
  CL2$Type <- "unbiased"
  DAT <- rbind(DAT, CL1, CL2)
}
WP <- DAT$WP[DAT$Type == "unbiased"]
plot(x, WP, pch = 19, xlab = "Simulations", ylab = "Win Probability", ylim = c(0., 1.1))
points(x + delta, WP, pch = 19)
arrows(x, DAT$LCL[DAT$Type == "unbiased"], 
       x, DAT$UCL[DAT$Type == "unbiased"], angle = 90, code = 3, length = 0.05, "green")
arrows(x + delta, DAT$LCL[DAT$Type == "biased"], 
       x + delta, DAT$UCL[DAT$Type == "biased"], angle = 90, code = 3, length = 0.05, col = "red")
abline(h = c(WP0, 1), col = "blue", lty = 3)
legend("bottomleft", legend = c("True WP", "Biased", "Unbiased"), 
                    col = c(4, 2, 3), lty = c(3, 1, 1 ), cex = 0.75)

Win statistics calculation using formula syntax

Description

Win statistics calculation using formula syntax

Usage

## S3 method for class 'formula'
calcWINS(x, data, ...)

Arguments

x

an object of class formula.

data

a data frame.

...

additional parameters.

Value

a list containing win statistics and their confidence intervals. It contains the following named data frames:

References

The theory of win statistics is covered in the following papers:

See Also

calcWINS(), calcWINS.hce(), calcWINS.data.frame().

Examples

# Example 1
calcWINS(x = GROUP ~ TRTP, data = COVID19b)
# Example 2
calcWINS(x = GROUP ~ TRTP, data = COVID19, ref = "Placebo", alpha = 0.01, WOnull = 1.2)
#' Example 3
calcWINS(x = GROUP ~ TRTP, data = COVID19)$WP
calcWINS(x = GROUP ~ TRTP, data = COVID19, SE_WP_Type = "unbiased")$WP

Win statistics calculation for hce objects

Description

Win statistics calculation for hce objects

Usage

## S3 method for class 'hce'
calcWINS(x, ...)

Arguments

x

an hce object.

...

additional parameters.

Value

a list containing win statistics and their confidence intervals. It contains the following named data frames:

References

The theory of win statistics is covered in the following papers:

See Also

calcWINS(), calcWINS.formula(), calcWINS.data.frame().

Examples

# Example 1
COVID19HCE <- hce(GROUP = COVID19$GROUP, TRTP = COVID19$TRTP)
calcWINS(COVID19HCE)
# Example 2
COVID19bHCE <- hce(GROUP = COVID19b$GROUP, TRTP = COVID19b$TRTP)
calcWINS(COVID19bHCE, ref = "Placebo", WOnull = 1.1, alpha = 0.01)
# Example 3
calcWINS(COVID19HCE, SE_WP_Type = "unbiased")$WP
calcWINS(COVID19HCE, SE_WP_Type = "biased")$WP

A generic function for calculating win odds

Description

A generic function for calculating win odds

Usage

calcWO(x, ...)

Arguments

x

an object used to select a method.

...

further arguments passed to or from other methods.

Value

a data frame containing calculated values.

See Also

calcWO.hce(), calcWO.formula(), calcWO.data.frame() methods.


Win odds calculation using a data frame

Description

Win odds calculation using a data frame

Usage

## S3 method for class 'data.frame'
calcWO(x, AVAL, TRTP, ref, alpha = 0.05, WOnull = 1, ...)

Arguments

x

a data frame containing subject-level data.

AVAL

variable in the data with ordinal analysis values.

TRTP

the treatment variable in the data.

ref

the reference treatment group.

alpha

significance level. The default is 0.05.

WOnull

the null hypothesis. The default is 1.

...

additional parameters.

Value

a data frame containing the win odds and its confidence interval. It contains the following columns:

References

Gasparyan SB et al. "Adjusted win ratio with stratification: calculation methods and interpretation." Statistical Methods in Medical Research 30.2 (2021): 580-611. doi:10.1177/0962280220942558

See Also

calcWO(), calcWO.hce(), calcWO.formula().

Examples

data(HCE4)
calcWO(x = HCE4, AVAL = "AVAL", TRTP = "TRTP", ref = "P")

Win odds calculation using formula syntax

Description

Win odds calculation using formula syntax

Usage

## S3 method for class 'formula'
calcWO(x, data, ...)

Arguments

x

an object of class formula.

data

a data frame.

...

additional parameters.

Value

a data frame containing the win odds and its confidence interval. It contains the following columns:

References

Gasparyan SB et al. "Adjusted win ratio with stratification: calculation methods and interpretation." Statistical Methods in Medical Research 30.2 (2021): 580-611. doi:10.1177/0962280220942558

See Also

calcWO(), calcWO.hce(), calcWO.data.frame().

Examples

#Example 1
data(HCE1)
calcWO(AVAL ~ TRTP, data = HCE1)

#Example 2
calcWO(GROUP ~ TRTP, data = COVID19, ref = "Placebo", alpha = 0.01)


Win odds calculation for hce objects

Description

Win odds calculation for hce objects

Usage

## S3 method for class 'hce'
calcWO(x, ...)

Arguments

x

an hce object.

...

additional parameters.

Value

a data frame containing the win odds and its confidence interval. It contains the following columns:

References

Gasparyan SB et al. "Adjusted win ratio with stratification: calculation methods and interpretation." Statistical Methods in Medical Research 30.2 (2021): 580-611. doi:10.1177/0962280220942558

See Also

calcWO(), calcWO.formula(), calcWO.data.frame().

Examples

Rates_A <- c(1, 1.5) 
Rates_P <- c(2, 2) 
dat <- simHCE(n = 500, TTE_A = Rates_A, TTE_P = Rates_P, CM_A = 1.25, CM_P = 1)
calcWO(dat)
calcWO(dat, ref = "A", WOnull = 1, alpha = 0.01)

Helper function for hce objects

Description

Helper function for hce objects

Usage

hce(
  GROUP = character(),
  TRTP = character(),
  AVAL0 = 0,
  ORD = sort(unique(GROUP))
)

Arguments

GROUP

a character vector of the same length as AVAL containing events.

TRTP

a character vector of the same length as AVAL containing assigned treatment groups.

AVAL0

a numeric vector of analysis values within each category. The default is 0.

ORD

a character vector containing ordered unique values of the GROUP variable for determining the hierarchy of events.

Value

an object of class hce. Its is a subject-level data frame (each row corresponds to one subject), containing the following columns:

See Also

as_hce() for coercing to hce objects.

Examples

# Example 1
set.seed(2022)
d <- hce(GROUP = sample(x = c("A", "B", "C"), size = 10, replace = TRUE), 
TRTP = rep(c("Active", "Control"), each = 5), 
AVAL0 = c(rnorm(5, mean = 1), rnorm(5)), ORD = c("A", "B", "C"))
calcWO(d, ref = "Control")

Minimum detectable or WO for alternative hypothesis for given power (no ties)

Description

Minimum detectable or WO for alternative hypothesis for given power (no ties)

Usage

minWO(N, power = 0.5, SD = NULL, k = 0.5, alpha = 0.05, WOnull = 1, digits = 2)

Arguments

N

a numeric vector of sample size values (two arms combined).

power

the given power. The default is 0.5 corresponding to the minimum detectable win odds. A numeric vector of length 1.

SD

assumed standard deviation of the win proportion. By default uses the conservative SD. A numeric vector of length 1.

k

proportion of active group in the overall sample size. Default is 0.5 (balanced randomization). A numeric vector of length 1.

alpha

the significance level for the 2-sided test. Default is 0.05. A numeric vector of length 1.

WOnull

the win odds value of the null hypothesis (default is 1). A numeric vector of length 1.

digits

precision to use for reporting calculated win odds.

Value

a data frame containing the calculated WO with input values.

References

Gasparyan SB et al. (2021) "Power and sample size calculation for the win odds test: application to an ordinal endpoint in COVID-19 trials." Journal of Biopharmaceutical Statistics 31.6: 765-787. doi:10.1080/10543406.2021.1968893

See Also

powerWO(), sizeWO() for WO power and sample size calculation.

Examples

minWO(N = 100, digits = 5)
minWO(N = 1200, power = 0.9, k = 0.75)
# Compare the minimum detectable win odds from shifted alternatives to max and ordered alternatives
WO <- minWO(N = 1200, k = 0.5, power = 0.67, digits = 7)$WO
powerWO(N = 1200, WO = WO, k = 0.5, alternative = "shift")
powerWO(N = 1200, WO = WO, k = 0.5, alternative = "ordered")
powerWO(N = 1200, WO = WO, k = 0.5, alternative = "max")

A plot method for hce objects

Description

Ordinal dominance graph for hce objects

Usage

## S3 method for class 'hce'
plot(x, fill = FALSE, ...)

Arguments

x

an object of class hce created by as_hce().

fill

logical; if TRUE fill the area above the graph.

...

additional arguments to be passed to base::plot() function.

Value

no return value, called for plotting.

References

Bamber D. "The area above the ordinal dominance graph and the area below the receiver operating characteristic graph." Journal of Mathematical Psychology 12.4 (1975): 387-415. doi:10.1016/0022-2496(75)90001-2

Examples

d <- as_hce(KHCE)
d$TRTP <- factor(d$TRTP, levels = c("P", "A"))
res <- calcWO(AVAL ~ TRTP, data = d)
# Ordinal Dominance Graph
plot(d, col = 3, type = 'l')
grid()
# Area above the Ordinal Dominance Graph
plot(d, fill = TRUE, col = "#865A4F", type = 'l', 
     lwd = 2, xlab = "Control", ylab = "Active")
legend("bottomright", legend = paste0("WP = ", round(res$WP, 5)))
abline(a = 0, b = 1, lwd = 2, lty = 2, col = "#999999")

A print method for hce_results objects

Description

A print method for hce_results objects

Usage

## S3 method for class 'hce_results'
plot(x, ...)

Arguments

x

an object of class hce_results.

...

additional arguments to be passed to base::plot() function.

Value

no return value, called for plotting.

Examples

WO <- minWO(N = 100:1000)
plot(WO)
POW <- powerWO(N = 100:1000, WO = 1.2)
plot(POW, ylim = c(0, 1))

Power calculation for the win odds test (no ties)

Description

Power calculation for the win odds test (no ties)

Usage

powerWO(
  N,
  WO,
  SD = NULL,
  k = 0.5,
  alpha = 0.05,
  WOnull = 1,
  alternative = c("shift", "max", "ordered")
)

Arguments

N

a numeric vector of sample size values.

WO

the given win odds for the alternative hypothesis. A numeric vector of length 1.

SD

assumed standard deviation of the win proportion. By default uses the conservative SD. A numeric vector of length 1.

k

proportion of active group in the overall sample size. Default is 0.5 (balanced randomization). A numeric vector of length 1.

alpha

the significance level for the 2-sided test. Default is 0.05. A numeric vector of length 1.

WOnull

the win odds value of the null hypothesis (default is 1). A numeric vector of length 1.

alternative

a character string specifying the class of the alternative hypothesis, must be one of "shift" (default), "max" or "ordered". You can specify just the initial letter.

Details

alternative = "max" refers to the maximum variance of the win proportion across all possible alternatives. The maximum variance equals WP*(1 - WP)/k where the win probability is calculated as ⁠WP = WO/(WO + 1).⁠ alternative = "shift" specifies the variance across alternatives from a shifted family of distributions (Wilcoxon test). The variance formula, as suggested by Noether, is calculated based on the null hypothesis as follows ⁠1/(12*k*(1 - k)).⁠ alternative = "ordered" specifies the variance across alternatives from stochastically ordered distributions which include shifted distributions.

Value

a data frame containing the calculated power with input values.

References

See Also

sizeWO(), minWO() for WO sample size or minimum detectable WO calculation.

Examples

# Example 1- Use the default standard deviation
powerWO(N = 1000, WO = 1.2)
powerWO(N = seq(500, 1500, 100), WO = 1.2)
# Example 2 - Use data-driven win odds and standard deviation from the COVID19 dataset
res <- calcWO(x = COVID19, AVAL = "GROUP", TRTP = "TRTP", ref = "Placebo")
print(res)
powerWO(N = 500, WO = res$WO, SD = res$SD_WP)
powerWO(N = 500, WO = res$WO) # power with the default standard deviation for the win proportion.
# Example 3 - Non-balanced 3:1 randomization
powerWO(N = 1000, WO = 1.2, k = 0.75)
# Example 4 - Comparison of different alternatives
powerWO(N = 1000, WO = 1.2, alternative = "m")
powerWO(N = 1000, WO = 1.2, alternative = "s")
powerWO(N = 1000, WO = 1.2, alternative = "o")

A print method for hce_results objects

Description

A print method for hce_results objects

Usage

## S3 method for class 'hce_results'
print(x, ...)

Arguments

x

an object of class hce_results.

...

additional arguments to be passed to base::print() function.

Value

no return value, called for printing.

Examples

print(powerWO(N = 1000, WO = 1.2))

Proportion of wins/losses/ties given the win odds and the win ratio

Description

Proportion of wins/losses/ties given the win odds and the win ratio

Usage

propWINS(WO, WR, Overall = 1, alpha = NULL, N = NULL)

Arguments

WO

win odds.

WR

win ratio.

Overall

number of comparisons, the sample size of the active treatment multiplied by the sample size of the placebo. The default is 1, hence gives the proportion.

alpha

significance level for the win ratio confidence interval. The default is NULL hence the confidence interval is not produced.

N

the combined sample size of two treatment groups. The default is NULL. If alpha is specified then either N should be specified or Overall > 1. For given Overall, the pooled sample size is calculated as N = 2*sqrt(Overall).

Details

Calculation formula

Value

a data frame with a number (or proportion if Overall = 1) of wins/losses/ties. If alpha is specified returns also WR confidence interval.

References

Examples

# Example 1
propWINS(WR = 2, WO = 1.5)
# Example 2 - Back-calculation 
COVID19HCE <- hce(GROUP = COVID19$GROUP, TRTP = COVID19$TRTP)
res <- calcWINS(COVID19HCE)
WR <- res$WR1$WR
WO <- res$WO$WO
Overall <- res$summary$TOTAL
propWINS(WR = WR, WO = WO, Overall = Overall)
## Verify 
res$summary
# Example 3 - Confidence interval
 propWINS(WR = 1.4, WO = 1.3, alpha = 0.05, Overall = 2500)
 propWINS(WR = 2, WO = 1.5, alpha = 0.01, N = 500)

A generic function for win odds regression

Description

A generic function for win odds regression

Usage

regWO(x, ...)

Arguments

x

an object used to select a method.

...

further arguments passed to or from other methods.

Value

a data frame containing calculated values.

See Also

regWO.data.frame(), regWO.formula() methods.


Win Odds Regression Using a Data Frame

Description

This function performs regression analysis for the win odds using a single numeric covariate.

Usage

## S3 method for class 'data.frame'
regWO(x, AVAL, TRTP, COVAR, ref, alpha = 0.05, WOnull = 1, ...)

Arguments

x

a data frame containing subject-level data.

AVAL

a variable in the data with ordinal analysis values.

TRTP

the treatment variable in the data.

COVAR

a numeric covariate.

ref

the reference treatment group.

alpha

the significance level, with a default value of 0.05.

WOnull

the null hypothesis value for win odds. The default is 1.

...

additional parameters.

Value

a data frame containing the calculated win odds and its confidence interval, including:

References

Gasparyan SB et al. (2021) "Adjusted win ratio with stratification: calculation methods and interpretation." Statistical Methods in Medical Research 30.2: 580-611. doi:10.1177/0962280220942558.

See Also

regWO(), regWO.formula().

Examples

# A baseline covariate that is highly correlated with the outcome
set.seed(2023)
dat <- COVID19
n <- nrow(dat)
dat$Severity <- ifelse(dat$GROUP > 4, rnorm(n, 0), rnorm(n, 100))
tapply(dat$Severity, dat$TRTP, mean)
regWO(x = dat, AVAL = "GROUP", TRTP = "TRTP", COVAR = "Severity", ref = "Placebo")
# Without adjustment
calcWO(x = dat, AVAL = "GROUP", TRTP = "TRTP", ref = "Placebo")

Win Odds Regression Using a Formula Syntax

Description

This function performs regression analysis for the win odds using a single numeric covariate.

Usage

## S3 method for class 'formula'
regWO(x, data, ...)

Arguments

x

an object of class formula.

data

a data frame.

...

additional parameters.

Value

a data frame containing the calculated win odds and its confidence interval, including:

References

Gasparyan SB et al. (2021) "Adjusted win ratio with stratification: calculation methods and interpretation." Statistical Methods in Medical Research 30.2: 580-611. doi:10.1177/0962280220942558.

See Also

regWO(), regWO.data.frame().

Examples

regWO(AVAL ~ TRTP, data = KHCE)
regWO(AVAL ~ TRTP + EGFRBL, data = KHCE)

Simulate hce object with given event rates of time-to-event outcomes (Weibull), mean and SD of the continuous outcome (normal or log-normal) by treatment group

Description

Simulate hce object with given event rates of time-to-event outcomes (Weibull), mean and SD of the continuous outcome (normal or log-normal) by treatment group

Usage

simHCE(
  n,
  n0 = n,
  TTE_A,
  TTE_P,
  CM_A,
  CM_P,
  CSD_A = 1,
  CSD_P = CSD_A,
  fixedfy = 1,
  yeardays = 360,
  pat = 100,
  shape = 1,
  theta = 1,
  logC = FALSE,
  seed = NULL,
  dec = 2,
  all_data = FALSE
)

Arguments

n

sample size in the active treatment group.

n0

sample size in the placebo group.

TTE_A

event rates per year in the active group for the time-to-event outcomes.

TTE_P

event rates per year in the placebo group for the time-to-event outcomes. Should have the same length as TTE_A.

CM_A

mean value for the continuous outcome of the active group.

CM_P

mean value for the continuous outcome of the placebo group.

CSD_A

standard deviation for the continuous outcome of the active group.

CSD_P

standard deviation for the continuous outcome of the placebo group.

fixedfy

length of follow-up in years.

yeardays

number of days in a year.

pat

scale of provided event rates (per pat-years).

shape

shape of the Weibull distribution for time-to-event outcomes. Default is exponential distribution with shape = 1.

theta

Gumbel dependence coefficient of the Weibull distributions for time-to-event outcomes. Default is theta = 1 which assumes independence of time-to-event outcomes. Must be above or equal to 1.

logC

logical, whether to use log-normal distribution for the continuous outcome.

seed

for generating random numbers.

dec

decimal places for the continuous outcome used for rounding. The default is dec = 2.

all_data

logical, whether to return source datasets ADET (an event-time dataset for all time-to-event outcomes per patient) and BDS (a basic data structure for the continuous outcome for all patients).

Value

an object of class hce containing the following columns:

If all_data = TRUE, the function returns a list containing the hce dataset, along with its source datasets: ADET (an event-time dataset for all time-to-event outcomes per patient) and BDS (a basic data structure for the continuous outcome for all patients).

See Also

hce(), as_hce() for the helper a coerce function to hce objects.

Examples

# Example 1
Rates_A <- c(1.72, 1.74, 0.58, 1.5, 1)
Rates_P <- c(2.47, 2.24, 2.9, 4, 6)
dat <- simHCE(n = 2500, TTE_A = Rates_A, TTE_P = Rates_P,
              CM_A = -3, CM_P = -6, CSD_A = 16, CSD_P = 15, fixedfy = 3)
head(dat)

# Example 2
Rates_A <- 10
Rates_P <- 15
dat <- simHCE(n = 1000, n0 = 500, TTE_A = Rates_A, TTE_P = Rates_P, 
              CM_A = 0.1, CM_P = 0, seed = 5, shape = 0.2, logC = TRUE, dec = 0)
summaryWO(dat)

# Example 3: Comparison of dependent and independent outcomes
Rates_A <- c(10, 20)
Rates_P <- c(20, 20)
dat1 <- simHCE(n = 2500, TTE_A = Rates_A, TTE_P = Rates_P, 
CM_A = -3, CM_P = -6, CSD_A = 15, fixedfy = 3, theta = 1, seed = 1)
dat2 <- simHCE(n = 2500, TTE_A = Rates_A, TTE_P = Rates_P, 
CM_A = -3, CM_P = -6, CSD_A = 15, fixedfy = 3, theta = 1.0001, seed = 1)
calcWO(dat1)
calcWO(dat2)

Simulate a kidney disease hce dataset

Description

Simulate a kidney disease hce dataset, capturing eGFR (Estimated Glomerular Filtration Rate) progression over time, along with a competing and dependent terminal event: KFRT (Kidney Failure Replacement Therapy)

Usage

simKHCE(
  n,
  CM_A,
  CM_P = -4,
  n0 = n,
  TTE_A = 10,
  TTE_P = TTE_A,
  fixedfy = 2,
  Emin = 20,
  Emax = 100,
  sigma = 8,
  Sigma = 3,
  m = 10,
  theta = -0.23,
  phi = 0
)

Arguments

n

sample size in the active treatment group.

CM_A

annualized eGFR slope in the active group.

CM_P

annualized eGFR slope in the control group.

n0

sample size in the control treatment group.

TTE_A

event rate per year in the active group for KFRT.

TTE_P

event rate per year in the placebo group for KFRT.

fixedfy

length of follow-up in years.

Emin

lower limit of eGFR at baseline.

Emax

upper limit of eGFR at baseline.

sigma

within-patient standard deviation.

Sigma

between-patient standard deviation.

m

number of equidistant visits.

theta

coefficient of dependence of eGFR values and the risk of KFRT.

phi

coefficient of proportionality (between 0 and 1) of the treatment effect. The case of 0 corresponds to the uniform treatment effect.

Value

a list containing the dataset GFR for longitudinal measurements of eGFR and the competing KFRT events, the dataset ADET for the time-to-event kidney outcomes (sustained declines or sustained low levels of eGFR), and the combined HCE dataset for the kidney hierarhical composite endpoint.

See Also

simHCE() for a general function of simulating hce datasets.

Examples

# Example 1
set.seed(2022)
L <- simKHCE(n = 1000, CM_A = -3.25)
dat <- L$HCE
calcWO(dat)

Simulate ordinal variables for two treatment groups using categorization of beta distributions

Description

Simulate ordinal variables for two treatment groups using categorization of beta distributions

Usage

simORD(n, n0 = n, M, alpha1 = 8, beta1 = 7, alpha0 = 5, beta0 = 5)

Arguments

n

sample size in the active treatment group.

n0

sample size in the placebo group.

M

number of ordinal values to be simulated.

alpha1

shape1 parameter for the beta distribution in the active group.

beta1

shape2 parameter for the beta distribution in the active group.

alpha0

shape1 parameter for the beta distribution in the placebo group.

beta0

shape2 parameter for the beta distribution in the placebo group.

Value

a data frame containing the following columns:

See Also

simHCE() for simulating hce objects.

Examples

# Example 1
set.seed(2024)
alpha1 <- 8
beta1 <- 8
alpha0 <- 4
beta0 <- 5
d <- simORD(n = 1500, n0 = 1500, M = 5, alpha1 = alpha1, beta1 = beta1, 
alpha0 = alpha0, beta0 = beta0)
x <- seq(0, 1, 0.01)
plot(x, dbeta(x, shape1 = alpha1, shape2 = beta1), 
type = "l", ylab = "Density of beta distribution", col = 2)
lines(x, dbeta(x, shape1 = alpha0, shape2 = beta0), col = 3, lty = 2)
legend("topleft", lty = c(1, 2), col = c(2, 3), legend = c("Control", "Active"))
D <- hce(GROUP = d$GROUPN, TRTP = d$TRTP)
table(D$TRTP, D$GROUPN)
calcWO(D)
# Example 2
set.seed(2024)
d <- simORD(n = 100, n0 = 50, M = 2)
d_hce <- hce(GROUP = d$GROUPN, TRTP = d$TRTP)
calcWO(d_hce)
### compare with the theoretical values of the continuous distributions 
c(tau = unique(d$tau), theta = unique(d$theta))
# Example 2 - Convergence of the win odds to its theoretical value
set.seed(2024)
N <- NULL
size <- c(seq(10, 500, 1))
for(i in size){
  d <- simORD(n = i, M = 2)
  d_hce <- hce(GROUP = d$GROUPN, TRTP = d$TRTP)
  TAU <- calcWO(d_hce)
  D <- data.frame(WO = TAU$WO, n = i, tau = unique(d$tau))
  N <- rbind(N, D)
}
plot(N$n, N$WO, log = "y", ylim = c(0.5, 2), ylab = "Win Odds", xlab = "Sample size", type = "l")
lines(N$n, N$tau, col = "darkgreen", lty = 2, lwd = 2)
abline(h = 1, lty = 4, col = "red")
legend("bottomright", legend = c("Theoretical Win Odds", "Null", "Win Odds Estimate"), 
lty = c(4, 2, 1), col = c("darkgreen", "red", "black"))
title("Convergence of the win odds to its theoretical value")

Sample size calculation for the win odds test (no ties)

Description

Sample size calculation for the win odds test (no ties)

Usage

sizeWO(
  WO,
  power,
  SD = NULL,
  k = 0.5,
  alpha = 0.05,
  WOnull = 1,
  alternative = c("shift", "max", "ordered")
)

Arguments

WO

a numeric vector of win odds values.

power

the given power. A numeric vector of length 1.

SD

assumed standard deviation of the win proportion. By default uses the conservative SD. A numeric vector of length 1.

k

proportion of active group in the overall sample size. Default is 0.5 (balanced randomization). A numeric vector of length 1.

alpha

the significance level for the 2-sided test. Default is 0.05. A numeric vector of length 1.

WOnull

the win odds value of the null hypothesis (default is 1). A numeric vector of length 1.

alternative

a character string specifying the class of the alternative hypothesis, must be one of "shift" (default), "max" or "ordered". You can specify just the initial letter.

Details

alternative = "max" refers to the maximum variance of the win proportion across all possible alternatives. The maximum variance equals WP*(1 - WP)/k where the win probability is calculated as ⁠WP = WO/(WO + 1).⁠ alternative = "shift" specifies the variance across alternatives from a shifted family of distributions (Wilcoxon test). The variance formula, as suggested by Noether, is calculated based on the null hypothesis as follows ⁠1/(12*k*(1 - k)).⁠ alternative = "ordered" specifies the variance across alternatives from stochastically ordered distributions which include shifted distributions.

Value

a data frame containing the sample size with input values.

References

See Also

powerWO(), minWO() for WO power or minimum detectable WO calculation.

Examples

sizeWO(WO = 1.25, power = 0.9)
sizeWO(WO = 1.25, power = 0.9, k = 0.75)
sizeWO(WO = seq(1.05, 1.5, 0.05), power = 0.9)
# Comparison of different alternatives
x <- seq(1.05, 5, 0.05)
N1 <- sizeWO(WO = x, power = 0.9, alternative = "m")$SampleSize
N2 <- sizeWO(WO = x, power = 0.9, alternative = "o")$SampleSize
N3 <- sizeWO(WO = x, power = 0.9, alternative = "s")$SampleSize
d <- data.frame(WO = x, N_m = N1, N_o = N2, N_s = N3)
## Check the power for the ordered alternative
check <- c()
for(i in seq_along(x)){
check[i] <- powerWO(N = d[i, "N_o"], WO = d[i, "WO"], alternative = "o")$power
}
d$power_check_o <- check
print(d)

Sample size calculation for the win ratio test (with WR = 1 null hypothesis)

Description

Sample size calculation for the win ratio test (with WR = 1 null hypothesis)

Usage

sizeWR(WR, power, WO = NULL, Pties = NULL, k = 0.5, alpha = 0.05)

Arguments

WR

a numeric vector of win odds values.

power

the given power. A numeric vector of length 1.

WO

win odds. Should be specified only if Pties is not specified. A numeric vector of length 1.

Pties

probability of ties. A numeric vector of length 1.

k

proportion of active group in the overall sample size. Default is 0.5 (balanced randomization). A numeric vector of length 1.

alpha

the significance level for the 2-sided test. Default is 0.05. A numeric vector of length 1.

Value

a data frame containing the sample size with input values.

References

Yu RX, Ganju J. (2022) "Sample size formula for a win ratio endpoint." Statistics in Medicine, 41.6: 950-63. doi:10.1002/sim.9297.

See Also

sizeWO() for WO sample size calculation.

Examples

sizeWR(WR = 1.35, Pties = 0.125, power = 0.8)
sizeWR(WR = 1.35, WO = 1.3, power = seq(0.5, 0.9, 0.05))

A generic function for stratified win odds with adjustment

Description

A generic function for stratified win odds with adjustment

Usage

stratWO(x, ...)

Arguments

x

an object used to select a method.

...

further arguments passed to or from other methods.

Value

a list containing the stratified results and results by strata.

See Also

stratWO.data.frame() methods.


Stratified win odds with adjustment

Description

Stratified win odds with adjustment

Usage

## S3 method for class 'data.frame'
stratWO(
  x,
  AVAL,
  TRTP,
  STRATA,
  ref,
  COVAR = NULL,
  alpha = 0.05,
  WOnull = 1,
  ...
)

Arguments

x

a data frame containing subject-level data.

AVAL

variable in the data with ordinal analysis values.

TRTP

the treatment variable in the data.

STRATA

a character variable for stratification.

ref

the reference treatment group.

COVAR

a numeric covariate.

alpha

the reference treatment group.

WOnull

the null hypothesis. The default is 1.

...

additional parameters.

Value

a data frame containing the following columns:

References

Gasparyan SB et al. (2021) "Adjusted win ratio with stratification: calculation methods and interpretation." Statistical Methods in Medical Research 30.2: 580-611. doi:10.1177/0962280220942558.

See Also

stratWO().

Examples

# Stratified win odds
res <- stratWO(x = KHCE, AVAL = "AVAL", TRTP = "TRTP", 
               STRATA = "STRATAN", ref = "P")
res
## Compare with the non-stratified win odds
res0 <- calcWO(AVAL ~ TRTP, data = KHCE,  ref = "P")
res0
## Compare with the win odds in each stratum separately
l <- lapply(split(KHCE, KHCE$STRATAN), calcWO, AVAL = "AVAL", TRTP = "TRTP", ref = "P")
l <- do.call(rbind, l)
l <- l[, c("WO", "LCL", "UCL", "N")]
l$STRATA <- as.numeric(row.names(l))
plot(y = l$WO, x = l$STRATA, ylim = c(0.5, 2.5), log = "y", xlim = c(0, 6),
      ylab = "Win Odds", xlab = "", xaxt = "n")
axis(1, at = 1:6, labels = c(paste0("STR = ", l$STRATA), "Stratified", "Non-stratified"))
arrows(l$STRATA, l$LCL, l$STRATA, 
       l$UCL, angle = 90, code = 3, length = 0.05, col = "darkgreen")
points(5, res$WO)
arrows(5, res$LCL, 5, res$UCL, angle = 90, code = 3, 
       length = 0.05, col = "darkblue")
abline(h = c(1, res$WO), col = "red", lty = 4)
points(6, res0$WO)
arrows(6, res0$LCL, 6, res0$UCL, angle = 90, code = 3, 
       length = 0.05, col = "darkred")
# Stratified and adjusted win odds
res <- stratWO(x = KHCE, AVAL = "AVAL", COVAR = "EGFRBL", 
              TRTP = "TRTP", STRATA = "STRATAN", ref = "P")
res


A generic function for summarizing win odds

Description

A generic function for summarizing win odds

Usage

summaryWO(x, ...)

Arguments

x

an object used to select a method.

...

further arguments passed to or from other methods.

Value

a data frame containing calculated values.

See Also

summaryWO.hce(), summaryWO.formula(), summaryWO.data.frame() methods.


Win odds summary for a data frame

Description

Win odds summary for a data frame

Usage

## S3 method for class 'data.frame'
summaryWO(x, AVAL, TRTP, ref, GROUP = NULL, ...)

Arguments

x

a data frame containing subject-level data.

AVAL

variable in the data with ordinal analysis values.

TRTP

the treatment variable in the data.

ref

the reference treatment group.

GROUP

an optional variable for grouping.

...

additional parameters.

Value

a list containing the summary of wins, losses, and ties. It contains the following named objects:

See Also

calcWO(), summaryWO(), summaryWO.formula(), summaryWO.hce() methods.

Examples

summaryWO(x = HCE3, AVAL = "AVAL", TRTP = "TRTP", ref = "P", GROUP = "GROUP")

Win odds summary using formula syntax

Description

Win odds summary using formula syntax

Usage

## S3 method for class 'formula'
summaryWO(x, data, ...)

Arguments

x

an object of class formula.

data

a data frame.

...

additional parameters.

Value

a list containing the summary of wins, losses, and ties. It contains the following named objects:

See Also

calcWO(), summaryWO(), summaryWO.data.frame(), summaryWO.hce() methods.

Examples

summaryWO(data = COVID19, GROUP ~ TRTP)
summaryWO(data = COVID19, GROUP ~ TRTP, GROUP = "GROUP", ref = "Placebo")

Win odds summary for hce objects

Description

Win odds summary for hce objects

Usage

## S3 method for class 'hce'
summaryWO(x, ...)

Arguments

x

an hce object.

...

additional parameters.

Value

a list containing the summary of wins, losses, and ties. It contains the following named objects:

See Also

calcWO(), summaryWO(), summaryWO.data.frame(), summaryWO.formula() methods.

Examples

dat <- as_hce(HCE4)
summaryWO(dat, ref = "P")