GithubHelp home page GithubHelp logo

tiagoolivoto / metan Goto Github PK

View Code? Open in Web Editor NEW
32.0 1.0 16.0 424.73 MB

Package for multi-environment trial analysis

Home Page: https://tiagoolivoto.github.io/metan/

License: GNU General Public License v3.0

R 96.48% TeX 3.52%
stability ammi ammi-model biplots gge rpgv hmrpgv waasb waas mtsi

metan's Introduction

metan

CRAN status Lifecycle: stable Total Downloads CRAN RStudio mirror downloads CRAN RStudio mirror downloads CRAN RStudio mirror downloads DOI

metan (multi-environment trials analysis) provides useful functions for analyzing multi-environment trial data using parametric and non-parametric methods. The package will help you to:

Installation

Install the released version of metan from CRAN with:

install.packages("metan")

Or install the development version from GitHub with:

devtools::install_github("TiagoOlivoto/metan")

# To build the HTML vignette use
devtools::install_github("TiagoOlivoto/metan", build_vignettes = TRUE)

Note: If you are a Windows user, you should also first download and install the latest version of Rtools.

For the latest release notes on this development version, see the NEWS file.

Cheatsheet

Getting started

metan offers a set of functions that can be used to manipulate, summarize, analyze and plot typical multi-environment trial data. Maybe, one of the first functions users should use would be inspect(). Here, we will inspect the example dataset data_ge that contains data on two variables assessed in 10 genotypes growing in 14 environments.

library(metan)
inspect(data_ge, plot = TRUE)
# # A tibble: 5 × 10
#   Variable Class   Missing Levels Valid_n   Min Median   Max Outlier Text 
#   <chr>    <chr>   <chr>   <chr>    <int> <dbl>  <dbl> <dbl>   <dbl> <lgl>
# 1 ENV      factor  No      14         420 NA     NA    NA         NA NA   
# 2 GEN      factor  No      10         420 NA     NA    NA         NA NA   
# 3 REP      factor  No      3          420 NA     NA    NA         NA NA   
# 4 GY       numeric No      -          420  0.67   2.61  5.09       0 NA   
# 5 HM       numeric No      -          420 38     48    58          0 NA

No issues while inspecting the data. If any issue is given here (like outliers, missing values, etc.) consider using find_outliers() to find possible outliers in the data set or any metan’s data manipulation tool such as remove_rows_na() to remove rows with NA values, replace_zero() to replace 0’s with NA, as_factor() to convert desired columns to factor, find_text_in_num() to find text fragments in columns assumed to be numeric, or even tidy_strings() to tidy up strings.

Descriptive statistics

metan provides a set of functions to compute descriptive statistics. The easiest way to do that is by using desc_stat().

desc_stat(data_ge2)
# # A tibble: 15 × 10
#    variable    cv     max    mean  median     min  sd.amo     se    ci.t n.valid
#    <chr>    <dbl>   <dbl>   <dbl>   <dbl>   <dbl>   <dbl>  <dbl>   <dbl>   <dbl>
#  1 CD        7.34  18.6    16.0    16      12.9    1.17   0.0939  0.186      156
#  2 CDED      5.71   0.694   0.586   0.588   0.495  0.0334 0.0027  0.0053     156
#  3 CL        7.95  34.7    29.0    28.7    23.5    2.31   0.185   0.365      156
#  4 CW       25.2   38.5    24.8    24.5    11.1    6.26   0.501   0.99       156
#  5 ED        5.58  54.9    49.5    49.9    43.5    2.76   0.221   0.437      156
#  6 EH       21.2    1.88    1.34    1.41    0.752  0.284  0.0228  0.045      156
#  7 EL        8.28  17.9    15.2    15.1    11.5    1.26   0.101   0.199      156
#  8 EP       10.5    0.660   0.537   0.544   0.386  0.0564 0.0045  0.0089     156
#  9 KW       18.9  251.    173.    175.    106.    32.8    2.62    5.18       156
# 10 NKE      14.2  697.    512.    509.    332.    72.6    5.82   11.5        156
# 11 NKR      10.7   42      32.2    32      23.2    3.47   0.277   0.548      156
# 12 NR       10.2   21.2    16.1    16      12.4    1.64   0.131   0.259      156
# 13 PERK      2.17  91.8    87.4    87.5    81.2    1.90   0.152   0.300      156
# 14 PH       13.4    3.04    2.48    2.52    1.71   0.334  0.0267  0.0528     156
# 15 TKW      13.9  452.    339.    342.    218.    47.1    3.77    7.44       156

