## ----setup, include = FALSE---------------------------------------------------
knitr::opts_chunk$set(collapse = FALSE, comment = "", fig.width = 7, fig.height = 4.6,
                      dev = if (knitr::is_latex_output()) "cairo_pdf" else
                        if (requireNamespace("svglite", quietly = TRUE)) "svglite" else "png")
if (requireNamespace("stability", quietly = TRUE)) library(stability) else
  pkgload::load_all(export_all = FALSE, helpers = FALSE, quiet = TRUE)


## ----blocks-------------------------------------------------------------------
cd <- stability:::.stab_ge_data(
    y    = ge_data$Yield
  , gen  = ge_data$Gen
  , env  = ge_data$Env
  , rep  = ge_data$Rep
  , fn   = "example"
  )
names(cd)
round(x = cd$M[1:3, 1:4])
cd$anova


## ----example------------------------------------------------------------------
Z <- stability:::.stab_ge_effects(cd$M)
I <- colMeans(cd$M) - mean(cd$M)
head(x = sort(drop(Z %*% I) / sum(I^2)), n = 5)

