## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.width = 6,
  fig.height = 5
)

## ----setup--------------------------------------------------------------------
library(simplexgof)

## -----------------------------------------------------------------------------
data(pbsc)
head(pbsc)
summary(pbsc)

## ----fig.alt = "Diagnostic plots for the PBSC application"--------------------
res <- paper_pbsc(B = 50, seed = 456, plot = TRUE, verbose = FALSE)

## -----------------------------------------------------------------------------
print(res$table_params, row.names = FALSE)

## -----------------------------------------------------------------------------
print(res$table_gof, row.names = FALSE)

## -----------------------------------------------------------------------------
X <- cbind(1, pbsc$adj_age, pbsc$chemo)
colnames(X) <- c("(Intercept)", "adj_age", "chemo")
Z <- matrix(1, nrow(pbsc), 1)
colnames(Z) <- "(Intercept)"

fit <- simplex_fit(pbsc$recovery, X, Z)
fit

dg <- simplex_diag(fit)
dg$Tn
dg$Un

## ----fig.alt = "Influence index plot for the PBSC model"----------------------
plot_influence(dg)

## -----------------------------------------------------------------------------
set.seed(456)
gof <- simplex_gof(pbsc$recovery, X, Z, B = 50, verbose = FALSE)
gof

## ----fig.alt = "Bootstrap distribution of Un for the PBSC application"--------
plot_gof_boot(gof)