AMMI model

Fitting the model

The AMMI model is fitted with the function performs_ammi(). To analyze multiple variables at once we can use a comma-separated vector of unquoted variable names, or use any select helper in the argument resp. Here, using everything() we apply the function to all numeric variables in the data. For more details, see the complete vignette.

model <- performs_ammi(data_ge,
                       env = ENV,
                       gen = GEN,
                       rep = REP,
                       resp = everything(),
                       verbose = FALSE)
# Significance of IPCAs
get_model_data(model, "ipca_pval")
# Class of the model: performs_ammi
# Variable extracted: Pr(>F)
# # A tibble: 9 × 4
#   PC       DF     GY     HM
#   <chr> <dbl>  <dbl>  <dbl>
# 1 PC1      21 0      0     
# 2 PC2      19 0      0     
# 3 PC3      17 0.0014 0.0021
# 4 PC4      15 0.0096 0.0218
# 5 PC5      13 0.318  0.0377
# 6 PC6      11 0.561  0.041 
# 7 PC7       9 0.754  0.0633
# 8 PC8       7 0.804  0.232 
# 9 PC9       5 0.934  0.944

Biplots

The well-known AMMI1 and AMMI2 biplots can be created with plot_scores(). Note that since performs_ammi allows analyzing multiple variables at once, e.g., resp = c(v1, v2, ...), the output model is a list, in this case with two elements (GY and HM). By default, the biplots are created for the first variable of the model. To choose another variable use the argument var (e.g., var = "HM").

a <- plot_scores(model)
b <- plot_scores(model,
                 type = 2, # AMMI 2 biplot
                 polygon = TRUE, # show a polygon
                 highlight = c("G4", "G5", "G6"), #highlight genotypes
                 col.alpha.env = 0.5, # alpha for environments
                 col.alpha.gen = 0, # remove the other genotypes
                 col.env = "gray", # color for environment point
                 col.segm.env = "gray", # color for environment segment
                 plot_theme = theme_metan_minimal()) # theme
arrange_ggplot(a, b, tag_levels = "a")

GGE model

The GGE model is fitted with the function gge(). For more details, see the complete vignette.

model <- gge(data_ge, ENV, GEN, GY)
model2 <- gge(data_ge, ENV, GEN, GY, svp = "genotype")
model3 <- gge(data_ge, ENV, GEN, GY, svp = "symmetrical")
a <- plot(model)
b <- plot(model2, type = 8)
c <- plot(model2,
          type = 2,
          col.gen = "black",
          col.env = "gray70",
          axis.expand = 1.5,
          plot_theme = theme_metan_minimal())
arrange_ggplot(a, b, c, tag_levels = "a")

BLUP model

Linear-mixed effect models to predict the response variable in METs are fitted using the function gamem_met(). Here we will obtain the predicted means for genotypes in the variables GY and HM. For more details, see the complete vignette.

model2 <- 
  gamem_met(data_ge,
            env = ENV,
            gen = GEN,
            rep = REP,
            resp = everything())
# Evaluating trait GY |======================                      | 50% 00:00:01 Evaluating trait HM |============================================| 100% 00:00:02 
# Method: REML/BLUP
# Random effects: GEN, GEN:ENV
# Fixed effects: ENV, REP(ENV)
# Denominador DF: Satterthwaite's method
# ---------------------------------------------------------------------------
# P-values for Likelihood Ratio Test of the analyzed traits
# ---------------------------------------------------------------------------
#     model       GY       HM
#  COMPLETE       NA       NA
#       GEN 1.11e-05 5.07e-03
#   GEN:ENV 2.15e-11 2.27e-15
# ---------------------------------------------------------------------------
# All variables with significant (p < 0.05) genotype-vs-environment interaction
# Get the variance components
get_model_data(model2, what = "vcomp")
# Class of the model: waasb
# Variable extracted: vcomp
# # A tibble: 3 × 3
#   Group        GY    HM
#   <chr>     <dbl> <dbl>
# 1 GEN      0.0280 0.490
# 2 GEN:ENV  0.0567 2.19 
# 3 Residual 0.0967 2.84

Plotting the BLUPs for genotypes

To produce a plot with the predicted means, use the function plot_blup().

a <- plot_blup(model2)
b <- plot_blup(model2,
               prob = 0.2,
               col.shape = c("gray20", "gray80"),
               invert = TRUE)
