Learn R Programming

mtrank (version 0.2-0)

pp2long: Auxiliary function to transform data from paired-preference to long-arm format

Description

Auxiliary function to transform data from paired-preference to long-arm format

Usage

pp2long(x)

Value

Data set in long-arm format that can be used as input to rankings.

Arguments

x

An object of class "ppdata" (part of tcc object).

See Also

tcc, rankings

Examples

Run this code
data(diabetes)
#
pw <- pairwise(studlab = study, treat = t,
  n = n, event = r, data = diabetes, sm = "OR")
# Use subset to reduce runtime
pw1 <- subset(pw, id >= 6 & id <= 10)
net1 <- netmeta(pw1, reference.group = "PLA")
#
ranks1 <- tcc(net1, swd = 1.20, small.values = "desirable")
#
pdat1 <- ranks1$ppdata
#
ldat1 <- pp2long(pdat1)
head(ldat1)

# \donttest{
net <- netmeta(pw, reference.group = "PLA")
#
ranks <- tcc(net, swd = 1.20, small.values = "desirable")
#
pdat <- ranks$ppdata
#
ldat <- pp2long(pdat)
head(ldat)

library("PlackettLuce")
preferences <- rankings(ldat, id = "id", item = "treat", rank = "rank")
#
fit <- PlackettLuce(preferences)
#
coef(summary(fit, ref = ranks$reference.group))[, 1]
# Results stored in mtrank()
mtrank(ranks)$estimates$log_ability
# }

Run the code above in your browser using DataLab