Learn R Programming

hce (version 0.7.0)

IWP: Calculates patient-level individual win proportions

Description

Calculates patient-level individual win proportions

Usage

IWP(data, AVAL, TRTP, ref)

Value

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

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.

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

Run this code
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")]

Run the code above in your browser using DataLab