arrange_ggplot(a, b, tag_levels = "a")

Computing parametric and non-parametric stability indexes

The easiest way to compute parametric and non-parametric stability indexes in metan is by using the function ge_stats(). It is a wrapper function around a lot of specific functions for stability indexes. To get the results into a “ready-to-read” file, use get_model_data() or its shortcut gmd().

stats <- ge_stats(data_ge, ENV, GEN, REP, GY)
# Evaluating trait GY |============================================| 100% 00:00:08 
get_model_data(stats)
# Class of the model: ge_stats
# Variable extracted: stats
# # A tibble: 10 × 44
#    var   GEN       Y    CV   ACV   POLAR   Var Shukla  Wi_g  Wi_f  Wi_u Ecoval
#    <chr> <chr> <dbl> <dbl> <dbl>   <dbl> <dbl>  <dbl> <dbl> <dbl> <dbl>  <dbl>
#  1 GY    G1     2.60  35.2  34.1  0.0298 10.9  0.0280  84.4  89.2  81.1  1.22 
#  2 GY    G10    2.47  42.3  38.6  0.136  14.2  0.244   59.2  64.6  54.4  7.96 
#  3 GY    G2     2.74  34.0  35.2  0.0570 11.3  0.0861  82.8  95.3  75.6  3.03 
#  4 GY    G3     2.96  29.9  33.8  0.0216 10.1  0.0121 104.   99.7 107.   0.725
#  5 GY    G4     2.64  31.4  31.0 -0.0537  8.93 0.0640  85.9  79.5  91.9  2.34 
#  6 GY    G5     2.54  30.6  28.8 -0.119   7.82 0.0480  82.7  82.2  82.4  1.84 
#  7 GY    G6     2.53  29.7  27.8 -0.147   7.34 0.0468  83.0  83.7  81.8  1.81 
#  8 GY    G7     2.74  27.4  28.3 -0.133   7.33 0.122   83.9  77.6  93.4  4.16 
#  9 GY    G8     3.00  30.4  35.1  0.0531 10.8  0.0712  98.8  90.5 107.   2.57 
# 10 GY    G9     2.51  42.4  39.4  0.154  14.7  0.167   68.8  68.9  70.3  5.56 
# # … with 32 more variables: bij <dbl>, Sij <dbl>, R2 <dbl>, ASTAB <dbl>,
# #   ASI <dbl>, ASV <dbl>, AVAMGE <dbl>, DA <dbl>, DZ <dbl>, EV <dbl>, FA <dbl>,
# #   MASI <dbl>, MASV <dbl>, SIPC <dbl>, ZA <dbl>, WAAS <dbl>, WAASB <dbl>,
# #   HMGV <dbl>, RPGV <dbl>, HMRPGV <dbl>, Pi_a <dbl>, Pi_f <dbl>, Pi_u <dbl>,
# #   Gai <dbl>, S1 <dbl>, S2 <dbl>, S3 <dbl>, S6 <dbl>, N1 <dbl>, N2 <dbl>,
# #   N3 <dbl>, N4 <dbl>

Citation

citation("metan")

Please, support this project by citing it in your publications!

  Olivoto, T., and Lúcio, A.D. (2020). metan: an R package for
  multi-environment trial analysis. Methods Ecol Evol. 11:783-789
  doi:10.1111/2041-210X.13384

A BibTeX entry for LaTeX users is

  @Article{Olivoto2020,
    author = {Tiago Olivoto and Alessandro Dal'Col L{'{u}}cio},
    title = {metan: an R package for multi-environment trial analysis},
    journal = {Methods in Ecology and Evolution},
    volume = {11},
    number = {6},
    pages = {783-789},
    year = {2020},
    doi = {10.1111/2041-210X.13384},
  }

Getting help

  • If you encounter a clear bug, please file a minimal reproducible example on github

  • Suggestions and criticisms to improve the quality and usability of the package are welcome!

metan's People

Contributors

bartosz-kozak avatar olivroy avatar tiagoolivoto avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

metan's Issues

metan temporarily out of CRAN

I apologize for the inconvenience, but, metan has been removed from CRAN temporally because a check problem not fixed in time. Formerly available versions can be obtained from the archive.

A new patch release that fixes the problem was just submitted and is awaiting a manual inspection by a CRAN's team member.

You can download the latest version (v1.5.1) of metan from Gighub with

