## ----setup, include = FALSE---------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

## -----------------------------------------------------------------------------
library(cccrm)
bp <- bpres[, c("ID", "SIS", "METODE", "NM", "EDAD", "SEXO")]
colnames(bp) <- c("id", "sys", "met", "rep", "age", "sex")
bp[, c("id", "met", "rep", "sex")] <- lapply(bp[, c("id", "met", "rep", "sex")], as.factor)

## -----------------------------------------------------------------------------
bp <- bp[!bp$id %in% c(24, 199, 226), ]
bp$id <- droplevels(bp$id)

## -----------------------------------------------------------------------------
set.seed(17)
library(TDIagree)
x <- TDI(bp, sys, id, met, rep)

## -----------------------------------------------------------------------------
x$result

## -----------------------------------------------------------------------------
x$fitted.models

## -----------------------------------------------------------------------------
x$params

## -----------------------------------------------------------------------------
head(x$data.long)

## -----------------------------------------------------------------------------
head(x$data.wide)

## -----------------------------------------------------------------------------
x <- TDI(bp, sys, id, met, rep, method = c("es", "choudhary np"))
x

## -----------------------------------------------------------------------------
x <- TDI(bp, sys, id, met, rep, method = c("es", "choudhary np"),
         p = c(0.85, 0.90, 0.95))
x

## -----------------------------------------------------------------------------
x <- TDI(bp, sys, id, met, rep,
         p = c(0.85, 0.90, 0.95),
         ub = FALSE)
x

## -----------------------------------------------------------------------------
x <- TDI(bp, sys, id, met, rep, method = c("es", "choudhary np"),
         p = c(0.85, 0.90, 0.95), alpha = 0.1)
x

## -----------------------------------------------------------------------------
x <- TDI(bp, sys, id, met, rep, method = c("es", "choudhary np"),
         p = c(0.85, 0.90, 0.95), dec.p = 3, dec.est = 2)
x

## -----------------------------------------------------------------------------
x <- TDI(bp, sys, id, met, rep, method = "choudhary p")
x

## -----------------------------------------------------------------------------
x$fitted.models

## -----------------------------------------------------------------------------
x <- TDI(bp, sys, id, met, rep, method = "choudhary p", 
         choose.model.ch.p = FALSE, var.equal = FALSE)
x

## -----------------------------------------------------------------------------
x$fitted.models

## -----------------------------------------------------------------------------
x <- TDI(bp, sys, id, met, rep, method = "es")
x

## -----------------------------------------------------------------------------
x$fitted.models

## -----------------------------------------------------------------------------
x <- TDI(bp, sys, id, met, rep, method = "es",
         choose.model.es = FALSE, int = TRUE)
x

## -----------------------------------------------------------------------------
x$fitted.models

## -----------------------------------------------------------------------------
x <- TDI(bp, sys, id, met, rep, method = "es",
         tol = 10^(-7), add.es = c(sex, age))
x

## -----------------------------------------------------------------------------
x$fitted.models

## -----------------------------------------------------------------------------
x <- TDI(bp, sys, id, met, rep, method = "choudhary np")
x

## -----------------------------------------------------------------------------
x <- TDI(bp, sys, id, met, rep, method = "pe")
x

## -----------------------------------------------------------------------------
x <- TDI(bp, sys, id, met, rep, method = "pe",
         boot.type = "cl", R = 1000)
x

