Skip to content

Commit b6a5e88

Browse files
committed
2 parents 01f2ca9 + 0d58034 commit b6a5e88

4 files changed

Lines changed: 17 additions & 9 deletions

File tree

R/table_stability.R

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,21 @@ table_stability <- function(data, trait, genotype, environment, lambda, normaliz
108108
stop("Environment number must above 3")
109109
} else if (sample_number <= 5000 & sample_number >= 3) {
110110
normtest <- function(x){
111-
return(shapiro.test(x)$p.value > 0.05)
111+
res.ntest <- tryCatch({shapiro.test(x)},
112+
error=function(cond){
113+
return(list(p.value=0.01))
114+
})
115+
return(res.ntest$p.value > 0.05)
112116
}
113117
norm.test.name <- "Shapiro"
114118
} else if (sample_number > 5000) {
119+
115120
normtest <- function(x){
116-
return(ad.test(x)$p.value > 0.05)
121+
res.ntest <- tryCatch({ad.test(x)},
122+
error=function(cond){
123+
return(list(p.value=0.01))
124+
})
125+
return(res.ntest$p.value > 0.05)
117126
}
118127
norm.test.name <- "Anderson-Darling"
119128
}
@@ -209,7 +218,7 @@ table_stability <- function(data, trait, genotype, environment, lambda, normaliz
209218
"Variance.of.rank",
210219
"Deviation.mean.squares",
211220
"Genotypic.superiority.measure"
212-
)
221+
)
213222
if (unit.correct==TRUE){
214223
res <- mutate_at(res,need.squared.si, sqrt)
215224
}

inst/CITATION

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
citHeader("To cite the R package 'toolStability' in publications use:")
2-
3-
citFooter("Wang, TC., Casadebaig, P. & Chen, TW. More than 1000 genotypes are required to derive robust relationships between yield, yield stability and physiological parameters: a computational study on wheat crop. Theor Appl Genet 136, 34 (2023). https://doi.org/10.1007/s00122-023-04264-7")
1+
"To cite the R package 'toolStability' in publications use:
2+
Wang, TC., Casadebaig, P. & Chen, TW. More than 1000 genotypes are required to derive robust relationships between yield, yield stability and physiological parameters: a computational study on wheat crop. Theor Appl Genet 136, 34 (2023). https://doi.org/10.1007/s00122-023-04264-7"

man/toolStability-package.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vignettes/toolStability.Rmd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,10 +335,10 @@ Ecovalence [@wricke1962] is calculated based on square and sum up the genotype
335335
interaction all over the environment.
336336
Variety with low ecovalence is considered as stable.
337337
Ecovalence is expressed as:
338-
$$W_{i} = \sum_{j}~(X_{ij} - \bar{X_{i.}} - \bar{X_{.j}} + \bar{X_{..}}^{2})$$
338+
$$W_{i} = \sum_{j}~(X_{ij} - \bar{X_{i.}} - \bar{X_{.j}} + \bar{X_{..}})^{2}$$
339339
To let $W_{i}$ comparable between experiments, we also provide the modified ecovalence ($W_{i}'$), whcih take the number of environments into account. User can get ($W_{i}'$) by setting `modify = TRUE`.
340340

341-
$$W_{i}' = \frac{\sum_{j}~(X_{ij} - \bar{X_{i.}} - \bar{X_{.j}} + \bar{X_{..}}^{2})}{E-1}$$
341+
$$W_{i}' = \frac{\sum_{j}~(X_{ij} - \bar{X_{i.}} - \bar{X_{.j}} + \bar{X_{..}})^{2}}{E-1}$$
342342
where $X_{ij}$ is the observed phenotypic mean value of genotype $i$ (i = 1,..., G)
343343
in environment $j$ (j = 1,...,E), with $\bar{X_{i.}}$ denoting marginal means of genotype $i$.
344344

0 commit comments

Comments
 (0)