devtools::install_github("TiagoOlivoto/metan")

Shukla Stablility with wrong length of levels

Hi,
when calculating shukla stability using the Shukla() function, I ran into a problem where the results change depending on the subset of my data. I'm not sure if it's desired to take the initial number of levels from the data frame, as in line 55 with as.factor(), or if there's something wrong with using factor() instead to solve this problem?

mutate(across(everything(), as.factor))

Here is a reproducible example with the provided sample data:

out1 <- Shukla(data_ge2[data_ge2$ENV != "A1", ], #subsetting one environment
              env = ENV,
              gen = GEN,
              rep = REP,
              resp = PH)

data_ge3 <- data_ge2[data_ge2$ENV != "A1", ] #subsetting the same environment
data_ge3$ENV <- factor(data_ge3$ENV) #but relevel the factor

out2 <- Shukla(data_ge3,
               env = ENV,
               gen = GEN,
               rep = REP,
               resp = PH)
print(out1)
print(out2)

And here the results:

> print(out1)
Variable PH 
---------------------------------------------------------------------------
Shukla stability variance
---------------------------------------------------------------------------
# A tibble: 13 × 6
   GEN       Y ShuklaVar rMean rShukaVar ssiShukaVar
   <fct> <dbl>     <dbl> <dbl>     <dbl>       <dbl>
 1 H1     2.59  0.0383       1         7           8
 2 H10    2.16  0.0172      13         3          16
 3 H11    2.27  0.0230      10         4          14
 4 H12    2.35  0.0760       8        11          19
 5 H13    2.46  0.0845       7        13          20
 6 H2     2.54  0.0586       2         9          11
 7 H3     2.48  0.0820       5        12          17
 8 H4     2.48  0.0479       4         8          12
 9 H5     2.48  0.0159       6         2           8
10 H6     2.49  0.0352       3         6           9
11 H7     2.28  0.0258       9         5          14
12 H8     2.20  0.0607      11        10          21
13 H9     2.18 -0.000876    12         1          13

> print(out2)
Variable PH 
---------------------------------------------------------------------------
Shukla stability variance
---------------------------------------------------------------------------
# A tibble: 13 × 6
   GEN       Y ShuklaVar rMean rShukaVar ssiShukaVar
   <fct> <dbl>     <dbl> <dbl>     <dbl>       <dbl>
 1 H1     2.59   0.0574      1         7           8
 2 H10    2.16   0.0258     13         3          16
 3 H11    2.27   0.0345     10         4          14
 4 H12    2.35   0.114       8        11          19
 5 H13    2.46   0.127       7        13          20
 6 H2     2.54   0.0880      2         9          11
 7 H3     2.48   0.123       5        12          17
 8 H4     2.48   0.0719      4         8          12
 9 H5     2.48   0.0238      6         2           8
10 H6     2.49   0.0528      3         6           9
11 H7     2.28   0.0387      9         5          14
12 H8     2.20   0.0910     11        10          21
13 H9     2.18  -0.00131    12         1          13

Labels of plot_scores(AMMI_model, type = 2)

Congratulation for developing such a wonderful package.
I think I spotted a type in the labels of plot_scores(AMMI_model, type = 2). Both labels are PC1. I think x-axis label should be PC1 and y-axis label should be PC2.

library(metan)
AMMI_model <- performs_ammi(data_ge,
                            env = ENV,
                            gen = GEN,
                            rep = REP,
                            resp = GY,
                            verbose = FALSE)
plot_scores(AMMI_model, type = 2)

Inclusion of covariate to dependent trait while calculating BLUP values

I want to include Anthesis silking interval (ASI) as a covariate to grain yield while calculating BLUP values and plotting them.
gamem_met(Data, env = Loc_Code,
gen = ENTRY, rep = REP,
block = BLOCK, random= "gen", prob = 0.05, resp = "Grain Yield", verbose = TRUE)
How to include covariate ASI in this code

Custom names of function arguments do not work

Some functions argument do not take custom names as given in the following example

library(metan)
data("data_ge")
data_ge
# A tibble: 420 x 5
   ENV   GEN   REP      GY    HM
   <fct> <fct> <fct> <dbl> <dbl>
 1 E1    G1    1      2.17  44.9
 2 E1    G1    2      2.50  46.9
 3 E1    G1    3      2.43  47.8
 4 E1    G2    1      3.21  45.2
 5 E1    G2    2      2.93  45.3
 6 E1    G2    3      2.56  45.5
 7 E1    G3    1      2.77  46.7
 8 E1    G3    2      3.62  43.2
 9 E1    G3    3      2.28  47.8
