The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.

Extending the package

Muhammad Yaseen

2026-11-05

1 Abstract

How a new stability statistic is added so that it fits the package: a core, an exported function, a result with methods, an interpretation, a help page and tests.

2 The building 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)
 [1] "M"        "N"        "G"        "E"        "R"        "anova"   
 [7] "mse"      "df_e"     "plots"    "balanced"
round(x = cd$M[1:3, 1:4])
          FSD FSDR Okara Sargodha
013BT034 4816 4524  4048     4508
122557   4880 4156  2984     4754
122559   4135 4136  4377     4688
cd$anova
Analysis of Variance Table

Response: y

           Df    Sum Sq  Mean Sq F value    Pr(>F)    
Env        10 263940496 26394050 68.0551 1.995e-08 ***
Rep(Env)   11   4266167   387833                      
Gen        59  71662431  1214617 12.2482 < 2.2e-16 ***
Gen:Env   590 201336476   341248  3.4411 < 2.2e-16 ***
Residuals 649  64359568    99167                      
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

.stab_ge_data() gives the table of means, the counts, the combined analysis of variance and the pooled error; .stab_ge_effects() and .stab_svd() the interaction and its decomposition.

3 A new statistic: the coefficient of regression of the interaction

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)
 BARDC1016     SD1013   SRN13121     V12066      NR448 
-0.9123774 -0.6699113 -0.5134928 -0.4286048 -0.4176358 

As an exported function it would check its arguments, wrap the result with .stab_out() (class, label, plot data), define .stab_print_<name>(), .stab_plot_<name>() and an interpreter .stab_int_<name>() with its guide, and come with tests against an independent computation.

4 Summary

Every analysis follows one pattern; a new one reuses the table of means, the error, the result class, the plot theme, the interpretation and the test helpers.

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.