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

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

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

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

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

## -----------------------------------------------------------------------------
data(ammonia)

X <- cbind(1, ammonia$corr_ar, ammonia$temp_agua,
           ammonia$corr_ar * ammonia$temp_agua)
Z <- cbind(1, ammonia$temp_agua,
           ammonia$corr_ar * ammonia$temp_agua)

fit <- simplex_fit(ammonia$perda, X, Z)
fit

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

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

## -----------------------------------------------------------------------------
set.seed(123)
gof <- simplex_gof(ammonia$perda, X, Z, B = 50, verbose = FALSE)
gof

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