10 E1    G4    1      2.36  47.9
# … with 410 more rows
> 
> anova_joint(
+     .data   = data_ge
+   , env     = ENV
+   , gen     = GEN
+   , rep     = REP
+   , resp    = GY
+   )
variable GY 
---------------------------------------------------------------------------
Joint ANOVA table
---------------------------------------------------------------------------
    Source     Df Sum Sq Mean Sq F value   Pr(>F)
       ENV  13.00 279.57 21.5057   62.33 0.00e+00
  REP(ENV)  28.00   9.66  0.3451    3.57 3.59e-08
       GEN   9.00  13.00  1.4439   14.93 2.19e-19
   GEN:ENV 117.00  31.22  0.2668    2.76 1.01e-11
 Residuals 252.00  24.37  0.0967      NA       NA
     CV(%)  11.63     NA      NA      NA       NA
 MSR+/MSR-   6.71     NA      NA      NA       NA
    OVmean   2.67     NA      NA      NA       NA
---------------------------------------------------------------------------

All variables with significant (p < 0.05) genotype-vs-environment interaction
Done!
Variable GY 
---------------------------------------------------------------------------
$anova
     Source         Df     Sum Sq     Mean Sq   F value
1       ENV  13.000000 279.573552 21.50565785 62.325457
2  REP(ENV)  28.000000   9.661516  0.34505416  3.568548
3       GEN   9.000000  12.995044  1.44389374 14.932741
4   GEN:ENV 117.000000  31.219565  0.26683389  2.759595
5 Residuals 252.000000  24.366674  0.09669315        NA
6     CV(%)  11.627790         NA          NA        NA
7 MSR+/MSR-   6.708789         NA          NA        NA
8    OVmean   2.674242         NA          NA        NA
        Pr(>F)
1 0.000000e+00
2 3.593191e-08
3 2.190118e-19
4 1.005191e-11
5           NA
6           NA
7           NA
8           NA

$model
Call:
   aov(formula = mean ~ GEN + ENV + GEN:ENV + ENV/REP, data = data)

Terms:
                      GEN       ENV   GEN:ENV   ENV:REP
Sum of Squares   12.99504 279.57355  31.21956   9.66152
Deg. of Freedom         9        13       117        28
                Residuals
Sum of Squares   24.36667
Deg. of Freedom       252

Residual standard error: 0.3109552
Estimated effects may be unbalanced

$augment
# A tibble: 420 x 11
   ENV   GEN   REP    mean   hat sigma fitted    resid
   <fct> <fct> <fct> <dbl> <dbl> <dbl>  <dbl>    <dbl>
 1 E1    G1    1      2.17 0.4   0.311   2.42 -0.255  
 2 E1    G1    2      2.50 0.400 0.311   2.40  0.101  
 3 E1    G1    3      2.43 0.4   0.311   2.27  0.154  
 4 E1    G2    1      3.21 0.400 0.311   2.96  0.249  
 5 E1    G2    2      2.93 0.400 0.312   2.94 -0.00492
 6 E1    G2    3      2.56 0.400 0.311   2.81 -0.244  
 7 E1    G3    1      2.77 0.4   0.311   2.95 -0.176  
 8 E1    G3    2      3.62 0.400 0.306   2.92  0.696  
 9 E1    G3    3      2.28 0.4   0.309   2.80 -0.521  
10 E1    G4    1      2.36 0.4   0.311   2.65 -0.286  
# … with 410 more rows, and 3 more variables: stdres <dbl>,
#   se.fit <dbl>, factors <chr>

$details
# A tibble: 10 x 2
   Parameters mean               
   <chr>      <chr>              
 1 Mean       "2.67"             
 2 SE         "NA"               
 3 SD         "NA"               
 4 CV         "NA"               
 5 Min        "0.67 (G10 in E11)"
 6 Max        "5.09 (G8 in E5)"  
 7 MinENV     "E11 (1.37)"       
 8 MaxENV     "E3 (4.06)"        
 9 MinGEN     "G10 (2.47) "      
10 MaxGEN     "G8 (3) "          

---------------------------------------------------------------------------



