| Title: | Interactive Stability Analysis of Multi-Environment Trials |
|---|---|
| Description: | A 'shiny' application for the stability analysis of multi-environment trials of plant breeding with the package 'stability': analyses of variance, Eberhart and Russell's and Finlay and Wilkinson's regression, Wricke's, Shukla's, Kang's and Fox's statistics, Eskridge's safety-first indices, Annicchiarico's, Lin and Binns' and Huehn's statistics, AMMI analysis and stability values, and the GGE biplot. Every analysis comes with its tables, plots, the R code that repeats it and an interpretation specific to the method, computed from the results; an optional longer written interpretation can be requested from an external text service with the user's own key. |
| Authors: | Muhammad Yaseen [aut, cre, cph] (ORCID: <https://orcid.org/0000-0002-5923-1714>), Kent Eskridge [aut, ctb] |
| Maintainer: | Muhammad Yaseen <[email protected]> |
| License: | GPL-3 |
| Version: | 1.0.0 |
| Built: | 2026-11-10 05:48:35 UTC |
| Source: | https://github.com/myaseen208/stabilityapp |
sa_prompt() builds the text sent to an external text service (sa_ask()) for a written
interpretation of one result of the package stability. It is specific to the method: it contains how the
statistics of that method are read, what to concentrate on, the interpretation computed by
stability::stab_interpret() (to be kept to), the facts behind it and the first rows of the main table.
sa_prompt(x, higher_better = TRUE, trait = NULL, rows = 15L)sa_prompt(x, higher_better = TRUE, trait = NULL, rows = 15L)
x |
a result of a function of stability (or the |
higher_better |
|
trait |
name of the trait (default: the response of the analysis). |
rows |
number of rows of the main table included (default |
The text has two parts: system (the role and the rules: use only the numbers given, keep to the computed
findings, name genotypes and environments as given, say when something cannot be concluded) and user (the
material and the task: four sections, Statistical interpretation, Key agronomic findings, Recommendations and
Next steps, at most about 350 words). Because the computed findings are part of the request, the written text
cannot contradict the tests and rankings of the analysis without contradicting its own material, which the rules
forbid.
A list with system and user (character strings) and interpretation (the result of
stability::stab_interpret()).
Muhammad Yaseen ([email protected])
fit <- stability::ammi( .data = stability::ge_data , .y = Yield , .rep = Rep , .gen = Gen , .env = Env ) p <- sa_prompt( x = fit , higher_better = TRUE , trait = "grain yield (kg/ha)" , rows = 15 ) cat(p$user)fit <- stability::ammi( .data = stability::ge_data , .y = Yield , .rep = Rep , .gen = Gen , .env = Env ) p <- sa_prompt( x = fit , higher_better = TRUE , trait = "grain yield (kg/ha)" , rows = 15 ) cat(p$user)
sa_services() lists the external text services the application can ask for a longer written
interpretation, and sa_ask() sends one request to such a service and returns its text. Using a service is
optional: the application always shows the interpretation of stability::stab_interpret(), which is
computed from the results and needs no connection.
sa_services() sa_ask( service, prompt, model = NULL, key = "", max_tokens = 1500, timeout = 90 )sa_services() sa_ask( service, prompt, model = NULL, key = "", max_tokens = 1500, timeout = 90 )
service |
identifier of a service (column |
prompt |
a list with elements |
model |
model name (default: the one of |
key |
the user's key for the service; |
max_tokens |
largest length of the answer, in tokens (default |
timeout |
seconds to wait (default |
The services are read from the file services.csv of the package (columns id, label,
format, url, model, key_env, and header, an extra header name=value).
Three request formats are supported:
"messages", "chat" and "generate", the formats of the three services in the file. The key is
taken from the argument key or, when it is empty, from the environment variable named in key_env,
so that it need not be typed into the application. The request is sent over HTTPS to the service's own address;
the key is never stored by the package.
What is sent is the text built by sa_prompt(): the name of the analysis, the trait, the size of the
trial, the interpretation of stab_interpret(), its facts and the first rows of the main table. No data file
is sent.
sa_services(): a data frame of the services. sa_ask(): the text of the answer (character),
or an error with the message of the service.
Muhammad Yaseen ([email protected])
sa_services()[, c("id", "format", "model")] ## Not run: fit <- stability::stab_reg( .data = stability::ge_data , .y = Yield , .rep = Rep , .gen = Gen , .env = Env ) p <- sa_prompt( x = fit , higher_better = TRUE , trait = NULL , rows = 15L ) sa_ask( service = sa_services()$id[1] , prompt = p , model = sa_services()$model[1] , key = "" , max_tokens = 1500 , timeout = 90 ) ## End(Not run)sa_services()[, c("id", "format", "model")] ## Not run: fit <- stability::stab_reg( .data = stability::ge_data , .y = Yield , .rep = Rep , .gen = Gen , .env = Env ) p <- sa_prompt( x = fit , higher_better = TRUE , trait = NULL , rows = 15L ) sa_ask( service = sa_services()$id[1] , prompt = p , model = sa_services()$model[1] , key = "" , max_tokens = 1500 , timeout = 90 ) ## End(Not run)
StabilityApp() starts the application: load a trial (the example ge_data of stability or a CSV
file with one row per plot), choose the columns, and run any of the twenty analyses of stability. Each
analysis shows an interpretation written for its method and computed from its results
(stability::stab_interpret()), its tables (with CSV and Excel export), its plots (PNG and PDF), and the R
code that repeats it. A longer written interpretation can be requested from an external text service with your
own key (sa_services(); optional).
StabilityApp(launch.browser = interactive(), ...) sa_app()StabilityApp(launch.browser = interactive(), ...) sa_app()
launch.browser |
passed to |
... |
further arguments to |
The analyses: means and rankings, interaction effects; analysis of variance in each environment, combined, and Eberhart and Russell's; Finlay and Wilkinson's regression, variance measures, Shukla's stability variance with Kang's yield-stability statistic, Kang's rank-sum, Fox's top third; AMMI analysis, AMMI biplots, AMMI stability value, modified AMMI stability value, AMMI stability distance; GGE biplot (which won where, mean against stability, discrimination).
The key of a text service is typed on the Settings page (it stays in the session and is not saved) or read from
the environment variable named in sa_services().
Called for its side effect; returns the value of shiny::runApp() when the application is closed.
sa_app() returns the application object (for shiny::runApp(), shiny::testServer() or
deployment). The installed folder system.file("shinyapp", package = "StabilityApp") holds an
app.R for rsconnect::deployApp().
Muhammad Yaseen ([email protected]), Kent M. Eskridge ([email protected])
if (interactive()) { StabilityApp( launch.browser = TRUE ) }if (interactive()) { StabilityApp( launch.browser = TRUE ) }