> 
> library(tidyverse)
> tb1 <-
+   data_ge %>% 
+   mutate(
+       Env     = ENV
+     , Gen     = GEN
+     , Rep     = REP
+   ) %>% 
+   select(Env, Gen, Rep, GY)
> 
> tb1
# A tibble: 420 x 4
   Env   Gen   Rep      GY
   <fct> <fct> <fct> <dbl>
 1 E1    G1    1      2.17
 2 E1    G1    2      2.50
 3 E1    G1    3      2.43
 4 E1    G2    1      3.21
 5 E1    G2    2      2.93
 6 E1    G2    3      2.56
 7 E1    G3    1      2.77
 8 E1    G3    2      3.62
 9 E1    G3    3      2.28
10 E1    G4    1      2.36
# … with 410 more rows
> 
> anova_joint(
+    .data   = tb1
+   , env     = Env
+   , gen     = Gen
+   , rep     = Rep
+   , resp    = GY
+ )
Error: Can't subset columns that don't exist.
x The columns `ENV`, `GEN`, and `REP` don't exist.
Run `rlang::last_error()` to see where the error occurred.
 

Release metan 1.16.0

Prepare for release:

  • Check current CRAN check results
  • Polish NEWS
  • devtools::build_readme()
  • urlchecker::url_check()
  • devtools::check(remote = TRUE, manual = TRUE)
  • devtools::check_win_devel()
  • rhub::check_for_cran()
  • revdepcheck::revdep_check(num_workers = 4)
  • Update cran-comments.md
  • Review pkgdown reference index for, e.g., missing topics
  • Draft blog post

Submit to CRAN:

  • usethis::use_version('minor')
  • devtools::submit_cran()
  • Approve email

Wait for CRAN...

  • Accepted 🎉
  • usethis::use_github_release()
  • usethis::use_dev_version()
  • Finish blog post
  • Tweet
  • Add link to blog post in pkgdown news menu

error while analysis path analysis

pcoeff <- path_coeff_mat(cor_mat, resp = TGW)

Error in solve.default(cor.x, cor.y) :
system is computationally singular: reciprocal condition number = 8.72837e-18

Problem with ge_stats

Hello!
The function runs well only with variable GW.

library(openxlsx)
library(metan)
#> Registered S3 method overwritten by 'GGally':
#>   method from   
#>   +.gg   ggplot2
#> |=========================================================|
#> | Multi-Environment Trial Analysis (metan) v1.16.0        |
#> | Author: Tiago Olivoto                                   |
#> | Type 'citation('metan')' to know how to cite metan      |
#> | Type 'vignette('metan_start')' for a short tutorial     |
#> | Visit 'https://bit.ly/pkgmetan' for a complete tutorial |
#> |=========================================================|


Data_numeric1 <- read.xlsx("C:/Users/stupk/Documents/R/Example.xlsx", "Lines", colNames = TRUE)

Data_numeric1$YEAR <- as.factor(Data_numeric1$YEAR)
Data_numeric1$GEN <- as.factor(Data_numeric1$GEN)
Data_numeric1$REP <- as.factor(Data_numeric1$REP)

stab_ind <- ge_stats(Data_numeric1, env = YEAR, gen =  GEN,rep =  REP, resp = c(HIGH, BUSH, SAFE,GY))
#> Error in rowSums((gamma.n)^2): 'x' must be a matrix with at least two dimensions

stab_ind <- ge_stats(Data_numeric1, env = YEAR, gen =  GEN,rep =  REP, resp = GW)
#> Evaluating trait GW |============================================| 100% 00:00:05 

Created on 2022-03-15 by the reprex package (v2.0.1)

[Example.xlsx](https://github.com/TiagoOlivoto/metan/files/8249601/Example.xlsx)

Problem with plot.gge or plot function

Hello, thank you for developing such a great package, I'm running into a problem in the plot function when I run it on the output of gge() function. The issue is lines pointing to the individual genotypes in the graph, I have more than 100 lines, and when I try to plot them, those lines make the figure very messy, the issue was solved in plot_scores for ammi analysis by using the command repel= FALSE but there is no such option in plot() command. Could you please help me with that? I have attached the figure. I have tried changing font size and shape size, but couldn't make these lines go away
Thank you

Error in corr_coef(data, ..., type = c("linear", "partial"), method = c("pearson", : could not find function "corr_coef"

Please briefly describe your problem and what output you expect. If you have a question, please don't use this form. Instead, ask on https://stackoverflow.com/ or https://community.rstudio.com/.

Please include a minimal reproducible example (AKA a reprex). If you've never heard of a reprex before, start by reading https://www.tidyverse.org/help/#reprex.

Brief description of the problem

# insert reprex here

How to remove outliers in METAN

I found few outliers in my data using find_outlier function of METAN package. How can I remove these outliers?


Brief description of the problem

# insert reprex here

print_table(.) : could not find function "print_table"

Please briefly describe your problem and what output you expect. If you have a question, please don't use this form. Instead, ask on https://stackoverflow.com/ or https://community.rstudio.com/.

Please include a minimal reproducible example (AKA a reprex). If you've never heard of a reprex before, start by reading https://www.tidyverse.org/help/#reprex.

Brief description of the problem

#Each time i use the print_table I get: "Error in print_table(.) : could not find function "print_table"

gen_mod <- gamem(data_g, GEN, REP,
                 resp = c(ED, CL, CD, KW, TKW, NKR))
get_model_data(gen_mod, "blupg") %>% print_table()

rep and block arguments for gge

I think gge must have arguments rep and block similar to anova_ind(), anova_joint(), performs_ammi(), waas() and waasb(), to analyze data from trials conducted in an alpha-lattice design.

problem in running your example code

have you an issue?

Please briefly describe your problem and what output you expect. If you have a question, please don't use this form. Instead, ask on https://stackoverflow.com/ or https://community.rstudio.com/.

Please include a minimal reproducible example (AKA a reprex). If you've never heard of a reprex before, start by reading https://www.tidyverse.org/help/#reprex.


See the codes and error message:

gmd(MTSI_index2, "FA") %>% print_table()
Error in get_model_data(x, what, type, verbose) :
Invalid class in object x. See ?get_model_data for more information.

# insert reprex here

Hello

have you an issue?

Hello Tiago, I think your package "metan" is really good!!!. I am doing the short tutorial (https://tiagoolivoto.github.io/metan/) with my own data (csv file called "metan", I attach the file). Nevertheless, I have an issue in the BLUP model:
model2 <- waasb(data_ge,
env = ENV,
gen = GEN,
rep = REP,
resp = everything())
R gives me this:

Convergence information

Number of iterations: 144
Final RMSE: 9.961795e-11
Number of axis: 1
Convergence: TRUE

Error in s$u[, 1:minimo] : subscript out of bounds
In addition: Warning messages:
1: Expected 2 pieces. Additional pieces discarded in 48 rows [37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, ...].
2: Data imputation used to fill the GxE matrix

Could you help me?.
Thank you in advance,
Adelina.

[metan.xlsx](https://github.com/TiagoOlivoto/metan/files/4451456/metan.xlsx)_

error when I run ge_stat() code of metan package

setwd("D:/PhD/Ragi")
library(readxl)
library(metan)
#> Registered S3 method overwritten by 'GGally':
#>   method from   
#>   +.gg   ggplot2
#> |=========================================================|
#> | Multi-Environment Trial Analysis (metan) v1.17.0        |
#> | Author: Tiago Olivoto                                   |
#> | Type 'citation('metan')' to know how to cite metan      |
#> | Type 'vignette('metan_start')' for a short tutorial     |
#> | Visit 'https://bit.ly/pkgmetan' for a complete tutorial |
#> |=========================================================|
Metan_analysis <- read_excel("Metan_analysis.xlsx", 
                             col_types = c("text", "text", "text", 
                                           "numeric", "numeric", "numeric", 
                                           "numeric", "numeric", "numeric", 
                                           "numeric", "numeric", "numeric", 
                                           "numeric"))
View(Metan_analysis)
stab <- ge_stats(Metan_analysis, ENV, GEN, REP)
#> Error in rowSums((gamma.n)^2): 'x' must be an array of at least two dimensions

Created on 2023-02-01 with reprex v2.0.2

Mislabeling of ENV and GEN in Which Won Where Biplot

have you an issue?

Please briefly describe your problem and what output you expect. If you have a question, please don't use this form. Instead, ask on https://stackoverflow.com/ or https://community.rstudio.com/.

Please include a minimal reproducible example (AKA a reprex). If you've never heard of a reprex before, start by reading https://www.tidyverse.org/help/#reprex.


using my own data set, I noticed a mislabeling of the ENV and GEN factors in the legend of the Which Won Where Biplot.

# insert reprex here
![image](https://user-images.githubusercontent.com/44632920/80032668-08e2b180-84db-11ea-94be-e53080ab45ef.png)

Same code of "metan" running on on one dataset, but not on similar second dataset

Dear Tiago,
Sorry to say that I don't know how to prepare "reprex". But I will be precise.

PROBLEM :-
Same code of "metan" to get MGIDI is running on one dataset (df.xlsx, attached) , but not on similar second dataset (df2.xlsx, attached).
The code I used is pasted here. It generates following message after line "$$$" in code is run. :::

"Error in cor(means, use = use) : no complete element pairs
In addition: Warning message:
Missing values observed in the table of means. Using complete observations to compute the correlation matrix. "

CODE :-

getwd()
setwd("C:/Users/hp/Desktop/MGIDI")
library(metan)
library(tidyverse)
library(tidyr)
library(dplyr)
library(rio)
df <- import("df2.xlsx", sheet=1)
str(df)
df <- df %>% mutate(across(where(is_character),as_factor))
str(df)
mod <-
gamem(df,
gen = GEN,
rep = REP,
resp = c('T1', 'T2','T3','T4','T5','T6','T7'),
verbose = F)
print(mod)
gmd(mod, "blupg")

$$$ mgidi_ind <- mgidi(mod, mineval=1,SI=33,ideotype = c("h, h, h, h, h, h, h"))
gmd(mgidi_ind, "MGIDI")

p1 <- plot(mgidi_ind, type = "contribution" )
p2 <- plot(mgidi_ind, SI=33,type = "index", title = "MGIDI for Control")
p2 + p1

DATA FILES ATTACHED::-

df.xlsx
df2.xlsx

Hope you will consider my limitation and help.

Regards.

Inclusion of covariate to dependent trait while calculating BLUP values

I want to include Anthesis silking interval (ASI) as a covariate to grain yield while calculating BLUP values and plotting them.
gamem_met(Data, env = Loc_Code,
gen = ENTRY, rep = REP,
block = BLOCK, random= "gen", prob = 0.05, resp = "Grain Yield", verbose = TRUE)
How to include covariate ASI in this code

MGIDI selection differential is false if averaged data is negative

Hi,

First, thanks a lot for the package and especially for MGIDI algorithm.
I applied mgidi function both on blup data, with trait values being centered on 0 for the whole population. Hence, I have negative values for the traits. When I output the sel_dif table, I find for some traits negative values in the column SDperc, despite a positive selection differential.
As an example, this is my sel_dif table:
image

Every time Xo (average value of the trait for the whole population) is negative, the resulting SDperc has the wrong sign.

The explanation is in the code of the MGIDI function L.302.
I think it would be more correct to use the absolute value for Xo in the denominator.

Thanks again,

Charlotte

Inconsistency with cv_blup function

Hi,

I am testing a sample dataset that has the same format as the oat dataset as demonstrated. This was a RCBD design with 3 replicates

str(dataset)
'data.frame': 791 obs. of 4 variables:
$ ENV : Factor w/ 13 levels "2017_P","2017_S",..: 10 10 10 10 10 10 10 10 10 10 ...
$ GEN : Factor w/ 30 levels "8xp","XR_A0",..: 23 24 30 2 10 26 11 3 12 27 ...
$ BLOCK: int 1 1 1 1 1 1 1 1 1 1 ...
$ GY : num 233 225 248 259 255 ...

When I use cv_blup, I get the following error message:

BLUP_model = cv_blup(dataset,
resp = GY,
gen = GEN,
env = ENV,
rep = BLOCK,
nboot = 200,
random="gen")

Error: Column error must be length 262 (the number of rows) or one, not 264
In addition: Warning message:
In pred - testing$Y :
longer object length is not a multiple of shorter object length

When I rerun it the command multiple times without changing anything else, the first line of the error message changes each time. For example:
Error: Column error must be length 261 (the number of rows) or one, not 265
Error: Column error must be length 262 (the number of rows) or one, not 266
Error: Column error must be length 262 (the number of rows) or one, not 263
Error: Column error must be length 262 (the number of rows) or one, not 266
Error: Column error must be length 262 (the number of rows) or one, not 265
Error: Column error must be length 261 (the number of rows) or one, not 267
Error: Column error must be length 262 (the number of rows) or one, not 265

Do you know what is happening here?

Thanks!

AMMI Analysis

I make my AMMI analysis with metan but the results don´t coincide with agricolae and with the program in SAS. The PC are negative when should be positive and vice versa.

I don´t know what is happening, could be my mistake on the code?

Grettings, i hope your answer.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.