diff --git a/NEWS.md b/NEWS.md index fc89173..5918491 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,9 +1,10 @@ # agriutilities 1.2.0 * Add `extract_rcov()` to extract variance-covariance matrices. - * Add `method` to be passed to cor function in `gg_cor()` function. + * Add `method` to be passed to cor function in `gg_cor()`. * Change style for naming the parameters in `gg_cor()`. * Minor changes in the writing style. + * Add `reorder` a logical value to reorder by a Hierarchical Clustering in `covcor_heat()`. # agriutilities 1.1.0 diff --git a/R/extractRcov.R b/R/extractRcov.R index 4ddb28f..17d812a 100644 --- a/R/extractRcov.R +++ b/R/extractRcov.R @@ -1,13 +1,14 @@ #' Extract Residual Variance-Covariance from ASReml-R #' -#' This function is specially useful when running repeated measurements models. +#' This function is specially useful for extracting residual variance covariance +#' matrices from ASReml-R when running repeated measurements models. #' #' @param model An asreml object #' @param time A character string indicating the "Time" #' @param plot A character string indicating the "PlotID" #' @param vc_error An optional character string indicating the variance covariance. -#' Can be "corv", "us", "expv", "exph", "ar1v", "ar1h" or "ante". By using NULL -#' the function tries to guess which was the variance-covariance used. +#' Can be "corv", "corh", "corgh", "us", "expv", "exph", "ar1v", "ar1h" or "ante". +#' By using NULL the function tries to guess which was the variance-covariance used. #' #' @return An object with a list of: #' \item{corr_mat}{A matrix with the residual correlation between time points} @@ -134,11 +135,11 @@ #' #' summary_models <- data.frame( #' model = names(models), -#' aic = unlist(lapply(models, function(x) summary(x)$aic)), -#' bic = unlist(lapply(models, function(x) summary(x)$bic)), -#' loglik = unlist(lapply(models, function(x) summary(x)$loglik)), -#' nedf = unlist(lapply(models, function(x) summary(x)$nedf)), -#' param = unlist(lapply(models, function(x) attr(summary(x)$aic, "param"))), +#' aic = unlist(lapply(models, \(x) summary(x)$aic)), +#' bic = unlist(lapply(models, \(x) summary(x)$bic)), +#' loglik = unlist(lapply(models, \(x) summary(x)$loglik)), +#' nedf = unlist(lapply(models, \(x) summary(x)$nedf)), +#' param = unlist(lapply(models, \(x) attr(summary(x)$aic, "param"))), #' row.names = NULL #' ) #' @@ -154,6 +155,8 @@ #' #' # Extracting Variance Covariance Matrix ----------------------------------- #' +#' extract_rcov(model_4, time = "Time", plot = "Plant") +#' #' covcor_heat( #' matrix = extract_rcov(model_1, time = "Time", plot = "Plant")$corr, #' legend = "none", @@ -170,9 +173,15 @@ extract_rcov <- function(model = NULL, plot = "Plot", vc_error = NULL) { stopifnot(inherits(x = model, what = "asreml")) - options <- c("corv", "us", "expv", "exph", "ar1v", "ar1h", "ante") + options <- c( + "corv", "corh", "corgh", + "us", "expv", "exph", + "ar1v", "ar1h", "ante" + ) + str_res <- as.character(model$call$residual)[2] + vc_check <- as.character(model$call$residual[[2]][[3]][[1]]) if (is.null(vc_error)) { - vc_error <- as.character(model$call$residual[[2]][[3]][[1]]) + vc_error <- vc_check if (!vc_error %in% options) { stop( "Variance covariance Not Available: \n\n\t", @@ -182,6 +191,13 @@ extract_rcov <- function(model = NULL, } } else { stopifnot(vc_error %in% options) + if (vc_error != vc_check) { + stop( + "Check that the argument vc_error matches your structure: \n\n\t", + "vc_error = '", vc_error, "'\n\t", + "residual = ~", str_res + ) + } } lvls <- levels(data.frame(model$mf)[, time]) s <- length(lvls) @@ -189,14 +205,6 @@ extract_rcov <- function(model = NULL, vc <- summary(model)$varcomp pt <- paste0(plot, ":", time, "!", time) vc <- vc[grep(pt, rownames(vc), fixed = TRUE), ] - str_res <- as.character(model$call$residual)[2] - if (!grepl(vc_error, str_res)) { - stop( - "Check that the argument vc_error matches your structure: \n\n\t", - "vc_error = '", vc_error, "'\n\t", - "residual = ~", str_res - ) - } if (vc_error == "corv") { corr <- vc[1, 1] * corr diag(corr) <- rep(1, s) @@ -205,6 +213,32 @@ extract_rcov <- function(model = NULL, vcov <- sqrt(D) %*% corr %*% sqrt(D) objt <- list(corr_mat = corr, vcov_mat = vcov, vc = vc_error) } + if (vc_error == "corh") { + corr <- vc[1, 1] * corr + diag(corr) <- rep(1, s) + D <- diag(vc[2:(s + 1), 1]) + colnames(D) <- rownames(D) <- lvls + vcov <- sqrt(D) %*% corr %*% sqrt(D) + objt <- list(corr_mat = corr, vcov_mat = vcov, vc = vc_error) + } + if (vc_error == "corgh") { + vc_corr <- vc[grep(".cor", rownames(vc)), ] + vc_var <- vc[-grep(".cor", rownames(vc)), ] + k <- 1 + for (i in 1:s) { + for (j in 1:i) { + if (i != j) { + corr[i, j] <- vc_corr[k, 1] + corr[j, i] <- vc_corr[k, 1] + k <- k + 1 + } + } + } + D <- diag(vc_var[1:s, 1]) + colnames(D) <- rownames(D) <- lvls + vcov <- sqrt(D) %*% corr %*% sqrt(D) + objt <- list(corr_mat = corr, vcov_mat = vcov, vc = vc_error) + } if (vc_error == "us") { vcov <- matrix(0, ncol = s, nrow = s, dimnames = list(lvls, lvls)) k <- 1 diff --git a/docs/articles/how-to-start.html b/docs/articles/how-to-start.html index 092c41b..0222c11 100644 --- a/docs/articles/how-to-start.html +++ b/docs/articles/how-to-start.html @@ -234,7 +234,7 @@

Multi-Environmental Trial Analysis
 met_results <- met_analysis(obj)
 print(met_results)
-
#> Online License checked out Sun Jan 21 11:07:37 2024
+
#> Online License checked out Mon Jan 22 10:33:16 2024
 #> Fitting MET model for yield.
 #> ---------------------------------------------------------------------
 #> Trial Effects (BLUEs):
diff --git a/docs/articles/repeated_measurements.html b/docs/articles/repeated_measurements.html
index 16d33a4..1554dd3 100644
--- a/docs/articles/repeated_measurements.html
+++ b/docs/articles/repeated_measurements.html
@@ -120,6 +120,10 @@ 

Johan
  1. Simple correlation model (corv); homogeneous variance form.
  2. +
  3. Simple correlation model (corh); heterogeneous variance +form.
  4. +
  5. General correlation model (corgh); heterogeneous +variance form.
  6. Exponential (or power) model (expv); homogeneous variance form.
  7. Exponential (or power) model (exph); heterogeneous @@ -151,8 +155,8 @@

    Johan library(tibble) library(asreml) -head(grassUV) %>% print() -grassUV %>% +head(grassUV) |> print() +grassUV |> ggplot( aes(x = Time, y = y, group = Plant, color = Plant) ) + @@ -160,7 +164,7 @@

    Johan geom_line() + facet_wrap(~Tmt) + theme_minimal(base_size = 15)

-
#> Online License checked out Sun Jan 21 11:07:45 2024
+
#> Online License checked out Mon Jan 22 10:33:24 2024
 #>   Tmt Plant Time HeightID    y
 #> 1 MAV     1    1       y1 21.0
 #> 2 MAV     1    3       y3 39.7
@@ -173,10 +177,10 @@ 

Johan

Exploration

-tmp <- grassUV %>%
-  group_by(Time, Plant) %>%
-  summarise(mean = mean(y, na.rm = TRUE)) %>%
-  spread(Time, mean) %>%
+tmp <- grassUV |>
+  group_by(Time, Plant) |>
+  summarise(mean = mean(y, na.rm = TRUE)) |>
+  spread(Time, mean) |>
   column_to_rownames("Plant")
 
 a <- covcor_heat(
@@ -186,16 +190,16 @@ 

Exploration) + ggtitle(label = "Pearson Correlation") -b <- tmp %>% - cor(use = "pairwise.complete.obs") %>% - as.data.frame() %>% - rownames_to_column(var = "Time") %>% - gather("DAP2", "corr", -1) %>% - type.convert(as.is = FALSE) %>% - mutate(corr = ifelse(Time < DAP2, NA, corr)) %>% - mutate(DAP2 = as.factor(DAP2)) %>% +b <- tmp |> + cor(use = "pairwise.complete.obs") |> + as.data.frame() |> + rownames_to_column(var = "Time") |> + gather("Time2", "corr", -1) |> + type.convert(as.is = FALSE) |> + mutate(corr = ifelse(Time < Time2, NA, corr)) |> + mutate(Time2 = as.factor(Time2)) |> ggplot( - aes(x = Time, y = corr, group = DAP2, color = DAP2) + aes(x = Time, y = corr, group = Time2, color = Time2) ) + geom_point() + geom_line() + @@ -297,9 +301,9 @@

Model Comparison row.names = NULL ) -summary_models %>% print() +summary_models |> print() -summary_models %>% +summary_models |> ggplot( aes(x = reorder(model, -bic), y = bic, group = 1) ) + @@ -341,23 +345,23 @@

Wald Test - @@ -957,7 +961,7 @@

Final Results
 pvals <- predict(model_4, classify = "Tmt:Time")$pvals
-grassUV %>%
+grassUV |>
   ggplot(
     aes(x = Time, y = y, group = Tmt, color = Tmt, shape = Tmt)
   ) +
diff --git a/docs/news/index.html b/docs/news/index.html
index c7f0c5c..cf32f1d 100644
--- a/docs/news/index.html
+++ b/docs/news/index.html
@@ -74,9 +74,10 @@
     

agriutilities 1.2.0

CRAN release: 2024-01-20

  • Add extract_rcov() to extract variance-covariance matrices.
  • -
  • Add method to be passed to cor function in gg_cor() function.
  • +
  • Add method to be passed to cor function in gg_cor().
  • Change style for naming the parameters in gg_cor().
  • Minor changes in the writing style.
  • +
  • Add reorder a logical value to reorder by a Hierarchical Clustering in covcor_heat().

agriutilities 1.1.0

CRAN release: 2023-03-19

diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index da0ab89..018ef0d 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -4,7 +4,7 @@ pkgdown_sha: ~ articles: how-to-start: how-to-start.html repeated_measurements: repeated_measurements.html -last_built: 2024-01-21T17:06Z +last_built: 2024-01-22T16:32Z urls: reference: https://apariciojohan.github.io/agriutilities/reference article: https://apariciojohan.github.io/agriutilities/articles diff --git a/docs/reference/extract_rcov.html b/docs/reference/extract_rcov.html index 7699669..9799018 100644 --- a/docs/reference/extract_rcov.html +++ b/docs/reference/extract_rcov.html @@ -1,5 +1,7 @@ -Extract Residual Variance-Covariance from ASReml-R — extract_rcov • agriutilitiesExtract Residual Variance-Covariance from ASReml-R — extract_rcov • agriutilities @@ -73,7 +75,8 @@
-

This function is specially useful when running repeated measurements models.

+

This function is specially useful for extracting residual variance covariance +matrices from ASReml-R when running repeated measurements models.

@@ -237,11 +240,11 @@

Examples summary_models <- data.frame( model = names(models), - aic = unlist(lapply(models, function(x) summary(x)$aic)), - bic = unlist(lapply(models, function(x) summary(x)$bic)), - loglik = unlist(lapply(models, function(x) summary(x)$loglik)), - nedf = unlist(lapply(models, function(x) summary(x)$nedf)), - param = unlist(lapply(models, function(x) attr(summary(x)$aic, "param"))), + aic = unlist(lapply(models, \(x) summary(x)$aic)), + bic = unlist(lapply(models, \(x) summary(x)$bic)), + loglik = unlist(lapply(models, \(x) summary(x)$loglik)), + nedf = unlist(lapply(models, \(x) summary(x)$nedf)), + param = unlist(lapply(models, \(x) attr(summary(x)$aic, "param"))), row.names = NULL ) @@ -257,6 +260,8 @@

Examples # Extracting Variance Covariance Matrix ----------------------------------- +extract_rcov(model_4, time = "Time", plot = "Plant") + covcor_heat( matrix = extract_rcov(model_1, time = "Time", plot = "Plant")$corr, legend = "none", diff --git a/docs/search.json b/docs/search.json index 26af7ab..08a035a 100644 --- a/docs/search.json +++ b/docs/search.json @@ -1 +1 @@ -[{"path":"https://apariciojohan.github.io/agriutilities/articles/how-to-start.html","id":"identify-the-experimental-design","dir":"Articles","previous_headings":"","what":"Identify the Experimental Design","title":"How to Start","text":"function check_design_met helps us check quality data also identify experimental design trials. works quality check quality control fit model.","code":"library(agriutilities) library(agridat) data(besag.met) dat <- besag.met results <- check_design_met( data = dat, genotype = \"gen\", trial = \"county\", traits = \"yield\", rep = \"rep\", block = \"block\", col = \"col\", row = \"row\" ) print(results) #> --------------------------------------------------------------------- #> Summary Traits by Trial: #> --------------------------------------------------------------------- #> # A tibble: 6 × 11 #> county traits Min Mean Median Max SD CV n n_miss miss_perc #> #> 1 C1 yield 87.9 149. 151. 200. 17.7 0.119 198 6 0.0303 #> 2 C2 yield 24.4 56.1 52.1 125. 18.4 0.328 198 6 0.0303 #> 3 C3 yield 28.2 87.9 89.2 137. 19.7 0.225 198 6 0.0303 #> 4 C4 yield 103. 145. 143. 190. 17.1 0.118 198 6 0.0303 #> 5 C5 yield 66.9 115. 116. 152. 16.4 0.142 198 6 0.0303 #> 6 C6 yield 29.2 87.6 87.8 148. 26.6 0.304 198 6 0.0303 #> #> --------------------------------------------------------------------- #> Experimental Design Detected: #> --------------------------------------------------------------------- #> county exp_design #> 1 C1 row_col #> 2 C2 row_col #> 3 C3 row_col #> 4 C4 row_col #> 5 C5 row_col #> 6 C6 row_col #> #> --------------------------------------------------------------------- #> Summary Experimental Design: #> --------------------------------------------------------------------- #> # A tibble: 6 × 9 #> county n n_gen n_rep n_block n_col n_row num_of_reps num_of_gen #> #> 1 C1 198 64 3 8 11 18 3_9 63_1 #> 2 C2 198 64 3 8 11 18 3_9 63_1 #> 3 C3 198 64 3 8 11 18 3_9 63_1 #> 4 C4 198 64 3 8 11 18 3_9 63_1 #> 5 C5 198 64 3 8 11 18 3_9 63_1 #> 6 C6 198 64 3 8 11 18 3_9 63_1 #> #> --------------------------------------------------------------------- #> Connectivity Matrix: #> --------------------------------------------------------------------- #> C1 C2 C3 C4 C5 C6 #> C1 64 64 64 64 64 64 #> C2 64 64 64 64 64 64 #> C3 64 64 64 64 64 64 #> C4 64 64 64 64 64 64 #> C5 64 64 64 64 64 64 #> C6 64 64 64 64 64 64 #> #> --------------------------------------------------------------------- #> Filters Applied: #> --------------------------------------------------------------------- #> List of 1 #> $ yield:List of 4 #> ..$ missing_50% : chr(0) #> ..$ no_variation : chr(0) #> ..$ row_col_dup : chr(0) #> ..$ trials_to_remove: chr(0)"},{"path":"https://apariciojohan.github.io/agriutilities/articles/how-to-start.html","id":"single-trial-analysis","dir":"Articles","previous_headings":"","what":"Single Trial Analysis","title":"How to Start","text":"results previous function used single_trial_analysis() fit single trial models.","code":"obj <- single_trial_analysis(results, progress = FALSE) print(obj) #> --------------------------------------------------------------------- #> Summary Fitted Models: #> --------------------------------------------------------------------- #> trait trial heritability CV VarGen VarErr design #> 1: yield C1 0.73 6.022489 87.39848 82.86095 row_col #> 2: yield C2 0.37 17.104998 25.80684 108.68546 row_col #> 3: yield C3 0.64 12.357202 83.57907 118.55567 row_col #> 4: yield C4 0.41 8.179408 35.75568 136.21218 row_col #> 5: yield C5 0.80 7.037586 103.79822 66.97523 row_col #> 6: yield C6 0.49 16.632367 71.92232 207.53073 row_col #> #> --------------------------------------------------------------------- #> Outliers Removed: #> --------------------------------------------------------------------- #> trait trial genotype id outlier #> 1: yield C1 G60 50 TRUE #> #> --------------------------------------------------------------------- #> First Predicted Values and Standard Errors (BLUEs/BLUPs): #> --------------------------------------------------------------------- #> trait genotype trial BLUEs seBLUEs BLUPs seBLUPs wt #> 1: yield G01 C1 141.4161 6.078858 143.5308 5.249771 0.02706176 #> 2: yield G02 C1 157.8110 5.979708 155.8037 5.194547 0.02796663 #> 3: yield G03 C1 127.3836 6.091534 133.0256 5.269999 0.02694925 #> 4: yield G04 C1 154.8445 6.093866 153.8364 5.270427 0.02692863 #> 5: yield G05 C1 163.8950 6.132141 161.1831 5.271809 0.02659352 #> 6: yield G06 C1 128.5168 6.087902 133.6857 5.247130 0.02698141"},{"path":"https://apariciojohan.github.io/agriutilities/articles/how-to-start.html","id":"multi-environmental-trial-analysis","dir":"Articles","previous_headings":"","what":"Multi-Environmental Trial Analysis","title":"How to Start","text":"results previous function used met_analysis() fit multi-environmental trial models.","code":"met_results <- met_analysis(obj) print(met_results) #> Online License checked out Sun Jan 21 11:07:37 2024 #> Fitting MET model for yield. #> --------------------------------------------------------------------- #> Trial Effects (BLUEs): #> --------------------------------------------------------------------- #> trait trial predicted.value std.error status #> 1 yield C1 149.74946 1.358117 Estimable #> 2 yield C2 65.99561 1.141995 Estimable #> 3 yield C3 90.60825 1.449096 Estimable #> 4 yield C4 148.12392 1.202934 Estimable #> 5 yield C5 121.77612 1.429239 Estimable #> 6 yield C6 88.31194 1.532688 Estimable #> #> --------------------------------------------------------------------- #> Heritability: #> --------------------------------------------------------------------- #> trait h2 #> 1 yield 0.8239191 #> #> --------------------------------------------------------------------- #> First Overall Predicted Values and Standard Errors (BLUPs): #> --------------------------------------------------------------------- #> trait genotype predicted.value std.error status #> 1 yield G01 110.4297 2.528111 Estimable #> 2 yield G02 110.8617 2.537200 Estimable #> 3 yield G03 102.6812 2.541066 Estimable #> 4 yield G04 115.4946 2.533730 Estimable #> 5 yield G05 120.6600 2.548344 Estimable #> 6 yield G06 108.8297 2.555281 Estimable #> #> --------------------------------------------------------------------- #> Variance-Covariance Matrix: #> --------------------------------------------------------------------- #> #> Correlation Matrix ('us'): yield #> C1 C2 C3 C4 C5 C6 #> C1 1.00 0.57 0.58 0.65 0.95 0.43 #> C2 0.57 1.00 0.55 0.70 0.52 0.76 #> C3 0.58 0.55 1.00 0.95 0.72 0.27 #> C4 0.65 0.70 0.95 1.00 0.75 0.47 #> C5 0.95 0.52 0.72 0.75 1.00 0.33 #> C6 0.43 0.76 0.27 0.47 0.33 1.00 #> #> Covariance Matrix ('us'): yield #> C1 C2 C3 C4 C5 C6 #> C1 80.57 27.36 46.81 31.67 85.61 31.17 #> C2 27.36 28.90 26.44 20.41 27.99 33.51 #> C3 46.81 26.44 79.66 45.84 64.54 19.81 #> C4 31.67 20.41 45.84 29.28 40.79 20.76 #> C5 85.61 27.99 64.54 40.79 100.60 27.13 #> C6 31.17 33.51 19.81 20.76 27.13 66.66 #> #> --------------------------------------------------------------------- #> First Stability Coefficients: #> --------------------------------------------------------------------- #> trait genotype superiority static wricke predicted.value #> 1 yield G57 22.67503 32.45871 13.962970 92.45997 #> 2 yield G29 17.27533 34.41794 4.343501 99.38429 #> 3 yield G34 17.26249 33.29276 8.514332 99.74688 #> 4 yield G59 16.94882 34.39425 4.798863 99.87221 #> 5 yield G31 16.23001 31.89042 11.722935 101.66382 #> 6 yield G10 15.75253 32.02994 11.499867 102.39802"},{"path":"https://apariciojohan.github.io/agriutilities/articles/repeated_measurements.html","id":"exploration","dir":"Articles","previous_headings":"","what":"Exploration","title":"Repeated Measurements","text":"","code":"tmp <- grassUV %>% group_by(Time, Plant) %>% summarise(mean = mean(y, na.rm = TRUE)) %>% spread(Time, mean) %>% column_to_rownames(\"Plant\") a <- covcor_heat( matrix = cor(tmp), legend = \"none\", size = 4.5 ) + ggtitle(label = \"Pearson Correlation\") b <- tmp %>% cor(use = \"pairwise.complete.obs\") %>% as.data.frame() %>% rownames_to_column(var = \"Time\") %>% gather(\"DAP2\", \"corr\", -1) %>% type.convert(as.is = FALSE) %>% mutate(corr = ifelse(Time < DAP2, NA, corr)) %>% mutate(DAP2 = as.factor(DAP2)) %>% ggplot( aes(x = Time, y = corr, group = DAP2, color = DAP2) ) + geom_point() + geom_line() + theme_minimal(base_size = 15) + color_palette(palette = \"jco\") + labs(color = \"Time\", y = \"Pearson Correlation\") + theme(legend.position = \"top\") ggarrange(a, b)"},{"path":"https://apariciojohan.github.io/agriutilities/articles/repeated_measurements.html","id":"modeling","dir":"Articles","previous_headings":"","what":"Modeling","title":"Repeated Measurements","text":"Let’s fit several models different variance-covariance structures:","code":"# Identity variance model. model_0 <- asreml( fixed = y ~ Time + Tmt + Tmt:Time, residual = ~ id(Plant):idv(Time), data = grassUV ) # Simple correlation model; homogeneous variance form. model_1 <- asreml( fixed = y ~ Time + Tmt + Tmt:Time, residual = ~ id(Plant):corv(Time), data = grassUV ) # Exponential (or power) model; homogeneous variance form. model_2 <- asreml( fixed = y ~ Time + Tmt + Tmt:Time, residual = ~ id(Plant):expv(Time), data = grassUV ) # Exponential (or power) model; heterogeneous variance form. model_3 <- asreml( fixed = y ~ Time + Tmt + Tmt:Time, residual = ~ id(Plant):exph(Time), data = grassUV ) # Antedependence variance model of order 1 model_4 <- asreml( fixed = y ~ Time + Tmt + Tmt:Time, residual = ~ id(Plant):ante(Time), data = grassUV ) # Autoregressive model of order 1; homogeneous variance form. model_5 <- asreml( fixed = y ~ Time + Tmt + Tmt:Time, residual = ~ id(Plant):ar1v(Time), data = grassUV ) # Autoregressive model of order 1; heterogeneous variance form. model_6 <- asreml( fixed = y ~ Time + Tmt + Tmt:Time, residual = ~ id(Plant):ar1h(Time), data = grassUV ) # Unstructured variance model. model_7 <- asreml( fixed = y ~ Time + Tmt + Tmt:Time, residual = ~ id(Plant):us(Time), data = grassUV )"},{"path":"https://apariciojohan.github.io/agriutilities/articles/repeated_measurements.html","id":"model-comparison","dir":"Articles","previous_headings":"","what":"Model Comparison","title":"Repeated Measurements","text":"can use Akaike Information Criterion (AIC)(Akaike, 1974) Bayesian Information Criterion (BIC)(Stone, 1979) comparing fitted models. lower AIC BIC value indicates better fit. specific scenario, antedependence model emerges optimal choice, indicated Bayesian Information Criteria (BIC). 1-factor antedependence structure elegantly models variance-covariance matrix \\(\\Sigma^{\\omega \\times\\omega}\\) following decomposition: \\[ \\Sigma ^{-1} = UDU' \\] \\(U^{\\omega \\times\\omega}\\) unit upper triangular matrix \\(D = diag(d_1, ..., d_{\\omega})\\) diagonal matrix. order case 1. extract_rcov() retrieves matrices closer inspection results.","code":"models <- list( \"idv\" = model_0, \"corv\" = model_1, \"expv\" = model_2, \"exph\" = model_3, \"ante\" = model_4, \"ar1v\" = model_5, \"ar1h\" = model_6, \"us\" = model_7 ) summary_models <- data.frame( model = names(models), aic = unlist(lapply(models, \\(x) summary(x)$aic)), bic = unlist(lapply(models, \\(x) summary(x)$bic)), loglik = unlist(lapply(models, \\(x) summary(x)$loglik)), nedf = unlist(lapply(models, \\(x) summary(x)$nedf)), param = unlist(lapply(models, \\(x) attr(summary(x)$aic, \"param\"))), row.names = NULL ) summary_models %>% print() summary_models %>% ggplot( aes(x = reorder(model, -bic), y = bic, group = 1) ) + geom_point(size = 2) + geom_text(aes(x = model, y = bic + 5, label = param), size = 5) + geom_line() + theme_minimal(base_size = 15) + labs(x = NULL, y = \"BIC\") #> model aic bic loglik nedf param #> 1 idv 420.8836 422.9779 -209.4418 60 1 #> 2 corv 397.7535 401.9422 -196.8768 60 2 #> 3 expv 369.9577 374.1464 -182.9788 60 2 #> 4 exph 354.9984 367.5645 -171.4992 60 6 #> 5 ante 338.7387 357.5878 -160.3694 60 9 #> 6 ar1v 366.1259 370.3146 -181.0630 60 2 #> 7 ar1h 351.1073 363.6734 -169.5536 60 6 #> 8 us 346.0712 377.4863 -158.0356 60 15"},{"path":"https://apariciojohan.github.io/agriutilities/articles/repeated_measurements.html","id":"wald-test","dir":"Articles","previous_headings":"","what":"Wald Test","title":"Repeated Measurements","text":"table shows summary Wald statistics fixed effects models fitted.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/articles/repeated_measurements.html","id":"extracting-variance-covariance-matrix","dir":"Articles","previous_headings":"","what":"Extracting Variance Covariance Matrix","title":"Repeated Measurements","text":"example extracting variance-covariance matrix, let’s take best model according BIC, run line code: extract_rcov(model_4).","code":"mat <- extract_rcov(model_4, time = \"Time\", plot = \"Plant\") print(mat) # Plotting Matrix p1 <- covcor_heat(matrix = mat$corr, legend = \"none\", size = 4.5) + ggtitle(label = \"Correlation Matrix (ante)\") p1 p2 <- covcor_heat( matrix = mat$vcov, corr = FALSE, legend = \"none\", size = 4.5, digits = 1 ) + ggtitle(label = \"Covariance Matrix (ante)\") p2 ggarrange(p1, p2) #> $corr_mat #> 1 3 5 7 10 #> 1 1.0000000 0.5949600 0.3551374 0.3117083 0.3042604 #> 3 0.5949600 1.0000000 0.5969097 0.5239148 0.5113965 #> 5 0.3551374 0.5969097 1.0000000 0.8777119 0.8567400 #> 7 0.3117083 0.5239148 0.8777119 1.0000000 0.9761062 #> 10 0.3042604 0.5113965 0.8567400 0.9761062 1.0000000 #> #> $vcov_mat #> 1 3 5 7 10 #> 1 37.22092 23.38866 34.87475 44.65979 43.22207 #> 3 23.38866 41.51911 61.90901 79.27923 76.72701 #> 5 34.87475 61.90901 259.08503 331.77822 321.09738 #> 7 44.65979 79.27923 331.77822 551.50497 533.75052 #> 10 43.22207 76.72701 321.09738 533.75052 542.16700 #> #> $vc #> [1] \"ante\" #> #> $U #> 1 3 5 7 10 #> 1 1 -0.628374 0.000000 0.000000 0.0000000 #> 3 0 1.000000 -1.491097 0.000000 0.0000000 #> 5 0 0.000000 1.000000 -1.280577 0.0000000 #> 7 0 0.000000 0.000000 1.000000 -0.9678073 #> 10 0 0.000000 0.000000 0.000000 1.0000000 #> #> $D #> 1 3 5 7 10 #> 1 0.02686661 0.00000000 0.000000000 0.000000000 0.00000000 #> 3 0.00000000 0.03728243 0.000000000 0.000000000 0.00000000 #> 5 0.00000000 0.00000000 0.005996185 0.000000000 0.00000000 #> 7 0.00000000 0.00000000 0.000000000 0.007896552 0.00000000 #> 10 0.00000000 0.00000000 0.000000000 0.000000000 0.03906346"},{"path":"https://apariciojohan.github.io/agriutilities/articles/repeated_measurements.html","id":"comparison","dir":"Articles","previous_headings":"","what":"Comparison","title":"Repeated Measurements","text":"plot unveils correlation matrices, comparing raw data matrix one derived post-application antedependence model.","code":"ggarrange(a, p1)"},{"path":"https://apariciojohan.github.io/agriutilities/articles/repeated_measurements.html","id":"final-results","dir":"Articles","previous_headings":"","what":"Final Results","title":"Repeated Measurements","text":"","code":"pvals <- predict(model_4, classify = \"Tmt:Time\")$pvals grassUV %>% ggplot( aes(x = Time, y = y, group = Tmt, color = Tmt, shape = Tmt) ) + geom_point(alpha = 0.4, size = 3) + geom_line(data = pvals, mapping = aes(y = predicted.value)) + theme_minimal(base_size = 15) + color_palette(palette = \"jco\")"},{"path":"https://apariciojohan.github.io/agriutilities/articles/repeated_measurements.html","id":"references","dir":"Articles","previous_headings":"","what":"References","title":"Repeated Measurements","text":"ASReml-R Reference Manual","code":""},{"path":"https://apariciojohan.github.io/agriutilities/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Johan Aparicio. Author, maintainer. Alexia Bornhorst. Author. Alliance Bioversity International CIAT. Copyright holder.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Aparicio J, Bornhorst (2024). agriutilities: Utilities Data Analysis Agriculture. R package version 1.2.0, https://apariciojohan.github.io/agriutilities/, https://github.com/AparicioJohan/agriutilities.","code":"@Manual{, title = {agriutilities: Utilities for Data Analysis in Agriculture}, author = {Johan Aparicio and Alexia Bornhorst}, year = {2024}, note = {R package version 1.2.0, https://apariciojohan.github.io/agriutilities/}, url = {https://github.com/AparicioJohan/agriutilities}, }"},{"path":[]},{"path":"https://apariciojohan.github.io/agriutilities/CODE_OF_CONDUCT.html","id":"our-pledge","dir":"","previous_headings":"","what":"Our Pledge","title":"Contributor Covenant Code of Conduct","text":"members, contributors, leaders pledge make participation community harassment-free experience everyone, regardless age, body size, visible invisible disability, ethnicity, sex characteristics, gender identity expression, level experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, sexual identity orientation. pledge act interact ways contribute open, welcoming, diverse, inclusive, healthy community.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/CODE_OF_CONDUCT.html","id":"our-standards","dir":"","previous_headings":"","what":"Our Standards","title":"Contributor Covenant Code of Conduct","text":"Examples behavior contributes positive environment community include: Demonstrating empathy kindness toward people respectful differing opinions, viewpoints, experiences Giving gracefully accepting constructive feedback Accepting responsibility apologizing affected mistakes, learning experience Focusing best just us individuals, overall community Examples unacceptable behavior include: use sexualized language imagery, sexual attention advances kind Trolling, insulting derogatory comments, personal political attacks Public private harassment Publishing others’ private information, physical email address, without explicit permission conduct reasonably considered inappropriate professional setting","code":""},{"path":"https://apariciojohan.github.io/agriutilities/CODE_OF_CONDUCT.html","id":"enforcement-responsibilities","dir":"","previous_headings":"","what":"Enforcement Responsibilities","title":"Contributor Covenant Code of Conduct","text":"Community leaders responsible clarifying enforcing standards acceptable behavior take appropriate fair corrective action response behavior deem inappropriate, threatening, offensive, harmful. Community leaders right responsibility remove, edit, reject comments, commits, code, wiki edits, issues, contributions aligned Code Conduct, communicate reasons moderation decisions appropriate.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/CODE_OF_CONDUCT.html","id":"scope","dir":"","previous_headings":"","what":"Scope","title":"Contributor Covenant Code of Conduct","text":"Code Conduct applies within community spaces, also applies individual officially representing community public spaces. Examples representing community include using official e-mail address, posting via official social media account, acting appointed representative online offline event.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/CODE_OF_CONDUCT.html","id":"enforcement","dir":"","previous_headings":"","what":"Enforcement","title":"Contributor Covenant Code of Conduct","text":"Instances abusive, harassing, otherwise unacceptable behavior may reported community leaders responsible enforcement johanstevenapa@gmail.com. complaints reviewed investigated promptly fairly. community leaders obligated respect privacy security reporter incident.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/CODE_OF_CONDUCT.html","id":"enforcement-guidelines","dir":"","previous_headings":"","what":"Enforcement Guidelines","title":"Contributor Covenant Code of Conduct","text":"Community leaders follow Community Impact Guidelines determining consequences action deem violation Code Conduct:","code":""},{"path":"https://apariciojohan.github.io/agriutilities/CODE_OF_CONDUCT.html","id":"id_1-correction","dir":"","previous_headings":"Enforcement Guidelines","what":"1. Correction","title":"Contributor Covenant Code of Conduct","text":"Community Impact: Use inappropriate language behavior deemed unprofessional unwelcome community. Consequence: private, written warning community leaders, providing clarity around nature violation explanation behavior inappropriate. public apology may requested.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/CODE_OF_CONDUCT.html","id":"id_2-warning","dir":"","previous_headings":"Enforcement Guidelines","what":"2. Warning","title":"Contributor Covenant Code of Conduct","text":"Community Impact: violation single incident series actions. Consequence: warning consequences continued behavior. interaction people involved, including unsolicited interaction enforcing Code Conduct, specified period time. includes avoiding interactions community spaces well external channels like social media. Violating terms may lead temporary permanent ban.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/CODE_OF_CONDUCT.html","id":"id_3-temporary-ban","dir":"","previous_headings":"Enforcement Guidelines","what":"3. Temporary Ban","title":"Contributor Covenant Code of Conduct","text":"Community Impact: serious violation community standards, including sustained inappropriate behavior. Consequence: temporary ban sort interaction public communication community specified period time. public private interaction people involved, including unsolicited interaction enforcing Code Conduct, allowed period. Violating terms may lead permanent ban.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/CODE_OF_CONDUCT.html","id":"id_4-permanent-ban","dir":"","previous_headings":"Enforcement Guidelines","what":"4. Permanent Ban","title":"Contributor Covenant Code of Conduct","text":"Community Impact: Demonstrating pattern violation community standards, including sustained inappropriate behavior, harassment individual, aggression toward disparagement classes individuals. Consequence: permanent ban sort public interaction within community.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/CODE_OF_CONDUCT.html","id":"attribution","dir":"","previous_headings":"","what":"Attribution","title":"Contributor Covenant Code of Conduct","text":"Code Conduct adapted Contributor Covenant, version 2.1, available https://www.contributor-covenant.org/version/2/1/code_of_conduct.html. Community Impact Guidelines inspired [Mozilla’s code conduct enforcement ladder][https://github.com/mozilla/inclusion]. answers common questions code conduct, see FAQ https://www.contributor-covenant.org/faq. Translations available https://www.contributor-covenant.org/translations.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/index.html","id":"agriutilities-","dir":"","previous_headings":"","what":"Utilities for Data Analysis in Agriculture","title":"Utilities for Data Analysis in Agriculture","text":"agriutilities R package designed make analysis field trials easier accessible everyone working plant breeding. provides simple intuitive interface conducting single multi-environmental trial analysis, minimal coding required. Whether ’re beginner experienced user, agriutilities help quickly easily carry complex analyses confidence. built-functions fitting Linear Mixed Models (LMM), agriutilities ideal choice anyone wants save time focus interpreting results.","code":""},{"path":[]},{"path":"https://apariciojohan.github.io/agriutilities/index.html","id":"from-cran","dir":"","previous_headings":"Installation","what":"From CRAN","title":"Utilities for Data Analysis in Agriculture","text":"","code":"install.packages(\"agriutilities\")"},{"path":"https://apariciojohan.github.io/agriutilities/index.html","id":"from-github","dir":"","previous_headings":"Installation","what":"From GitHub","title":"Utilities for Data Analysis in Agriculture","text":"can install development version agriutilities GitHub :","code":"remotes::install_github(\"AparicioJohan/agriutilities\")"},{"path":"https://apariciojohan.github.io/agriutilities/index.html","id":"automatic-data-analysis-pipeline","dir":"","previous_headings":"","what":"Automatic Data Analysis Pipeline","title":"Utilities for Data Analysis in Agriculture","text":"basic example shows use functions package.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/index.html","id":"identify-the-experimental-design","dir":"","previous_headings":"Automatic Data Analysis Pipeline","what":"Identify the Experimental Design","title":"Utilities for Data Analysis in Agriculture","text":"function check_design_met helps us check quality data also identify experimental design trials. works quality check quality control fit model. Inspecting output.","code":"library(agriutilities) library(agridat) data(besag.met) dat <- besag.met results <- check_design_met( data = dat, genotype = \"gen\", trial = \"county\", traits = \"yield\", rep = \"rep\", block = \"block\", col = \"col\", row = \"row\" ) plot(results, type = \"connectivity\") plot(results, type = \"missing\") print(results) --------------------------------------------------------------------- Summary Traits by Trial: --------------------------------------------------------------------- # A tibble: 6 x 11 county traits Min Mean Median Max SD CV n n_miss miss_perc 1 C1 yield 87.9 149. 151. 200. 17.7 0.119 198 6 0.0303 2 C2 yield 24.4 56.1 52.1 125. 18.4 0.328 198 6 0.0303 3 C3 yield 28.2 87.9 89.2 137. 19.7 0.225 198 6 0.0303 4 C4 yield 103. 145. 143. 190. 17.1 0.118 198 6 0.0303 5 C5 yield 66.9 115. 116. 152. 16.4 0.142 198 6 0.0303 6 C6 yield 29.2 87.6 87.8 148. 26.6 0.304 198 6 0.0303 --------------------------------------------------------------------- Experimental Design Detected: --------------------------------------------------------------------- county exp_design 1 C1 row_col 2 C2 row_col 3 C3 row_col 4 C4 row_col 5 C5 row_col 6 C6 row_col --------------------------------------------------------------------- Summary Experimental Design: --------------------------------------------------------------------- # A tibble: 6 x 9 county n n_gen n_rep n_block n_col n_row num_of_reps num_of_gen 1 C1 198 64 3 8 11 18 3_9 63_1 2 C2 198 64 3 8 11 18 3_9 63_1 3 C3 198 64 3 8 11 18 3_9 63_1 4 C4 198 64 3 8 11 18 3_9 63_1 5 C5 198 64 3 8 11 18 3_9 63_1 6 C6 198 64 3 8 11 18 3_9 63_1 --------------------------------------------------------------------- Connectivity Matrix: --------------------------------------------------------------------- C1 C2 C3 C4 C5 C6 C1 64 64 64 64 64 64 C2 64 64 64 64 64 64 C3 64 64 64 64 64 64 C4 64 64 64 64 64 64 C5 64 64 64 64 64 64 C6 64 64 64 64 64 64 --------------------------------------------------------------------- Filters Applied: --------------------------------------------------------------------- List of 1 $ yield:List of 4 ..$ missing_50% : chr(0) ..$ no_variation : chr(0) ..$ row_col_dup : chr(0) ..$ trials_to_remove: chr(0)"},{"path":"https://apariciojohan.github.io/agriutilities/index.html","id":"single-trial-analysis-sta","dir":"","previous_headings":"Automatic Data Analysis Pipeline","what":"Single Trial Analysis (STA)","title":"Utilities for Data Analysis in Agriculture","text":"results previous function used single_trial_analysis() fit single trial models. function can fit, Completely Randomized Designs (CRD), Randomized Complete Block Designs (RCBD), Resolvable Incomplete Block Designs (res-IBD), Non-Resolvable Row-Column Designs (Row-Col) Resolvable Row-Column Designs (res-Row-Col). NOTE: fits models based randomization detected. Inspecting output. returning object set lists trial summary, BLUEs, BLUPs, heritability, variance components, potential extreme observations, residuals, models fitted data used.","code":"obj <- single_trial_analysis(results, progress = FALSE) print(obj) --------------------------------------------------------------------- Summary Fitted Models: --------------------------------------------------------------------- trait trial heritability CV VarGen VarErr design 1: yield C1 0.73 6.022489 87.39848 82.86095 row_col 2: yield C2 0.37 17.104998 25.80684 108.68546 row_col 3: yield C3 0.64 12.357202 83.57907 118.55567 row_col 4: yield C4 0.41 8.179408 35.75568 136.21218 row_col 5: yield C5 0.80 7.037586 103.79822 66.97523 row_col 6: yield C6 0.49 16.632367 71.92232 207.53073 row_col --------------------------------------------------------------------- Outliers Removed: --------------------------------------------------------------------- trait trial genotype id outlier 1: yield C1 G60 50 TRUE --------------------------------------------------------------------- First Predicted Values and Standard Errors (BLUEs/BLUPs): --------------------------------------------------------------------- trait genotype trial BLUEs seBLUEs BLUPs seBLUPs wt 1: yield G01 C1 141.4161 6.078858 143.5308 5.249771 0.02706176 2: yield G02 C1 157.8110 5.979708 155.8037 5.194547 0.02796663 3: yield G03 C1 127.3836 6.091534 133.0256 5.269999 0.02694925 4: yield G04 C1 154.8445 6.093866 153.8364 5.270427 0.02692863 5: yield G05 C1 163.8950 6.132141 161.1831 5.271809 0.02659352 6: yield G06 C1 128.5168 6.087902 133.6857 5.247130 0.02698141 plot(obj, horizontal = TRUE, nudge_y_h2 = 0.12) plot(obj, type = \"correlation\")"},{"path":"https://apariciojohan.github.io/agriutilities/index.html","id":"two-stage-analysis-met","dir":"","previous_headings":"Automatic Data Analysis Pipeline","what":"Two-Stage Analysis (MET)","title":"Utilities for Data Analysis in Agriculture","text":"results previous function used met_analysis() fit multi-environmental trial models. Inspecting output.","code":"met_results <- met_analysis(obj, vcov = \"fa2\", progress = FALSE) Online License checked out Fri Mar 17 08:56:24 2023 Online License checked out Fri Mar 17 08:56:25 2023 print(met_results) --------------------------------------------------------------------- Trial Effects (BLUEs): --------------------------------------------------------------------- trait trial predicted.value std.error status 1 yield C1 149.75463 1.357203 Estimable 2 yield C2 65.99443 1.140633 Estimable 3 yield C3 90.60647 1.445419 Estimable 4 yield C4 148.12551 1.172065 Estimable 5 yield C5 121.77655 1.434386 Estimable 6 yield C6 88.31651 1.532150 Estimable --------------------------------------------------------------------- Heritability: --------------------------------------------------------------------- trait h2 1 yield 0.8253127 --------------------------------------------------------------------- First Overall Predicted Values and Standard Errors (BLUPs): --------------------------------------------------------------------- trait genotype predicted.value std.error status 1 yield G01 110.4107 2.524415 Estimable 2 yield G02 111.0488 2.534145 Estimable 3 yield G03 102.6031 2.538533 Estimable 4 yield G04 115.3953 2.530336 Estimable 5 yield G05 120.6700 2.545688 Estimable 6 yield G06 108.6678 2.552319 Estimable --------------------------------------------------------------------- Variance-Covariance Matrix: --------------------------------------------------------------------- Correlation Matrix ('fa2'): yield C1 C2 C3 C4 C5 C6 C1 1.00 0.54 0.67 0.81 0.93 0.35 C2 0.54 1.00 0.60 0.90 0.52 0.68 C3 0.67 0.60 1.00 0.73 0.70 0.40 C4 0.81 0.90 0.73 1.00 0.83 0.60 C5 0.93 0.52 0.70 0.83 1.00 0.34 C6 0.35 0.68 0.40 0.60 0.34 1.00 Covariance Matrix ('fa2'): yield C1 C2 C3 C4 C5 C6 C1 80.39 25.73 53.51 35.80 84.13 25.75 C2 25.73 28.74 28.50 23.86 28.05 29.67 C3 53.51 28.50 78.96 32.26 62.98 28.93 C4 35.80 23.86 32.26 24.54 41.43 24.38 C5 84.13 28.05 62.98 41.43 101.53 27.94 C6 25.75 29.67 28.93 24.38 27.94 66.57 --------------------------------------------------------------------- First Stability Coefficients: --------------------------------------------------------------------- trait genotype superiority static wricke predicted.value 1 yield G57 22.56100 33.35260 15.210394 92.44993 2 yield G29 16.98170 34.39632 4.243540 99.41798 3 yield G34 16.98545 33.64634 8.152888 99.81112 4 yield G59 16.68886 34.56884 5.361337 99.91280 5 yield G31 15.97985 31.29838 12.350068 101.69455 6 yield G10 15.61917 32.24828 11.747802 102.32827"},{"path":"https://apariciojohan.github.io/agriutilities/index.html","id":"exploring-factor-analytic-in-met-analysis","dir":"","previous_headings":"Automatic Data Analysis Pipeline","what":"Exploring Factor Analytic in MET analysis.","title":"Utilities for Data Analysis in Agriculture","text":"information learn described may find useful following sources: Isik, Holland, Maltecca (2017); Rodriguez-Alvarez et al. (2018).","code":"pvals <- met_results$trial_effects model <- met_results$met_models$yield fa_objt <- fa_summary( model = model, trial = \"trial\", genotype = \"genotype\", BLUEs_trial = pvals, k_biplot = 8, size_label_var = 4, filter_score = 1 ) fa_objt$plots$loadings_c fa_objt$plots$biplot"},{"path":"https://apariciojohan.github.io/agriutilities/index.html","id":"code-of-conduct","dir":"","previous_headings":"","what":"Code of Conduct","title":"Utilities for Data Analysis in Agriculture","text":"Please note agriutilities project released Contributor Code Conduct. contributing project, agree abide terms.","code":""},{"path":[]},{"path":"https://apariciojohan.github.io/agriutilities/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2023 agriutilities authors Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/check_connectivity.html","id":null,"dir":"Reference","previous_headings":"","what":"Check connectivity between trials — check_connectivity","title":"Check connectivity between trials — check_connectivity","text":"Check connectivity trials","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/check_connectivity.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Check connectivity between trials — check_connectivity","text":"","code":"check_connectivity( data = NULL, genotype = \"line\", trial = \"Experiment\", response = NULL, all = FALSE, return_matrix = FALSE )"},{"path":"https://apariciojohan.github.io/agriutilities/reference/check_connectivity.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Check connectivity between trials — check_connectivity","text":"data data.frame wide format. genotype character string indicating column data contains genotypes. trial character string indicating column data contains trials. response character string specifying trait. Whether print table. return_matrix logical value indicating user wants return (n_trial x n_trial) matrix amount genotypes shared pair trial. (FALSE default)","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/check_connectivity.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Check connectivity between trials — check_connectivity","text":"data.frame genotype connectivity. return_matrix TRUE, return n_trial x n_trial matrix amount genotypes shared pair trial.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/check_connectivity.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Check connectivity between trials — check_connectivity","text":"","code":"library(agridat) library(agriutilities) data(besag.met) dat <- besag.met head( check_connectivity( data = dat, genotype = \"gen\", trial = \"county\", response = \"yield\", all = TRUE, return_matrix = FALSE ) ) #> gen C1 C2 C3 C4 C5 C6 total n percent #> 1 G01 1 1 1 1 1 1 6 6 1 #> 2 G02 1 1 1 1 1 1 6 6 1 #> 3 G03 1 1 1 1 1 1 6 6 1 #> 4 G04 1 1 1 1 1 1 6 6 1 #> 5 G05 1 1 1 1 1 1 6 6 1 #> 6 G06 1 1 1 1 1 1 6 6 1"},{"path":"https://apariciojohan.github.io/agriutilities/reference/check_design_met.html","id":null,"dir":"Reference","previous_headings":"","what":"Check Experimental Design — check_design_met","title":"Check Experimental Design — check_design_met","text":"function helps identify experimental design trial, filters data provide summary traits experimental design. works quality check fit model. Returns object class checkAgri.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/check_design_met.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Check Experimental Design — check_design_met","text":"","code":"check_design_met( data = NULL, genotype = NULL, trial = NULL, traits = NULL, rep = NULL, block = NULL, row = NULL, col = NULL )"},{"path":"https://apariciojohan.github.io/agriutilities/reference/check_design_met.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Check Experimental Design — check_design_met","text":"data data.frame wide format. genotype character string indicating column data contains genotypes. trial character string indicating column data contains trials. traits character vector specifying traits models fitted. rep character string indicating column data contains replicates. block character string indicating column data contains sub blocks. row character string indicating column data contains row coordinates. col character string indicating column data contains column coordinates.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/check_design_met.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Check Experimental Design — check_design_met","text":"object class checkAgri, list : summ_traits data.frame containing summary traits. exp_design_resum data.frame containing summary experimental design. filter list trait containing filtered trials. exp_design_list data.frame containing experimental design trial. check_connectivity data.frame genotype connectivity. connectivity_matrix matrix amount genotypes shared pair trial. data_design data frame containing data used two additional columns, one realted experimental design sequential number (id) inputs list containing character string indicates column data contains genotype, trial, traits, rep, block, row col.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/check_design_met.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Check Experimental Design — check_design_met","text":"","code":"library(agridat) library(agriutilities) data(besag.met) dat <- besag.met results <- check_design_met( data = dat, genotype = \"gen\", trial = \"county\", traits = c(\"yield\"), rep = \"rep\", block = \"block\", col = \"col\", row = \"row\" ) print(results) #> --------------------------------------------------------------------- #> Summary Traits by Trial: #> --------------------------------------------------------------------- #> # A tibble: 6 × 11 #> county traits Min Mean Median Max SD CV n n_miss miss_perc #> #> 1 C1 yield 87.9 149. 151. 200. 17.7 0.119 198 6 0.0303 #> 2 C2 yield 24.4 56.1 52.1 125. 18.4 0.328 198 6 0.0303 #> 3 C3 yield 28.2 87.9 89.2 137. 19.7 0.225 198 6 0.0303 #> 4 C4 yield 103. 145. 143. 190. 17.1 0.118 198 6 0.0303 #> 5 C5 yield 66.9 115. 116. 152. 16.4 0.142 198 6 0.0303 #> 6 C6 yield 29.2 87.6 87.8 148. 26.6 0.304 198 6 0.0303 #> #> --------------------------------------------------------------------- #> Experimental Design Detected: #> --------------------------------------------------------------------- #> county exp_design #> 1 C1 row_col #> 2 C2 row_col #> 3 C3 row_col #> 4 C4 row_col #> 5 C5 row_col #> 6 C6 row_col #> #> --------------------------------------------------------------------- #> Summary Experimental Design: #> --------------------------------------------------------------------- #> # A tibble: 6 × 9 #> county n n_gen n_rep n_block n_col n_row num_of_reps num_of_gen #> #> 1 C1 198 64 3 8 11 18 3_9 63_1 #> 2 C2 198 64 3 8 11 18 3_9 63_1 #> 3 C3 198 64 3 8 11 18 3_9 63_1 #> 4 C4 198 64 3 8 11 18 3_9 63_1 #> 5 C5 198 64 3 8 11 18 3_9 63_1 #> 6 C6 198 64 3 8 11 18 3_9 63_1 #> #> --------------------------------------------------------------------- #> Connectivity Matrix: #> --------------------------------------------------------------------- #> C1 C2 C3 C4 C5 C6 #> C1 64 64 64 64 64 64 #> C2 64 64 64 64 64 64 #> C3 64 64 64 64 64 64 #> C4 64 64 64 64 64 64 #> C5 64 64 64 64 64 64 #> C6 64 64 64 64 64 64 #> #> --------------------------------------------------------------------- #> Filters Applied: #> --------------------------------------------------------------------- #> List of 1 #> $ yield:List of 4 #> ..$ missing_50% : chr(0) #> ..$ no_variation : chr(0) #> ..$ row_col_dup : chr(0) #> ..$ trials_to_remove: chr(0) #> plot(results, type = \"connectivity\") plot(results, type = \"missing\")"},{"path":"https://apariciojohan.github.io/agriutilities/reference/check_design_met_1.html","id":null,"dir":"Reference","previous_headings":"","what":"Check Experimental Design — check_design_met_1","title":"Check Experimental Design — check_design_met_1","text":"function helps identify experimental design trial, filters data provide summary traits experimental design. works quality check fit model. Returns object class checkAgri.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/check_design_met_1.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Check Experimental Design — check_design_met_1","text":"","code":"check_design_met_1( data = NULL, genotype = NULL, trial = NULL, traits = NULL, rep = NULL, block = NULL, row = NULL, col = NULL )"},{"path":"https://apariciojohan.github.io/agriutilities/reference/check_design_met_1.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Check Experimental Design — check_design_met_1","text":"data data.frame wide format. genotype character string indicating column data contains genotypes. trial character string indicating column data contains trials. traits character vector specifying traits models fitted. rep character string indicating column data contains replicates. block character string indicating column data contains sub blocks. row character string indicating column data contains row coordinates. col character string indicating column data contains column coordinates.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/check_design_met_1.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Check Experimental Design — check_design_met_1","text":"object class checkAgri, list : summ_traits data.frame containing summary traits. exp_design_resum data.frame containing summary experimental design. filter list trait containing filtered trials. exp_design_list data.frame containing experimental design trial. check_connectivity data.frame genotype connectivity. connectivity_matrix matrix amount genotypes shared pair trial. data_design data frame containing data used two additional columns, one realted experimental design sequential number (id) inputs list containing character string indicates column data contains genotype, trial, traits, rep, block, row col.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/check_design_met_1.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Check Experimental Design — check_design_met_1","text":"","code":"# \\donttest{ library(agridat) library(agriutilities) data(besag.met) dat <- besag.met results <- check_design_met_1( data = dat, genotype = \"gen\", trial = \"county\", traits = c(\"yield\"), rep = \"rep\", block = \"block\", col = \"col\", row = \"row\" ) print(results) #> --------------------------------------------------------------------- #> Summary Traits by Trial: #> --------------------------------------------------------------------- #> # A tibble: 6 x 9 #> county traits Mean Median SD CV n n_miss miss_perc #> #> 1 C1 yield 149. 151. 17.7 0.119 198 6 0.0303 #> 2 C2 yield 56.1 52.1 18.4 0.328 198 6 0.0303 #> 3 C3 yield 87.9 89.2 19.7 0.225 198 6 0.0303 #> 4 C4 yield 145. 143. 17.1 0.118 198 6 0.0303 #> 5 C5 yield 115. 116. 16.4 0.142 198 6 0.0303 #> 6 C6 yield 87.6 87.8 26.6 0.304 198 6 0.0303 #> #> --------------------------------------------------------------------- #> Experimental Design Detected: #> --------------------------------------------------------------------- #> county exp_design #> 1 C1 row_col #> 2 C2 row_col #> 3 C3 row_col #> 4 C4 row_col #> 5 C5 row_col #> 6 C6 row_col #> #> --------------------------------------------------------------------- #> Summary Experimental Design: #> --------------------------------------------------------------------- #> # A tibble: 6 x 9 #> county n n_gen n_rep n_block n_col n_row num_of_reps num_of_gen #> #> 1 C1 198 64 3 8 11 18 3_9 63_1 #> 2 C2 198 64 3 8 11 18 3_9 63_1 #> 3 C3 198 64 3 8 11 18 3_9 63_1 #> 4 C4 198 64 3 8 11 18 3_9 63_1 #> 5 C5 198 64 3 8 11 18 3_9 63_1 #> 6 C6 198 64 3 8 11 18 3_9 63_1 #> #> --------------------------------------------------------------------- #> Connectivity Matrix: #> --------------------------------------------------------------------- #> C1 C2 C3 C4 C5 C6 #> C1 64 64 64 64 64 64 #> C2 64 64 64 64 64 64 #> C3 64 64 64 64 64 64 #> C4 64 64 64 64 64 64 #> C5 64 64 64 64 64 64 #> C6 64 64 64 64 64 64 #> #> --------------------------------------------------------------------- #> Filters Applied: #> --------------------------------------------------------------------- #> List of 1 #> $ yield:List of 4 #> ..$ missing_50% : chr(0) #> ..$ no_variation : chr(0) #> ..$ row_col_dup : chr(0) #> ..$ trials_to_remove: chr(0) #> # Plotting Connectivity Matrix plot(results, type = \"connectivity\") # Plotting Missing Data plot(results, type = \"missing\") # }"},{"path":"https://apariciojohan.github.io/agriutilities/reference/connectivity_matrix.html","id":null,"dir":"Reference","previous_headings":"","what":"Connectivity Matrix — connectivity_matrix","title":"Connectivity Matrix — connectivity_matrix","text":"Check amount genotypes shared pair trial.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/connectivity_matrix.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Connectivity Matrix — connectivity_matrix","text":"","code":"connectivity_matrix( data = NULL, genotype = \"germplasmName\", trial = \"trial\", response = NULL )"},{"path":"https://apariciojohan.github.io/agriutilities/reference/connectivity_matrix.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Connectivity Matrix — connectivity_matrix","text":"data data.frame wide format. genotype character string indicating column data contains genotypes. trial character string indicating column data contains trials. response character string specifying trait.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/connectivity_matrix.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Connectivity Matrix — connectivity_matrix","text":"function generates (n_trial x n_trial) matrix amount genotypes shared pair trial.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/connectivity_matrix.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Connectivity Matrix — connectivity_matrix","text":"","code":"# \\donttest{ library(agridat) data(besag.met) dat <- besag.met connectivity_matrix( data = dat, genotype = \"gen\", trial = \"county\", response = \"yield\" ) #> C1 C2 C3 C4 C5 C6 #> C1 64 64 64 64 64 64 #> C2 64 64 64 64 64 64 #> C3 64 64 64 64 64 64 #> C4 64 64 64 64 64 64 #> C5 64 64 64 64 64 64 #> C6 64 64 64 64 64 64 # }"},{"path":"https://apariciojohan.github.io/agriutilities/reference/covcor_heat.html","id":null,"dir":"Reference","previous_headings":"","what":"Correlation Covariance Heatmap — covcor_heat","title":"Correlation Covariance Heatmap — covcor_heat","text":"Correlation Covariance Heatmap","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/covcor_heat.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Correlation Covariance Heatmap — covcor_heat","text":"","code":"covcor_heat( matrix, corr = TRUE, size = 4, digits = 3, legend = c(0.6, 0.7), upper_tri = FALSE, reorder = FALSE )"},{"path":"https://apariciojohan.github.io/agriutilities/reference/covcor_heat.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Correlation Covariance Heatmap — covcor_heat","text":"matrix numeric matrix. corr logical value indicating matrix scaled form (TRUE default, correlation matrix) size numeric value define letter size. digits numeric integer define number digits plot. legend position legends (\"none\", \"left\", \"right\", \"bottom\", \"top\", two-element numeric vector) upper_tri logical value plot Lower Upper Triangular Part matrix. FALSE default. reorder logical value reorder Hierarchical Clustering. FALSE default.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/covcor_heat.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Correlation Covariance Heatmap — covcor_heat","text":"ggplot object showing upper triangular elements matrix.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/covcor_heat.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Correlation Covariance Heatmap — covcor_heat","text":"","code":"library(agriutilities) data(iris) M <- cor(iris[, -5]) covcor_heat(matrix = M, corr = TRUE)"},{"path":"https://apariciojohan.github.io/agriutilities/reference/extract_rcov.html","id":null,"dir":"Reference","previous_headings":"","what":"Extract Residual Variance-Covariance from ASReml-R — extract_rcov","title":"Extract Residual Variance-Covariance from ASReml-R — extract_rcov","text":"function specially useful running repeated measurements models.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/extract_rcov.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Extract Residual Variance-Covariance from ASReml-R — extract_rcov","text":"","code":"extract_rcov(model = NULL, time = \"Time\", plot = \"Plot\", vc_error = NULL)"},{"path":"https://apariciojohan.github.io/agriutilities/reference/extract_rcov.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Extract Residual Variance-Covariance from ASReml-R — extract_rcov","text":"model asreml object time character string indicating \"Time\" plot character string indicating \"PlotID\" vc_error optional character string indicating variance covariance. Can \"corv\", \"us\", \"expv\", \"exph\", \"ar1v\", \"ar1h\" \"ante\". using NULL function tries guess variance-covariance used.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/extract_rcov.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Extract Residual Variance-Covariance from ASReml-R — extract_rcov","text":"object list : corr_mat matrix residual correlation time points vcov_mat matrix estimated residual variance-covariance time points vc character string indicating variance-covariance fitted.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/extract_rcov.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Extract Residual Variance-Covariance from ASReml-R — extract_rcov","text":"","code":"if (FALSE) { library(ggpubr) library(agriutilities) library(tidyverse) library(asreml) head(grassUV) str(grassUV) # Exploration ------------------------------------------------------------- grassUV %>% ggplot( aes(x = Time, y = y, group = Plant, color = Plant) ) + geom_point() + geom_line() + facet_wrap(~Tmt) + theme_minimal(base_size = 15) tmp <- grassUV %>% group_by(Time, Plant) %>% summarise(mean = mean(y, na.rm = TRUE)) %>% spread(Time, mean) %>% column_to_rownames(\"Plant\") gg_cor(tmp, label_size = 5) tmp %>% cor(use = \"pairwise.complete.obs\") %>% as.data.frame() %>% rownames_to_column(var = \"Time\") %>% gather(\"DAP2\", \"corr\", -1) %>% type.convert(as.is = FALSE) %>% mutate(corr = ifelse(Time < DAP2, NA, corr)) %>% mutate(DAP2 = as.factor(DAP2)) %>% ggplot( aes(x = Time, y = corr, group = DAP2, color = DAP2) ) + geom_point() + geom_line() + theme_minimal(base_size = 15) + color_palette(palette = \"jco\") + labs(color = \"Time\", y = \"Pearson Correlation\") # Modeling ---------------------------------------------------------------- # Identity variance model. model_0 <- asreml( fixed = y ~ Time + Tmt + Tmt:Time, residual = ~ id(Plant):idv(Time), data = grassUV ) # Simple correlation model; homogeneous variance form. model_1 <- asreml( fixed = y ~ Time + Tmt + Tmt:Time, residual = ~ id(Plant):corv(Time), data = grassUV ) # Exponential (or power) model; homogeneous variance form. model_2 <- asreml( fixed = y ~ Time + Tmt + Tmt:Time, residual = ~ id(Plant):expv(Time), data = grassUV ) # Exponential (or power) model; heterogeneous variance form. model_3 <- asreml( fixed = y ~ Time + Tmt + Tmt:Time, residual = ~ id(Plant):exph(Time), data = grassUV ) # Antedependence variance model of order 1 model_4 <- asreml( fixed = y ~ Time + Tmt + Tmt:Time, residual = ~ id(Plant):ante(Time), data = grassUV ) # Autoregressive model of order 1; homogeneous variance form. model_5 <- asreml( fixed = y ~ Time + Tmt + Tmt:Time, residual = ~ id(Plant):ar1v(Time), data = grassUV ) # Autoregressive model of order 1; heterogeneous variance form. model_6 <- asreml( fixed = y ~ Time + Tmt + Tmt:Time, residual = ~ id(Plant):ar1h(Time), data = grassUV ) # Unstructured variance model. model_7 <- asreml( fixed = y ~ Time + Tmt + Tmt:Time, residual = ~ id(Plant):us(Time), data = grassUV ) # Model Comparison -------------------------------------------------------- models <- list( \"id\" = model_0, \"cor\" = model_1, \"exp\" = model_2, \"exph\" = model_3, \"ante\" = model_4, \"ar1\" = model_5, \"ar1h\" = model_6, \"us\" = model_7 ) summary_models <- data.frame( model = names(models), aic = unlist(lapply(models, function(x) summary(x)$aic)), bic = unlist(lapply(models, function(x) summary(x)$bic)), loglik = unlist(lapply(models, function(x) summary(x)$loglik)), nedf = unlist(lapply(models, function(x) summary(x)$nedf)), param = unlist(lapply(models, function(x) attr(summary(x)$aic, \"param\"))), row.names = NULL ) summary_models %>% ggplot( aes(x = reorder(model, -bic), y = bic, group = 1) ) + geom_point(size = 2) + geom_text(aes(x = model, y = bic + 5, label = param)) + geom_line() + theme_minimal(base_size = 15) + labs(x = NULL) # Extracting Variance Covariance Matrix ----------------------------------- covcor_heat( matrix = extract_rcov(model_1, time = \"Time\", plot = \"Plant\")$corr, legend = \"none\", size = 5 ) + ggtitle(label = \"Uniform Correlation (corv)\") covcor_heat( matrix = extract_rcov(model_2, time = \"Time\", plot = \"Plant\")$corr, legend = \"none\", size = 5 ) + ggtitle(label = \"Exponetial (expv)\") }"},{"path":"https://apariciojohan.github.io/agriutilities/reference/extract_vcov.html","id":null,"dir":"Reference","previous_headings":"","what":"Extract Variance-Covariance from ASReml-R — extract_vcov","title":"Extract Variance-Covariance from ASReml-R — extract_vcov","text":"Extract Variance-Covariance ASReml-R","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/extract_vcov.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Extract Variance-Covariance from ASReml-R — extract_vcov","text":"","code":"extract_vcov(model = NULL, gen = \"genotype\", env = \"trial\", vc_model = \"corv\")"},{"path":"https://apariciojohan.github.io/agriutilities/reference/extract_vcov.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Extract Variance-Covariance from ASReml-R — extract_vcov","text":"model ASReml object gen character string indicating column data contains genotypes. env character string indicating column data contains environments trials. vc_model character string indicating variance-covariance fitted. Can 'diag', 'corv', 'corh', 'corgv', 'fa1', 'fa2', 'fa3', 'fa4', 'corgh', 'us' 'rr2'.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/extract_vcov.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Extract Variance-Covariance from ASReml-R — extract_vcov","text":"object list : VCOV matrix estimated variance-covariance trials. CORR n_trial x n_trial matrix correlation trials. vc_model character string indicating variance-covariance fitted.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/extract_vcov.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Extract Variance-Covariance from ASReml-R — extract_vcov","text":"","code":"if (FALSE) { library(agridat) library(agriutilities) data(besag.met) dat <- besag.met results <- check_design_met( data = dat, genotype = \"gen\", trial = \"county\", traits = c(\"yield\"), rep = \"rep\", block = \"block\", col = \"col\", row = \"row\" ) out <- single_trial_analysis(results, progress = FALSE) met_results <- met_analysis(out, progress = FALSE) extract_vcov( model = met_results$met_models$yield, vc_model = \"us\" ) }"},{"path":"https://apariciojohan.github.io/agriutilities/reference/fa2_summary.html","id":null,"dir":"Reference","previous_headings":"","what":"Factor Analytic Summary — fa2_summary","title":"Factor Analytic Summary — fa2_summary","text":"Factor Analytic Summary","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/fa2_summary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Factor Analytic Summary — fa2_summary","text":"","code":"fa2_summary( model = NULL, trial = \"trial\", genotype = \"genotype\", BLUEs_trial = NULL, mult_fa1 = -1, mult_fa2 = 1, filter_score = 1.5, k_biplot = 1, size_label_var = 2, alpha_label_var = 0.2, size_label_ind = 2, alpha_label_ind = 0.8, size_arrow = 0.2, alpha_arrow = 0.2, base_size = 12 )"},{"path":"https://apariciojohan.github.io/agriutilities/reference/fa2_summary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Factor Analytic Summary — fa2_summary","text":"model factor analytic model (asreml object) trial string genotype string BLUEs_trial data.frame trial BLUEs mult_fa1 c(1,-1) (-1 default) mult_fa2 c(1,-1) (1 default) filter_score value filter genotypes distance origin k_biplot factor multiply scores biplot size_label_var double alpha_label_var (0,1) size_label_ind double alpha_label_ind (0,1) size_arrow double alpha_arrow (0,1) base_size double","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/fa2_summary.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Factor Analytic Summary — fa2_summary","text":"list loadings = L, loading_star, Gvar, Cmat, summary_loadings, paf_site, var_tot, scores, plots = list(loadings, biplot, biplot_scaled, loadings_c)","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/fa2_summary.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Factor Analytic Summary — fa2_summary","text":"","code":"# library(tidyverse) # library(asreml) # library(agridat) # data(besag.met) # dat <- besag.met # # dat <- dat %>% arrange(county) # model <- asreml(fixed = yield ~ 1 + county, # random = ~ fa(county, 2):gen + county:rep + diag(county):rep:block, # residual = ~ dsum(~ units | county), # data = dat, # na.action = list(x=\"include\",y=\"include\")) # # pp <- predict(model, classify = \"county\")$pvals # fa2_summary( # model = model, # trial = \"county\", # genotype = \"gen\", # BLUEs_trial = pp, # mult_fa1 = -1, # mult_fa2 = -1, # filter_score = 1, # k_biplot = 10, # size_label_var = 3, # alpha_label_var = 0.5, # size_label_ind = 3, # alpha_label_ind = 0.8, # size_arrow = 0.2, # alpha_arrow = 0.1 # )"},{"path":"https://apariciojohan.github.io/agriutilities/reference/fa_summary.html","id":null,"dir":"Reference","previous_headings":"","what":"Factor Analytic Summary — fa_summary","title":"Factor Analytic Summary — fa_summary","text":"Factor Analytic Summary","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/fa_summary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Factor Analytic Summary — fa_summary","text":"","code":"fa_summary( model = NULL, trial = \"trial\", genotype = \"genotype\", BLUEs_trial = NULL, mult_fa1 = -1, mult_fa2 = 1, filter_score = 1.5, k_biplot = 1, size_label_var = 2, alpha_label_var = 0.2, size_label_ind = 2, alpha_label_ind = 0.8, size_arrow = 0.2, alpha_arrow = 0.2, base_size = 12 )"},{"path":"https://apariciojohan.github.io/agriutilities/reference/fa_summary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Factor Analytic Summary — fa_summary","text":"model Factor Analytic Model (ASReml object) trial character string indicating column data contains trials. genotype character string indicating column data contains genotypes. BLUEs_trial data.frame containing BLUEs trial. mult_fa1 constant multiply first loading. Must 1 -1. (-1 default) mult_fa2 constant multiply second loading. Must 1 -1. (1 default) filter_score numeric value filter genotypes distance origin. k_biplot numeric value multiply scores biplot. size_label_var numeric value define label size variables. alpha_label_var numeric value (0,1) define label variables. size_label_ind numeric value define label size individuals. alpha_label_ind numeric value (0,1) define label individuals. size_arrow numeric value define arrow size. alpha_arrow numeric value (0,1) define arrow. base_size numeric value define base size.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/fa_summary.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Factor Analytic Summary — fa_summary","text":"object list : loadings data.frame containing first second loading trial. loading_star data.frame containing first second loading rotated trial. Gvar matrix estimated variance-covariance trials. Cmat matrix correlation trials. summary_loading data.frame containing summary loadings. paf_site data.frame containing percentage variance explained component trial. var_tot numeric value total variance. scores data.frame containing scores genotype. plots list different plots. Includes plot loadings, biplot, biplot_scaled loadings_c.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/fa_summary.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Factor Analytic Summary — fa_summary","text":"","code":"if (FALSE) { library(agridat) library(agriutilities) data(besag.met) dat <- besag.met results <- check_design_met( data = dat, genotype = \"gen\", trial = \"county\", traits = c(\"yield\"), rep = \"rep\", block = \"block\", col = \"col\", row = \"row\" ) out <- single_trial_analysis(results, progress = FALSE) met_results <- met_analysis(out, vcov = \"fa2\", progress = FALSE) pp <- met_results$trial_effects model <- met_results$met_models$yield fa_summary( model = model, trial = \"trial\", genotype = \"genotype\", BLUEs_trial = pp, mult_fa1 = -1, mult_fa2 = -1, filter_score = 1, k_biplot = 10, size_label_var = 3, alpha_label_var = 0.5, size_label_ind = 3, alpha_label_ind = 0.8, size_arrow = 0.2, alpha_arrow = 0.1 ) }"},{"path":"https://apariciojohan.github.io/agriutilities/reference/ggCor.html","id":null,"dir":"Reference","previous_headings":"","what":"Triangular correlation plot — ggCor","title":"Triangular correlation plot — ggCor","text":"Return ggplot object plot triangular correlation figure 2 variables.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/ggCor.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Triangular correlation plot — ggCor","text":"","code":"ggCor( data, colours = c(\"#db4437\", \"white\", \"#FF9D00\"), blackLabs = c(-0.7, 0.7), showSignif = TRUE, pBreaks = c(0, 0.001, 0.01, 0.05, Inf), pLabels = c(\"***\", \"**\", \"*\", \"ns\"), showDiagonal = FALSE, Diag = NULL, returnTable = FALSE, returnN = FALSE, adjusted = TRUE, label_size = 3 )"},{"path":"https://apariciojohan.github.io/agriutilities/reference/ggCor.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Triangular correlation plot — ggCor","text":"data data.frame numerical columns variable compared. colours vector size three colors used values -1, 0 1. blackLabs numeric vector size two, min max correlation coefficient showSignif Logical scalar. Display significance values ? pBreaks Passed function 'cut'. Either numeric vector two unique cut points single number (greater equal 2) giving number intervals x cut. pLabels Passed function 'cut'. labels levels resulting category. default, labels constructed using \"(,b]\" interval notation. pLabels = FALSE, simple integer codes returned instead factor. showDiagonal Logical scalar. Display main diagonal values ? Diag named vector labels display main diagonal. names used place value corresponding coordinates diagonal. Hence, names must colnames data. returnTable Return table display instead ggplot object returnN Return plot shared information adjusted Use adjusted p values multiple testing instead raw coeffs. TRUE default. label_size Numeric value indicating label size. 3 default.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/ggCor.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Triangular correlation plot — ggCor","text":"ggplot object containing triangular correlation figure numeric variables data. returnTable TRUE, table used produce figure returned instead.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/ggCor.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Triangular correlation plot — ggCor","text":"Daniel Ariza, Johan Aparicio.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/ggCor.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Triangular correlation plot — ggCor","text":"","code":"# \\donttest{ data(iris) ggCor( data = iris, colours = c(\"#db4437\",\"white\",\"#4285f4\"), label_size = 6 ) #> Dropping non-numeric columns in the dataset: #> Species # }"},{"path":"https://apariciojohan.github.io/agriutilities/reference/gg_cor.html","id":null,"dir":"Reference","previous_headings":"","what":"Triangular Correlation Plot — gg_cor","title":"Triangular Correlation Plot — gg_cor","text":"Return ggplot object plot triangular correlation figure 2 variables.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/gg_cor.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Triangular Correlation Plot — gg_cor","text":"","code":"gg_cor( data, colours = c(\"#db4437\", \"white\", \"#4285f4\"), blackLabs = c(-0.7, 0.7), show_signif = TRUE, p_breaks = c(0, 0.001, 0.01, 0.05, Inf), p_labels = c(\"***\", \"**\", \"*\", \"ns\"), show_diagonal = FALSE, diag = NULL, return_table = FALSE, return_n = FALSE, adjusted = TRUE, label_size = 3, method = \"pearson\" )"},{"path":"https://apariciojohan.github.io/agriutilities/reference/gg_cor.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Triangular Correlation Plot — gg_cor","text":"data data.frame numerical columns variable compared. colours vector size three colors used values -1, 0 1. blackLabs numeric vector size two, min max correlation coefficient. show_signif Logical scalar. Display significance values ? p_breaks Passed function 'cut'. Either numeric vector two unique cut points single number (greater equal 2) giving number intervals x cut. p_labels Passed function 'cut'. labels levels resulting category. default, labels constructed using \"(,b]\" interval notation. p_labels = FALSE, simple integer codes returned instead factor. show_diagonal Logical scalar. Display main diagonal values ? diag named vector labels display main diagonal. names used place value corresponding coordinates diagonal. Hence, names must colnames data. return_table Return table display instead ggplot object. return_n Return plot shared information. adjusted Use adjusted p values multiple testing instead raw coeffs. TRUE default. label_size Numeric value indicating label size. 3 default. method method=\"pearson\" default value. alternatives passed cor \"spearman\" \"kendall\". last two much slower, particularly big data sets.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/gg_cor.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Triangular Correlation Plot — gg_cor","text":"ggplot object containing triangular correlation figure numeric variables data. return_table TRUE, table used produce figure returned instead.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/gg_cor.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Triangular Correlation Plot — gg_cor","text":"Daniel Ariza, Johan Aparicio.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/gg_cor.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Triangular Correlation Plot — gg_cor","text":"","code":"library(agriutilities) data(iris) gg_cor( data = iris, colours = c(\"#db4437\", \"white\", \"#4285f4\"), label_size = 6 ) #> Dropping non-numeric columns in the dataset: #> Species"},{"path":"https://apariciojohan.github.io/agriutilities/reference/heritability_fa.html","id":null,"dir":"Reference","previous_headings":"","what":"Heritability for Factor Analytic Models in ASReml-R — heritability_fa","title":"Heritability for Factor Analytic Models in ASReml-R — heritability_fa","text":"Heritability Factor Analytic Models ASReml-R","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/heritability_fa.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Heritability for Factor Analytic Models in ASReml-R — heritability_fa","text":"","code":"heritability_fa( model_fa = NULL, genotype = \"line\", env = \"loc\", vc_model = c(\"fa2\"), diag = FALSE )"},{"path":"https://apariciojohan.github.io/agriutilities/reference/heritability_fa.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Heritability for Factor Analytic Models in ASReml-R — heritability_fa","text":"model_fa Factor Analytic ASReml model genotype character string indicating column data contains genotypes. env character string indicating column data contains environments trials. vc_model character string indicating variance-covariance structure. Can \"fa1\", \"fa2\", \"fa3\", \"fa4\" \"us\". diag TRUE FALSE depending user want take elements diagonal variance-covariance matrix elements diagonal estimate heritability. FALSE default.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/heritability_fa.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Heritability for Factor Analytic Models in ASReml-R — heritability_fa","text":"object list : h2_cullis numerical value Cullis heritability estimate. h2_se numerical value Cullis heritability estimate based standard error.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/heritability_fa.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Heritability for Factor Analytic Models in ASReml-R — heritability_fa","text":"","code":"if (FALSE) { library(agridat) library(agriutilities) data(besag.met) dat <- besag.met results <- check_design_met( data = dat, genotype = \"gen\", trial = \"county\", traits = c(\"yield\"), rep = \"rep\", block = \"block\", col = \"col\", row = \"row\" ) out <- single_trial_analysis(results, progress = FALSE) met_results <- met_analysis(out, progress = FALSE) model <- met_results$met_models$yield heritability_fa( model_fa = model, genotype = \"genotype\", env = \"trial\", vc_model = \"us\" ) }"},{"path":"https://apariciojohan.github.io/agriutilities/reference/h_cullis.html","id":null,"dir":"Reference","previous_headings":"","what":"Cullis heritability for lme4 models — h_cullis","title":"Cullis heritability for lme4 models — h_cullis","text":"Cullis heritability lme4 models","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/h_cullis.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Cullis heritability for lme4 models — h_cullis","text":"","code":"h_cullis(model, genotype, re_MME = FALSE)"},{"path":"https://apariciojohan.github.io/agriutilities/reference/h_cullis.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Cullis heritability for lme4 models — h_cullis","text":"model Object class lmer. genotype character string indicating column data contains genotypes. re_MME logical value ask want reconstruct mixed models equations estimate Cullis heritability. (FALSE default)","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/h_cullis.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Cullis heritability for lme4 models — h_cullis","text":"numerical value Cullis heritability estimate. re_MME TRUE, list matrices mixed models equations returned.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/h_cullis.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Cullis heritability for lme4 models — h_cullis","text":"Paul Schmidt, Johan Aparicio.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/h_cullis.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Cullis heritability for lme4 models — h_cullis","text":"","code":"# \\donttest{ library(lme4) #> Loading required package: Matrix library(agridat) library(agriutilities) dat <- john.alpha g.ran <- lmer( formula = yield ~ rep + (1 | gen) + (1 | rep:block), data = dat ) h_cullis(model = g.ran, genotype = \"gen\") #> [1] 0.7979968 # }"},{"path":"https://apariciojohan.github.io/agriutilities/reference/met_analysis.html","id":null,"dir":"Reference","previous_headings":"","what":"Multi-Environmental Trial Analysis — met_analysis","title":"Multi-Environmental Trial Analysis — met_analysis","text":"results single_trial_analysis() function used met_analysis() fit multi-environmental trial models. Returns object class metAgri, list trial effects, BLUPs, heritability, variance components, stability models fitted.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/met_analysis.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Multi-Environmental Trial Analysis — met_analysis","text":"","code":"met_analysis( sma_output = NULL, h2_filter = 0.2, workspace = \"1gb\", vcov = NULL, filter_traits = NULL, remove_trials = NULL, progress = TRUE )"},{"path":"https://apariciojohan.github.io/agriutilities/reference/met_analysis.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Multi-Environmental Trial Analysis — met_analysis","text":"sma_output Object class smaAgri resulting executing single_trial_analysis() function. h2_filter Numeric value filter trials poor heritability. 0.2 default. workspace Sets workspace core REML routines form number optionally followed directly valid measurement unit. \"128mb\" default. vcov character string specifying Variance-Covariance structure fitted. Can \"fa2\", \"fa1\", \"us\", \"corh\" \"corv\". NULL function try fit \"us\" Variance-Covariance fails, try \"fa2\" \"fa1\". filter_traits character vector traits filter. NULL default. remove_trials character vector trials remove. NULL default. progress progress modeling printed. TRUE, every trait line output indicating model fitted.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/met_analysis.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Multi-Environmental Trial Analysis — met_analysis","text":"object class metAgri, list : trial_effects data.frame containing Trial BLUEs. overall_BLUPs data.frame containing Genotypic BLUPs across trials, trait. BLUPs_GxE data.frame containing Genotypic BLUPs trial/trait. VCOV list trait contanining variance-covariance fitted. stability data.frame containing several Stability coefficients resulting executing function stability(). heritability data.frame containing overall heritabilities trait. met_models list trait containing fitted models.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/met_analysis.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Multi-Environmental Trial Analysis — met_analysis","text":"","code":"if (FALSE) { library(agridat) library(agriutilities) data(besag.met) dat <- besag.met results <- check_design_met( data = dat, genotype = \"gen\", trial = \"county\", traits = c(\"yield\"), rep = \"rep\", block = \"block\", col = \"col\", row = \"row\" ) out <- single_trial_analysis(results, progress = FALSE) met_results <- met_analysis(out, progress = FALSE) print(met_results) covcor_heat(matrix = met_results$VCOV$yield$CORR) }"},{"path":"https://apariciojohan.github.io/agriutilities/reference/parameters_gg.html","id":null,"dir":"Reference","previous_headings":"","what":"Genetic Gain Parameters — parameters_gg","title":"Genetic Gain Parameters — parameters_gg","text":"Genetic Gain Parameters","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/parameters_gg.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Genetic Gain Parameters — parameters_gg","text":"","code":"parameters_gg(model, trait = \"trait\")"},{"path":"https://apariciojohan.github.io/agriutilities/reference/parameters_gg.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Genetic Gain Parameters — parameters_gg","text":"model Linear regression model (lm object) trait character string indicating column data contains trials.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/parameters_gg.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Genetic Gain Parameters — parameters_gg","text":"data.frame parameters linear regression (Slope, se_Slope, Intercept, r2, Pr(>F)) percentage Genetic Gain.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/parameters_gg.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Genetic Gain Parameters — parameters_gg","text":"","code":"# \\donttest{ library(ggplot2) library(agridat) library(magrittr) library(agriutilities) data(baker.barley.uniformity) dat <- baker.barley.uniformity head(dat) #> row col year yield #> 1 1 1 1924 2960 #> 2 1 2 1924 3060 #> 3 1 3 1924 3280 #> 4 1 4 1924 2570 #> 5 1 5 1924 2000 #> 6 1 6 1924 1800 model <- lm(yield ~ year, dat) dat %>% na.omit() %>% ggplot( aes(x = year, y = yield) ) + geom_point() + geom_smooth(method = \"lm\") + theme_bw() #> `geom_smooth()` using formula = 'y ~ x' parameters_gg(model = model, trait = \"yield\") #> trait first_year last_year Slope se_Slope Intercept r2 #> Regression yield 1924 1935 -109.7417 7.97398 214307.5 0.2507339 #> Pr(>F) Genetic_Gain% #> Regression 2.215553e-37 -3.468011 # }"},{"path":"https://apariciojohan.github.io/agriutilities/reference/pipe.html","id":null,"dir":"Reference","previous_headings":"","what":"Pipe operator — %>%","title":"Pipe operator — %>%","text":"See magrittr::%>% details.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/pipe.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Pipe operator — %>%","text":"","code":"lhs %>% rhs"},{"path":"https://apariciojohan.github.io/agriutilities/reference/pipe.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Pipe operator — %>%","text":"lhs value magrittr placeholder. rhs function call using magrittr semantics.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/pipe.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Pipe operator — %>%","text":"result calling `rhs(lhs)`.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/plot.checkAgri.html","id":null,"dir":"Reference","previous_headings":"","what":"Plot an object of class checkAgri — plot.checkAgri","title":"Plot an object of class checkAgri — plot.checkAgri","text":"Create several plots object class checkAgri","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/plot.checkAgri.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plot an object of class checkAgri — plot.checkAgri","text":"","code":"# S3 method for checkAgri plot( x, type = c(\"connectivity\", \"missing\", \"boxplot\"), axis_size = 15, text_size = 5, ... )"},{"path":"https://apariciojohan.github.io/agriutilities/reference/plot.checkAgri.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plot an object of class checkAgri — plot.checkAgri","text":"x object inheriting class checkAgri resulting executing function check_design_met() type character string specifiying type plot. \"connectivity\", \"missing\" \"boxplot\". axis_size Numeric input define axis size. text_size Numeric input define text size. ... graphical parameters. future improvements.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/plot.checkAgri.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Plot an object of class checkAgri — plot.checkAgri","text":"ggplot object.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/plot.checkAgri.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Plot an object of class checkAgri — plot.checkAgri","text":"Johan Aparicio [aut]","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/plot.checkAgri.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Plot an object of class checkAgri — plot.checkAgri","text":"","code":"library(agridat) library(agriutilities) data(besag.met) dat <- besag.met results <- check_design_met( data = dat, genotype = \"gen\", trial = \"county\", traits = c(\"yield\"), rep = \"rep\", block = \"block\", col = \"col\", row = \"row\" ) plot(results, type = \"missing\") plot(results, type = \"boxplot\") #> Warning: Removed 36 rows containing non-finite values (`stat_boxplot()`)."},{"path":"https://apariciojohan.github.io/agriutilities/reference/plot.metAgri.html","id":null,"dir":"Reference","previous_headings":"","what":"Plot an object of class metAgri — plot.metAgri","title":"Plot an object of class metAgri — plot.metAgri","text":"Create several plots object class metAgri","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/plot.metAgri.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plot an object of class metAgri — plot.metAgri","text":"","code":"# S3 method for metAgri plot( x, type = c(\"correlation\", \"covariance\", \"multi_traits\"), filter_traits = NULL, text_size = 4, ... )"},{"path":"https://apariciojohan.github.io/agriutilities/reference/plot.metAgri.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plot an object of class metAgri — plot.metAgri","text":"x object inheriting class metAgri resulting executing function met_analysis() type character string specifying type plot. \"correlation\", \"covariance\" \"multi_traits\" filter_traits optional character vector filter traits. text_size Numeric input define text size. ... graphical parameters passed covcor_heat().","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/plot.metAgri.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Plot an object of class metAgri — plot.metAgri","text":"ggplot object.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/plot.metAgri.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Plot an object of class metAgri — plot.metAgri","text":"Johan Aparicio [aut]","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/plot.metAgri.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Plot an object of class metAgri — plot.metAgri","text":"","code":"if (FALSE) { library(agridat) library(agriutilities) data(besag.met) dat <- besag.met results <- check_design_met( data = dat, genotype = \"gen\", trial = \"county\", traits = c(\"yield\"), rep = \"rep\", block = \"block\", col = \"col\", row = \"row\" ) out <- single_trial_analysis(results, progress = FALSE) met_results <- met_analysis(out, progress = FALSE) print(met_results) plot(met_results, type = \"correlation\") plot(met_results, type = \"covariance\") }"},{"path":"https://apariciojohan.github.io/agriutilities/reference/plot.smaAgri.html","id":null,"dir":"Reference","previous_headings":"","what":"Plot an object of class smaAgri — plot.smaAgri","title":"Plot an object of class smaAgri — plot.smaAgri","text":"Create several plots object class smaAgri","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/plot.smaAgri.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plot an object of class smaAgri — plot.smaAgri","text":"","code":"# S3 method for smaAgri plot( x, type = c(\"summary\", \"correlation\", \"spatial\"), filter_traits = NULL, nudge_y_cv = 3, nudge_y_h2 = 0.07, horizontal = FALSE, theme_size = 15, axis_size = 8, text_size = 4, ... )"},{"path":"https://apariciojohan.github.io/agriutilities/reference/plot.smaAgri.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plot an object of class smaAgri — plot.smaAgri","text":"x object inheriting class smaAgri resulting executing function single_trial_analysis() type character string specifiying type plot. \"summary\", \"correlation\" \"spatial\". filter_traits optional character vector filter traits. nudge_y_cv Vertical adjustment nudge labels plotting CV bars. works argument type \"summary\". 3 default. nudge_y_h2 Vertical adjustment nudge labels plotting h2 bars. works argument type \"summary\". 0.07 default. horizontal FALSE, default, labels plotted vertically. TRUE, labels plotted horizontally. theme_size Base font size, given pts. 15 default. axis_size Numeric input define axis size. text_size Numeric input define text size. ... graphical parameters. future improvements.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/plot.smaAgri.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Plot an object of class smaAgri — plot.smaAgri","text":"ggplot object.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/plot.smaAgri.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Plot an object of class smaAgri — plot.smaAgri","text":"Johan Aparicio [aut]","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/plot.smaAgri.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Plot an object of class smaAgri — plot.smaAgri","text":"","code":"# \\donttest{ library(agridat) library(agriutilities) data(besag.met) dat <- besag.met results <- check_design_met( data = dat, genotype = \"gen\", trial = \"county\", traits = c(\"yield\"), rep = \"rep\", block = \"block\", col = \"col\", row = \"row\" ) out <- single_trial_analysis(results, progress = FALSE) print(out) #> --------------------------------------------------------------------- #> Summary Fitted Models: #> --------------------------------------------------------------------- #> trait trial heritability CV VarGen VarErr design #> 1: yield C1 0.73 6.022489 87.39848 82.86095 row_col #> 2: yield C2 0.37 17.104998 25.80684 108.68546 row_col #> 3: yield C3 0.64 12.357202 83.57907 118.55567 row_col #> 4: yield C4 0.41 8.179408 35.75568 136.21218 row_col #> 5: yield C5 0.80 7.037586 103.79822 66.97523 row_col #> 6: yield C6 0.49 16.632367 71.92232 207.53073 row_col #> #> --------------------------------------------------------------------- #> Outliers Removed: #> --------------------------------------------------------------------- #> trait trial genotype id outlier #> 1: yield C1 G60 50 TRUE #> #> --------------------------------------------------------------------- #> First Predicted Values and Standard Errors (BLUEs/BLUPs): #> --------------------------------------------------------------------- #> trait genotype trial BLUEs seBLUEs BLUPs seBLUPs wt #> 1: yield G01 C1 141.4161 6.078858 143.5308 5.249771 0.02706176 #> 2: yield G02 C1 157.8110 5.979708 155.8037 5.194547 0.02796663 #> 3: yield G03 C1 127.3836 6.091534 133.0256 5.269999 0.02694925 #> 4: yield G04 C1 154.8445 6.093866 153.8364 5.270427 0.02692863 #> 5: yield G05 C1 163.8950 6.132141 161.1831 5.271809 0.02659352 #> 6: yield G06 C1 128.5168 6.087902 133.6857 5.247130 0.02698141 #> plot(out, type = \"summary\", horizontal = TRUE) #> Warning: The `facets` argument of `facet_grid()` is deprecated as of ggplot2 2.2.0. #> ℹ Please use the `rows` argument instead. #> ℹ The deprecated feature was likely used in the agriutilities package. #> Please report the issue at #> . plot(out, type = \"correlation\") plot(out, type = \"spatial\") # }"},{"path":"https://apariciojohan.github.io/agriutilities/reference/print.checkAgri.html","id":null,"dir":"Reference","previous_headings":"","what":"Print an object of class checkAgri — print.checkAgri","title":"Print an object of class checkAgri — print.checkAgri","text":"Prints information check_design_met() function.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/print.checkAgri.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Print an object of class checkAgri — print.checkAgri","text":"","code":"# S3 method for checkAgri print(x, ...)"},{"path":"https://apariciojohan.github.io/agriutilities/reference/print.checkAgri.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Print an object of class checkAgri — print.checkAgri","text":"x object fitted function check_design_met(). ... Options used tibble package format output. See `tibble::print()` details.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/print.checkAgri.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Print an object of class checkAgri — print.checkAgri","text":"object inheriting class checkAgri.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/print.checkAgri.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Print an object of class checkAgri — print.checkAgri","text":"Johan Aparicio [aut]","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/print.checkAgri.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Print an object of class checkAgri — print.checkAgri","text":"","code":"library(agridat) library(agriutilities) data(besag.met) dat <- besag.met results <- check_design_met( data = dat, genotype = \"gen\", trial = \"county\", traits = c(\"yield\"), rep = \"rep\", block = \"block\", col = \"col\", row = \"row\" ) print(results) #> --------------------------------------------------------------------- #> Summary Traits by Trial: #> --------------------------------------------------------------------- #> # A tibble: 6 × 11 #> county traits Min Mean Median Max SD CV n n_miss miss_perc #> #> 1 C1 yield 87.9 149. 151. 200. 17.7 0.119 198 6 0.0303 #> 2 C2 yield 24.4 56.1 52.1 125. 18.4 0.328 198 6 0.0303 #> 3 C3 yield 28.2 87.9 89.2 137. 19.7 0.225 198 6 0.0303 #> 4 C4 yield 103. 145. 143. 190. 17.1 0.118 198 6 0.0303 #> 5 C5 yield 66.9 115. 116. 152. 16.4 0.142 198 6 0.0303 #> 6 C6 yield 29.2 87.6 87.8 148. 26.6 0.304 198 6 0.0303 #> #> --------------------------------------------------------------------- #> Experimental Design Detected: #> --------------------------------------------------------------------- #> county exp_design #> 1 C1 row_col #> 2 C2 row_col #> 3 C3 row_col #> 4 C4 row_col #> 5 C5 row_col #> 6 C6 row_col #> #> --------------------------------------------------------------------- #> Summary Experimental Design: #> --------------------------------------------------------------------- #> # A tibble: 6 × 9 #> county n n_gen n_rep n_block n_col n_row num_of_reps num_of_gen #> #> 1 C1 198 64 3 8 11 18 3_9 63_1 #> 2 C2 198 64 3 8 11 18 3_9 63_1 #> 3 C3 198 64 3 8 11 18 3_9 63_1 #> 4 C4 198 64 3 8 11 18 3_9 63_1 #> 5 C5 198 64 3 8 11 18 3_9 63_1 #> 6 C6 198 64 3 8 11 18 3_9 63_1 #> #> --------------------------------------------------------------------- #> Connectivity Matrix: #> --------------------------------------------------------------------- #> C1 C2 C3 C4 C5 C6 #> C1 64 64 64 64 64 64 #> C2 64 64 64 64 64 64 #> C3 64 64 64 64 64 64 #> C4 64 64 64 64 64 64 #> C5 64 64 64 64 64 64 #> C6 64 64 64 64 64 64 #> #> --------------------------------------------------------------------- #> Filters Applied: #> --------------------------------------------------------------------- #> List of 1 #> $ yield:List of 4 #> ..$ missing_50% : chr(0) #> ..$ no_variation : chr(0) #> ..$ row_col_dup : chr(0) #> ..$ trials_to_remove: chr(0) #>"},{"path":"https://apariciojohan.github.io/agriutilities/reference/print.metAgri.html","id":null,"dir":"Reference","previous_headings":"","what":"Print an object of class metAgri — print.metAgri","title":"Print an object of class metAgri — print.metAgri","text":"Prints information met_analysis() function.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/print.metAgri.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Print an object of class metAgri — print.metAgri","text":"","code":"# S3 method for metAgri print(x, ...)"},{"path":"https://apariciojohan.github.io/agriutilities/reference/print.metAgri.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Print an object of class metAgri — print.metAgri","text":"x object fitted function met_analysis(). ... Options used tibble package format output. See `tibble::print()` details.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/print.metAgri.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Print an object of class metAgri — print.metAgri","text":"object inheriting class metAgri.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/print.metAgri.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Print an object of class metAgri — print.metAgri","text":"Johan Aparicio [aut]","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/print.metAgri.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Print an object of class metAgri — print.metAgri","text":"","code":"if (FALSE) { library(agridat) library(agriutilities) data(besag.met) dat <- besag.met results <- check_design_met( data = dat, genotype = \"gen\", trial = \"county\", traits = c(\"yield\"), rep = \"rep\", block = \"block\", col = \"col\", row = \"row\" ) out <- single_trial_analysis(results, progress = FALSE) met_results <- met_analysis(out, progress = FALSE) print(met_results) }"},{"path":"https://apariciojohan.github.io/agriutilities/reference/print.smaAgri.html","id":null,"dir":"Reference","previous_headings":"","what":"Print an object of class smaAgri — print.smaAgri","title":"Print an object of class smaAgri — print.smaAgri","text":"Prints information single_trial_analysis function.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/print.smaAgri.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Print an object of class smaAgri — print.smaAgri","text":"","code":"# S3 method for smaAgri print(x, ...)"},{"path":"https://apariciojohan.github.io/agriutilities/reference/print.smaAgri.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Print an object of class smaAgri — print.smaAgri","text":"x object fitted function single_trial_analysis(). ... Options used tibble package format output. See `tibble::print()` details.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/print.smaAgri.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Print an object of class smaAgri — print.smaAgri","text":"object inheriting class smaAgri.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/print.smaAgri.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Print an object of class smaAgri — print.smaAgri","text":"Johan Aparicio [aut]","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/print.smaAgri.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Print an object of class smaAgri — print.smaAgri","text":"","code":"# \\donttest{ library(agridat) library(agriutilities) data(besag.met) dat <- besag.met results <- check_design_met( data = dat, genotype = \"gen\", trial = \"county\", traits = c(\"yield\"), rep = \"rep\", block = \"block\", col = \"col\", row = \"row\" ) out <- single_trial_analysis(results, progress = FALSE) print(out) #> --------------------------------------------------------------------- #> Summary Fitted Models: #> --------------------------------------------------------------------- #> trait trial heritability CV VarGen VarErr design #> 1: yield C1 0.73 6.022489 87.39848 82.86095 row_col #> 2: yield C2 0.37 17.104998 25.80684 108.68546 row_col #> 3: yield C3 0.64 12.357202 83.57907 118.55567 row_col #> 4: yield C4 0.41 8.179408 35.75568 136.21218 row_col #> 5: yield C5 0.80 7.037586 103.79822 66.97523 row_col #> 6: yield C6 0.49 16.632367 71.92232 207.53073 row_col #> #> --------------------------------------------------------------------- #> Outliers Removed: #> --------------------------------------------------------------------- #> trait trial genotype id outlier #> 1: yield C1 G60 50 TRUE #> #> --------------------------------------------------------------------- #> First Predicted Values and Standard Errors (BLUEs/BLUPs): #> --------------------------------------------------------------------- #> trait genotype trial BLUEs seBLUEs BLUPs seBLUPs wt #> 1: yield G01 C1 141.4161 6.078858 143.5308 5.249771 0.02706176 #> 2: yield G02 C1 157.8110 5.979708 155.8037 5.194547 0.02796663 #> 3: yield G03 C1 127.3836 6.091534 133.0256 5.269999 0.02694925 #> 4: yield G04 C1 154.8445 6.093866 153.8364 5.270427 0.02692863 #> 5: yield G05 C1 163.8950 6.132141 161.1831 5.271809 0.02659352 #> 6: yield G06 C1 128.5168 6.087902 133.6857 5.247130 0.02698141 #> # }"},{"path":"https://apariciojohan.github.io/agriutilities/reference/single_trial_analysis.html","id":null,"dir":"Reference","previous_headings":"","what":"Single Trial Analysis — single_trial_analysis","title":"Single Trial Analysis — single_trial_analysis","text":"results check_design_met() function used single_trial_analysis() fit single trial models. function can fit, Completely Randomized Designs (CRD), Randomized Complete Block Designs (RCBD), Resolvable Incomplete Block Designs (res-IBD), Non-Resolvable Row-Column Designs (Row-Col) Resolvable Row-Column Designs (res-Row-Col). Returns object class smaAgri, list trial summary, BLUEs, BLUPs, heritability, variance components, potential extreme observations, residuals, models fitted data used. function generate required output used two-stage analysis.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/single_trial_analysis.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Single Trial Analysis — single_trial_analysis","text":"","code":"single_trial_analysis( results = NULL, progress = TRUE, engine = \"asreml\", remove_outliers = TRUE )"},{"path":"https://apariciojohan.github.io/agriutilities/reference/single_trial_analysis.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Single Trial Analysis — single_trial_analysis","text":"results Object class checkAgri resulting executing check_design_met() function. progress progress modeling printed. TRUE, every trial line output indicating traits fitted particular trial. engine character string specifying name mixed modeling engine use, either lme4 asreml. spatial designs, SpATS always used, designs asreml default. remove_outliers outliers removed? TRUE default.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/single_trial_analysis.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Single Trial Analysis — single_trial_analysis","text":"object class smaAgri, list : fitted_models list containing fitted models. (models, one Genotype Random one Genotype Fixed) resum_fitted_model data.frame containing summary fitted models. outliers data.frame containing extreme observations. remove_outliers TRUE, data.frame contain observations removed. blues_blups data.frame containing BLUPs/BLUEs genotypes trial. std_residuals data.frame containing standardized residuals model genotype random component. data data.frame containing data used. remove_outliers TRUE, data missing values outliers detected.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/single_trial_analysis.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Single Trial Analysis — single_trial_analysis","text":"","code":"# \\donttest{ library(agridat) library(agriutilities) data(besag.met) dat <- besag.met results <- check_design_met( data = dat, genotype = \"gen\", trial = \"county\", traits = c(\"yield\"), rep = \"rep\", block = \"block\", col = \"col\", row = \"row\" ) out <- single_trial_analysis(results, progress = FALSE) print(out) #> --------------------------------------------------------------------- #> Summary Fitted Models: #> --------------------------------------------------------------------- #> trait trial heritability CV VarGen VarErr design #> 1: yield C1 0.73 6.022489 87.39848 82.86095 row_col #> 2: yield C2 0.37 17.104998 25.80684 108.68546 row_col #> 3: yield C3 0.64 12.357202 83.57907 118.55567 row_col #> 4: yield C4 0.41 8.179408 35.75568 136.21218 row_col #> 5: yield C5 0.80 7.037586 103.79822 66.97523 row_col #> 6: yield C6 0.49 16.632367 71.92232 207.53073 row_col #> #> --------------------------------------------------------------------- #> Outliers Removed: #> --------------------------------------------------------------------- #> trait trial genotype id outlier #> 1: yield C1 G60 50 TRUE #> #> --------------------------------------------------------------------- #> First Predicted Values and Standard Errors (BLUEs/BLUPs): #> --------------------------------------------------------------------- #> trait genotype trial BLUEs seBLUEs BLUPs seBLUPs wt #> 1: yield G01 C1 141.4161 6.078858 143.5308 5.249771 0.02706176 #> 2: yield G02 C1 157.8110 5.979708 155.8037 5.194547 0.02796663 #> 3: yield G03 C1 127.3836 6.091534 133.0256 5.269999 0.02694925 #> 4: yield G04 C1 154.8445 6.093866 153.8364 5.270427 0.02692863 #> 5: yield G05 C1 163.8950 6.132141 161.1831 5.271809 0.02659352 #> 6: yield G06 C1 128.5168 6.087902 133.6857 5.247130 0.02698141 #> # }"},{"path":"https://apariciojohan.github.io/agriutilities/reference/stability.html","id":null,"dir":"Reference","previous_headings":"","what":"Stability Coefficients — stability","title":"Stability Coefficients — stability","text":"Stability Coefficients","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/stability.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Stability Coefficients — stability","text":"","code":"stability( predictions = NULL, genotype = NULL, trial = NULL, response = NULL, best = \"max\" )"},{"path":"https://apariciojohan.github.io/agriutilities/reference/stability.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Stability Coefficients — stability","text":"predictions data.frame one value per GxE combination. genotype character string indicating column predictions contains genotypes. trial character string indicating column predictions contains trials. response character string specifying response variable. best character string specifying define best genotype numeric value (\"min\", \"max\"). \"max\" default.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/stability.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Stability Coefficients — stability","text":"data.frame several stability measures. \"superiority\" (cultivar-superiority measure), \"static\" (Shukla's stability variance) \"wricke\" (Wricke's ecovalence).","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/stability.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Stability Coefficients — stability","text":"","code":"if (FALSE) { library(agridat) library(agriutilities) data(besag.met) dat <- besag.met results <- check_design_met( data = dat, genotype = \"gen\", trial = \"county\", traits = c(\"yield\"), rep = \"rep\", block = \"block\", col = \"col\", row = \"row\" ) out <- single_trial_analysis(results, progress = FALSE) met_results <- met_analysis(out, progress = FALSE) head( stability( predictions = met_results$BLUPs_GxE, genotype = \"genotype\", trial = \"trial\", response = \"predicted.value\" ) ) }"},{"path":"https://apariciojohan.github.io/agriutilities/news/index.html","id":"agriutilities-120","dir":"Changelog","previous_headings":"","what":"agriutilities 1.2.0","title":"agriutilities 1.2.0","text":"CRAN release: 2024-01-20 Add extract_rcov() extract variance-covariance matrices. Add method passed cor function gg_cor() function. Change style naming parameters gg_cor(). Minor changes writing style.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/news/index.html","id":"agriutilities-110","dir":"Changelog","previous_headings":"","what":"agriutilities 1.1.0","title":"agriutilities 1.1.0","text":"CRAN release: 2023-03-19","code":""},{"path":"https://apariciojohan.github.io/agriutilities/news/index.html","id":"minor-changesfixes-1-1-0","dir":"Changelog","previous_headings":"","what":"Minor changes/fixes","title":"agriutilities 1.1.0","text":"Add type = \"spatial\" plot.smaAgri() method. Add restriction identifying row-column designs. Add minimum maximum value returning summary check_design_met(). Add S3 method plot object class metAgri plot.metAgri(). Add S3 method plot object class smaAgri plot.smaAgri(). Fix argument working covcor_heat().","code":""},{"path":"https://apariciojohan.github.io/agriutilities/news/index.html","id":"agriutilities-100","dir":"Changelog","previous_headings":"","what":"agriutilities 1.0.0","title":"agriutilities 1.0.0","text":"CRAN release: 2023-02-16","code":""}] +[{"path":"https://apariciojohan.github.io/agriutilities/articles/how-to-start.html","id":"identify-the-experimental-design","dir":"Articles","previous_headings":"","what":"Identify the Experimental Design","title":"How to Start","text":"function check_design_met helps us check quality data also identify experimental design trials. works quality check quality control fit model.","code":"library(agriutilities) library(agridat) data(besag.met) dat <- besag.met results <- check_design_met( data = dat, genotype = \"gen\", trial = \"county\", traits = \"yield\", rep = \"rep\", block = \"block\", col = \"col\", row = \"row\" ) print(results) #> --------------------------------------------------------------------- #> Summary Traits by Trial: #> --------------------------------------------------------------------- #> # A tibble: 6 × 11 #> county traits Min Mean Median Max SD CV n n_miss miss_perc #> #> 1 C1 yield 87.9 149. 151. 200. 17.7 0.119 198 6 0.0303 #> 2 C2 yield 24.4 56.1 52.1 125. 18.4 0.328 198 6 0.0303 #> 3 C3 yield 28.2 87.9 89.2 137. 19.7 0.225 198 6 0.0303 #> 4 C4 yield 103. 145. 143. 190. 17.1 0.118 198 6 0.0303 #> 5 C5 yield 66.9 115. 116. 152. 16.4 0.142 198 6 0.0303 #> 6 C6 yield 29.2 87.6 87.8 148. 26.6 0.304 198 6 0.0303 #> #> --------------------------------------------------------------------- #> Experimental Design Detected: #> --------------------------------------------------------------------- #> county exp_design #> 1 C1 row_col #> 2 C2 row_col #> 3 C3 row_col #> 4 C4 row_col #> 5 C5 row_col #> 6 C6 row_col #> #> --------------------------------------------------------------------- #> Summary Experimental Design: #> --------------------------------------------------------------------- #> # A tibble: 6 × 9 #> county n n_gen n_rep n_block n_col n_row num_of_reps num_of_gen #> #> 1 C1 198 64 3 8 11 18 3_9 63_1 #> 2 C2 198 64 3 8 11 18 3_9 63_1 #> 3 C3 198 64 3 8 11 18 3_9 63_1 #> 4 C4 198 64 3 8 11 18 3_9 63_1 #> 5 C5 198 64 3 8 11 18 3_9 63_1 #> 6 C6 198 64 3 8 11 18 3_9 63_1 #> #> --------------------------------------------------------------------- #> Connectivity Matrix: #> --------------------------------------------------------------------- #> C1 C2 C3 C4 C5 C6 #> C1 64 64 64 64 64 64 #> C2 64 64 64 64 64 64 #> C3 64 64 64 64 64 64 #> C4 64 64 64 64 64 64 #> C5 64 64 64 64 64 64 #> C6 64 64 64 64 64 64 #> #> --------------------------------------------------------------------- #> Filters Applied: #> --------------------------------------------------------------------- #> List of 1 #> $ yield:List of 4 #> ..$ missing_50% : chr(0) #> ..$ no_variation : chr(0) #> ..$ row_col_dup : chr(0) #> ..$ trials_to_remove: chr(0)"},{"path":"https://apariciojohan.github.io/agriutilities/articles/how-to-start.html","id":"single-trial-analysis","dir":"Articles","previous_headings":"","what":"Single Trial Analysis","title":"How to Start","text":"results previous function used single_trial_analysis() fit single trial models.","code":"obj <- single_trial_analysis(results, progress = FALSE) print(obj) #> --------------------------------------------------------------------- #> Summary Fitted Models: #> --------------------------------------------------------------------- #> trait trial heritability CV VarGen VarErr design #> 1: yield C1 0.73 6.022489 87.39848 82.86095 row_col #> 2: yield C2 0.37 17.104998 25.80684 108.68546 row_col #> 3: yield C3 0.64 12.357202 83.57907 118.55567 row_col #> 4: yield C4 0.41 8.179408 35.75568 136.21218 row_col #> 5: yield C5 0.80 7.037586 103.79822 66.97523 row_col #> 6: yield C6 0.49 16.632367 71.92232 207.53073 row_col #> #> --------------------------------------------------------------------- #> Outliers Removed: #> --------------------------------------------------------------------- #> trait trial genotype id outlier #> 1: yield C1 G60 50 TRUE #> #> --------------------------------------------------------------------- #> First Predicted Values and Standard Errors (BLUEs/BLUPs): #> --------------------------------------------------------------------- #> trait genotype trial BLUEs seBLUEs BLUPs seBLUPs wt #> 1: yield G01 C1 141.4161 6.078858 143.5308 5.249771 0.02706176 #> 2: yield G02 C1 157.8110 5.979708 155.8037 5.194547 0.02796663 #> 3: yield G03 C1 127.3836 6.091534 133.0256 5.269999 0.02694925 #> 4: yield G04 C1 154.8445 6.093866 153.8364 5.270427 0.02692863 #> 5: yield G05 C1 163.8950 6.132141 161.1831 5.271809 0.02659352 #> 6: yield G06 C1 128.5168 6.087902 133.6857 5.247130 0.02698141"},{"path":"https://apariciojohan.github.io/agriutilities/articles/how-to-start.html","id":"multi-environmental-trial-analysis","dir":"Articles","previous_headings":"","what":"Multi-Environmental Trial Analysis","title":"How to Start","text":"results previous function used met_analysis() fit multi-environmental trial models.","code":"met_results <- met_analysis(obj) print(met_results) #> Online License checked out Mon Jan 22 10:33:16 2024 #> Fitting MET model for yield. #> --------------------------------------------------------------------- #> Trial Effects (BLUEs): #> --------------------------------------------------------------------- #> trait trial predicted.value std.error status #> 1 yield C1 149.74946 1.358117 Estimable #> 2 yield C2 65.99561 1.141995 Estimable #> 3 yield C3 90.60825 1.449096 Estimable #> 4 yield C4 148.12392 1.202934 Estimable #> 5 yield C5 121.77612 1.429239 Estimable #> 6 yield C6 88.31194 1.532688 Estimable #> #> --------------------------------------------------------------------- #> Heritability: #> --------------------------------------------------------------------- #> trait h2 #> 1 yield 0.8239191 #> #> --------------------------------------------------------------------- #> First Overall Predicted Values and Standard Errors (BLUPs): #> --------------------------------------------------------------------- #> trait genotype predicted.value std.error status #> 1 yield G01 110.4297 2.528111 Estimable #> 2 yield G02 110.8617 2.537200 Estimable #> 3 yield G03 102.6812 2.541066 Estimable #> 4 yield G04 115.4946 2.533730 Estimable #> 5 yield G05 120.6600 2.548344 Estimable #> 6 yield G06 108.8297 2.555281 Estimable #> #> --------------------------------------------------------------------- #> Variance-Covariance Matrix: #> --------------------------------------------------------------------- #> #> Correlation Matrix ('us'): yield #> C1 C2 C3 C4 C5 C6 #> C1 1.00 0.57 0.58 0.65 0.95 0.43 #> C2 0.57 1.00 0.55 0.70 0.52 0.76 #> C3 0.58 0.55 1.00 0.95 0.72 0.27 #> C4 0.65 0.70 0.95 1.00 0.75 0.47 #> C5 0.95 0.52 0.72 0.75 1.00 0.33 #> C6 0.43 0.76 0.27 0.47 0.33 1.00 #> #> Covariance Matrix ('us'): yield #> C1 C2 C3 C4 C5 C6 #> C1 80.57 27.36 46.81 31.67 85.61 31.17 #> C2 27.36 28.90 26.44 20.41 27.99 33.51 #> C3 46.81 26.44 79.66 45.84 64.54 19.81 #> C4 31.67 20.41 45.84 29.28 40.79 20.76 #> C5 85.61 27.99 64.54 40.79 100.60 27.13 #> C6 31.17 33.51 19.81 20.76 27.13 66.66 #> #> --------------------------------------------------------------------- #> First Stability Coefficients: #> --------------------------------------------------------------------- #> trait genotype superiority static wricke predicted.value #> 1 yield G57 22.67503 32.45871 13.962970 92.45997 #> 2 yield G29 17.27533 34.41794 4.343501 99.38429 #> 3 yield G34 17.26249 33.29276 8.514332 99.74688 #> 4 yield G59 16.94882 34.39425 4.798863 99.87221 #> 5 yield G31 16.23001 31.89042 11.722935 101.66382 #> 6 yield G10 15.75253 32.02994 11.499867 102.39802"},{"path":"https://apariciojohan.github.io/agriutilities/articles/repeated_measurements.html","id":"exploration","dir":"Articles","previous_headings":"","what":"Exploration","title":"Repeated Measurements","text":"","code":"tmp <- grassUV |> group_by(Time, Plant) |> summarise(mean = mean(y, na.rm = TRUE)) |> spread(Time, mean) |> column_to_rownames(\"Plant\") a <- covcor_heat( matrix = cor(tmp), legend = \"none\", size = 4.5 ) + ggtitle(label = \"Pearson Correlation\") b <- tmp |> cor(use = \"pairwise.complete.obs\") |> as.data.frame() |> rownames_to_column(var = \"Time\") |> gather(\"Time2\", \"corr\", -1) |> type.convert(as.is = FALSE) |> mutate(corr = ifelse(Time < Time2, NA, corr)) |> mutate(Time2 = as.factor(Time2)) |> ggplot( aes(x = Time, y = corr, group = Time2, color = Time2) ) + geom_point() + geom_line() + theme_minimal(base_size = 15) + color_palette(palette = \"jco\") + labs(color = \"Time\", y = \"Pearson Correlation\") + theme(legend.position = \"top\") ggarrange(a, b)"},{"path":"https://apariciojohan.github.io/agriutilities/articles/repeated_measurements.html","id":"modeling","dir":"Articles","previous_headings":"","what":"Modeling","title":"Repeated Measurements","text":"Let’s fit several models different variance-covariance structures:","code":"# Identity variance model. model_0 <- asreml( fixed = y ~ Time + Tmt + Tmt:Time, residual = ~ id(Plant):idv(Time), data = grassUV ) # Simple correlation model; homogeneous variance form. model_1 <- asreml( fixed = y ~ Time + Tmt + Tmt:Time, residual = ~ id(Plant):corv(Time), data = grassUV ) # Exponential (or power) model; homogeneous variance form. model_2 <- asreml( fixed = y ~ Time + Tmt + Tmt:Time, residual = ~ id(Plant):expv(Time), data = grassUV ) # Exponential (or power) model; heterogeneous variance form. model_3 <- asreml( fixed = y ~ Time + Tmt + Tmt:Time, residual = ~ id(Plant):exph(Time), data = grassUV ) # Antedependence variance model of order 1 model_4 <- asreml( fixed = y ~ Time + Tmt + Tmt:Time, residual = ~ id(Plant):ante(Time), data = grassUV ) # Autoregressive model of order 1; homogeneous variance form. model_5 <- asreml( fixed = y ~ Time + Tmt + Tmt:Time, residual = ~ id(Plant):ar1v(Time), data = grassUV ) # Autoregressive model of order 1; heterogeneous variance form. model_6 <- asreml( fixed = y ~ Time + Tmt + Tmt:Time, residual = ~ id(Plant):ar1h(Time), data = grassUV ) # Unstructured variance model. model_7 <- asreml( fixed = y ~ Time + Tmt + Tmt:Time, residual = ~ id(Plant):us(Time), data = grassUV )"},{"path":"https://apariciojohan.github.io/agriutilities/articles/repeated_measurements.html","id":"model-comparison","dir":"Articles","previous_headings":"","what":"Model Comparison","title":"Repeated Measurements","text":"can use Akaike Information Criterion (AIC)(Akaike, 1974) Bayesian Information Criterion (BIC)(Stone, 1979) comparing fitted models. lower AIC BIC value indicates better fit. specific scenario, antedependence model emerges optimal choice, indicated Bayesian Information Criteria (BIC). 1-factor antedependence structure elegantly models variance-covariance matrix \\(\\Sigma^{\\omega \\times\\omega}\\) following decomposition: \\[ \\Sigma ^{-1} = UDU' \\] \\(U^{\\omega \\times\\omega}\\) unit upper triangular matrix \\(D = diag(d_1, ..., d_{\\omega})\\) diagonal matrix. order case 1. extract_rcov() retrieves matrices closer inspection results.","code":"models <- list( \"idv\" = model_0, \"corv\" = model_1, \"expv\" = model_2, \"exph\" = model_3, \"ante\" = model_4, \"ar1v\" = model_5, \"ar1h\" = model_6, \"us\" = model_7 ) summary_models <- data.frame( model = names(models), aic = unlist(lapply(models, \\(x) summary(x)$aic)), bic = unlist(lapply(models, \\(x) summary(x)$bic)), loglik = unlist(lapply(models, \\(x) summary(x)$loglik)), nedf = unlist(lapply(models, \\(x) summary(x)$nedf)), param = unlist(lapply(models, \\(x) attr(summary(x)$aic, \"param\"))), row.names = NULL ) summary_models |> print() summary_models |> ggplot( aes(x = reorder(model, -bic), y = bic, group = 1) ) + geom_point(size = 2) + geom_text(aes(x = model, y = bic + 5, label = param), size = 5) + geom_line() + theme_minimal(base_size = 15) + labs(x = NULL, y = \"BIC\") #> model aic bic loglik nedf param #> 1 idv 420.8836 422.9779 -209.4418 60 1 #> 2 corv 397.7535 401.9422 -196.8768 60 2 #> 3 expv 369.9577 374.1464 -182.9788 60 2 #> 4 exph 354.9984 367.5645 -171.4992 60 6 #> 5 ante 338.7387 357.5878 -160.3694 60 9 #> 6 ar1v 366.1259 370.3146 -181.0630 60 2 #> 7 ar1h 351.1073 363.6734 -169.5536 60 6 #> 8 us 346.0712 377.4863 -158.0356 60 15"},{"path":"https://apariciojohan.github.io/agriutilities/articles/repeated_measurements.html","id":"wald-test","dir":"Articles","previous_headings":"","what":"Wald Test","title":"Repeated Measurements","text":"table shows summary Wald statistics fixed effects models fitted.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/articles/repeated_measurements.html","id":"extracting-variance-covariance-matrix","dir":"Articles","previous_headings":"","what":"Extracting Variance Covariance Matrix","title":"Repeated Measurements","text":"example extracting variance-covariance matrix, let’s take best model according BIC, run line code: extract_rcov(model_4).","code":"mat <- extract_rcov(model_4, time = \"Time\", plot = \"Plant\") print(mat) # Plotting Matrix p1 <- covcor_heat(matrix = mat$corr, legend = \"none\", size = 4.5) + ggtitle(label = \"Correlation Matrix (ante)\") p1 p2 <- covcor_heat( matrix = mat$vcov, corr = FALSE, legend = \"none\", size = 4.5, digits = 1 ) + ggtitle(label = \"Covariance Matrix (ante)\") p2 ggarrange(p1, p2) #> $corr_mat #> 1 3 5 7 10 #> 1 1.0000000 0.5949600 0.3551374 0.3117083 0.3042604 #> 3 0.5949600 1.0000000 0.5969097 0.5239148 0.5113965 #> 5 0.3551374 0.5969097 1.0000000 0.8777119 0.8567400 #> 7 0.3117083 0.5239148 0.8777119 1.0000000 0.9761062 #> 10 0.3042604 0.5113965 0.8567400 0.9761062 1.0000000 #> #> $vcov_mat #> 1 3 5 7 10 #> 1 37.22092 23.38866 34.87475 44.65979 43.22207 #> 3 23.38866 41.51911 61.90901 79.27923 76.72701 #> 5 34.87475 61.90901 259.08503 331.77822 321.09738 #> 7 44.65979 79.27923 331.77822 551.50497 533.75052 #> 10 43.22207 76.72701 321.09738 533.75052 542.16700 #> #> $vc #> [1] \"ante\" #> #> $U #> 1 3 5 7 10 #> 1 1 -0.628374 0.000000 0.000000 0.0000000 #> 3 0 1.000000 -1.491097 0.000000 0.0000000 #> 5 0 0.000000 1.000000 -1.280577 0.0000000 #> 7 0 0.000000 0.000000 1.000000 -0.9678073 #> 10 0 0.000000 0.000000 0.000000 1.0000000 #> #> $D #> 1 3 5 7 10 #> 1 0.02686661 0.00000000 0.000000000 0.000000000 0.00000000 #> 3 0.00000000 0.03728243 0.000000000 0.000000000 0.00000000 #> 5 0.00000000 0.00000000 0.005996185 0.000000000 0.00000000 #> 7 0.00000000 0.00000000 0.000000000 0.007896552 0.00000000 #> 10 0.00000000 0.00000000 0.000000000 0.000000000 0.03906346"},{"path":"https://apariciojohan.github.io/agriutilities/articles/repeated_measurements.html","id":"comparison","dir":"Articles","previous_headings":"","what":"Comparison","title":"Repeated Measurements","text":"plot unveils correlation matrices, comparing raw data matrix one derived post-application antedependence model.","code":"ggarrange(a, p1)"},{"path":"https://apariciojohan.github.io/agriutilities/articles/repeated_measurements.html","id":"final-results","dir":"Articles","previous_headings":"","what":"Final Results","title":"Repeated Measurements","text":"","code":"pvals <- predict(model_4, classify = \"Tmt:Time\")$pvals grassUV |> ggplot( aes(x = Time, y = y, group = Tmt, color = Tmt, shape = Tmt) ) + geom_point(alpha = 0.4, size = 3) + geom_line(data = pvals, mapping = aes(y = predicted.value)) + theme_minimal(base_size = 15) + color_palette(palette = \"jco\")"},{"path":"https://apariciojohan.github.io/agriutilities/articles/repeated_measurements.html","id":"references","dir":"Articles","previous_headings":"","what":"References","title":"Repeated Measurements","text":"ASReml-R Reference Manual","code":""},{"path":"https://apariciojohan.github.io/agriutilities/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Johan Aparicio. Author, maintainer. Alexia Bornhorst. Author. Alliance Bioversity International CIAT. Copyright holder.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Aparicio J, Bornhorst (2024). agriutilities: Utilities Data Analysis Agriculture. R package version 1.2.0, https://apariciojohan.github.io/agriutilities/, https://github.com/AparicioJohan/agriutilities.","code":"@Manual{, title = {agriutilities: Utilities for Data Analysis in Agriculture}, author = {Johan Aparicio and Alexia Bornhorst}, year = {2024}, note = {R package version 1.2.0, https://apariciojohan.github.io/agriutilities/}, url = {https://github.com/AparicioJohan/agriutilities}, }"},{"path":[]},{"path":"https://apariciojohan.github.io/agriutilities/CODE_OF_CONDUCT.html","id":"our-pledge","dir":"","previous_headings":"","what":"Our Pledge","title":"Contributor Covenant Code of Conduct","text":"members, contributors, leaders pledge make participation community harassment-free experience everyone, regardless age, body size, visible invisible disability, ethnicity, sex characteristics, gender identity expression, level experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, sexual identity orientation. pledge act interact ways contribute open, welcoming, diverse, inclusive, healthy community.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/CODE_OF_CONDUCT.html","id":"our-standards","dir":"","previous_headings":"","what":"Our Standards","title":"Contributor Covenant Code of Conduct","text":"Examples behavior contributes positive environment community include: Demonstrating empathy kindness toward people respectful differing opinions, viewpoints, experiences Giving gracefully accepting constructive feedback Accepting responsibility apologizing affected mistakes, learning experience Focusing best just us individuals, overall community Examples unacceptable behavior include: use sexualized language imagery, sexual attention advances kind Trolling, insulting derogatory comments, personal political attacks Public private harassment Publishing others’ private information, physical email address, without explicit permission conduct reasonably considered inappropriate professional setting","code":""},{"path":"https://apariciojohan.github.io/agriutilities/CODE_OF_CONDUCT.html","id":"enforcement-responsibilities","dir":"","previous_headings":"","what":"Enforcement Responsibilities","title":"Contributor Covenant Code of Conduct","text":"Community leaders responsible clarifying enforcing standards acceptable behavior take appropriate fair corrective action response behavior deem inappropriate, threatening, offensive, harmful. Community leaders right responsibility remove, edit, reject comments, commits, code, wiki edits, issues, contributions aligned Code Conduct, communicate reasons moderation decisions appropriate.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/CODE_OF_CONDUCT.html","id":"scope","dir":"","previous_headings":"","what":"Scope","title":"Contributor Covenant Code of Conduct","text":"Code Conduct applies within community spaces, also applies individual officially representing community public spaces. Examples representing community include using official e-mail address, posting via official social media account, acting appointed representative online offline event.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/CODE_OF_CONDUCT.html","id":"enforcement","dir":"","previous_headings":"","what":"Enforcement","title":"Contributor Covenant Code of Conduct","text":"Instances abusive, harassing, otherwise unacceptable behavior may reported community leaders responsible enforcement johanstevenapa@gmail.com. complaints reviewed investigated promptly fairly. community leaders obligated respect privacy security reporter incident.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/CODE_OF_CONDUCT.html","id":"enforcement-guidelines","dir":"","previous_headings":"","what":"Enforcement Guidelines","title":"Contributor Covenant Code of Conduct","text":"Community leaders follow Community Impact Guidelines determining consequences action deem violation Code Conduct:","code":""},{"path":"https://apariciojohan.github.io/agriutilities/CODE_OF_CONDUCT.html","id":"id_1-correction","dir":"","previous_headings":"Enforcement Guidelines","what":"1. Correction","title":"Contributor Covenant Code of Conduct","text":"Community Impact: Use inappropriate language behavior deemed unprofessional unwelcome community. Consequence: private, written warning community leaders, providing clarity around nature violation explanation behavior inappropriate. public apology may requested.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/CODE_OF_CONDUCT.html","id":"id_2-warning","dir":"","previous_headings":"Enforcement Guidelines","what":"2. Warning","title":"Contributor Covenant Code of Conduct","text":"Community Impact: violation single incident series actions. Consequence: warning consequences continued behavior. interaction people involved, including unsolicited interaction enforcing Code Conduct, specified period time. includes avoiding interactions community spaces well external channels like social media. Violating terms may lead temporary permanent ban.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/CODE_OF_CONDUCT.html","id":"id_3-temporary-ban","dir":"","previous_headings":"Enforcement Guidelines","what":"3. Temporary Ban","title":"Contributor Covenant Code of Conduct","text":"Community Impact: serious violation community standards, including sustained inappropriate behavior. Consequence: temporary ban sort interaction public communication community specified period time. public private interaction people involved, including unsolicited interaction enforcing Code Conduct, allowed period. Violating terms may lead permanent ban.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/CODE_OF_CONDUCT.html","id":"id_4-permanent-ban","dir":"","previous_headings":"Enforcement Guidelines","what":"4. Permanent Ban","title":"Contributor Covenant Code of Conduct","text":"Community Impact: Demonstrating pattern violation community standards, including sustained inappropriate behavior, harassment individual, aggression toward disparagement classes individuals. Consequence: permanent ban sort public interaction within community.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/CODE_OF_CONDUCT.html","id":"attribution","dir":"","previous_headings":"","what":"Attribution","title":"Contributor Covenant Code of Conduct","text":"Code Conduct adapted Contributor Covenant, version 2.1, available https://www.contributor-covenant.org/version/2/1/code_of_conduct.html. Community Impact Guidelines inspired [Mozilla’s code conduct enforcement ladder][https://github.com/mozilla/inclusion]. answers common questions code conduct, see FAQ https://www.contributor-covenant.org/faq. Translations available https://www.contributor-covenant.org/translations.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/index.html","id":"agriutilities-","dir":"","previous_headings":"","what":"Utilities for Data Analysis in Agriculture","title":"Utilities for Data Analysis in Agriculture","text":"agriutilities R package designed make analysis field trials easier accessible everyone working plant breeding. provides simple intuitive interface conducting single multi-environmental trial analysis, minimal coding required. Whether ’re beginner experienced user, agriutilities help quickly easily carry complex analyses confidence. built-functions fitting Linear Mixed Models (LMM), agriutilities ideal choice anyone wants save time focus interpreting results.","code":""},{"path":[]},{"path":"https://apariciojohan.github.io/agriutilities/index.html","id":"from-cran","dir":"","previous_headings":"Installation","what":"From CRAN","title":"Utilities for Data Analysis in Agriculture","text":"","code":"install.packages(\"agriutilities\")"},{"path":"https://apariciojohan.github.io/agriutilities/index.html","id":"from-github","dir":"","previous_headings":"Installation","what":"From GitHub","title":"Utilities for Data Analysis in Agriculture","text":"can install development version agriutilities GitHub :","code":"remotes::install_github(\"AparicioJohan/agriutilities\")"},{"path":"https://apariciojohan.github.io/agriutilities/index.html","id":"automatic-data-analysis-pipeline","dir":"","previous_headings":"","what":"Automatic Data Analysis Pipeline","title":"Utilities for Data Analysis in Agriculture","text":"basic example shows use functions package.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/index.html","id":"identify-the-experimental-design","dir":"","previous_headings":"Automatic Data Analysis Pipeline","what":"Identify the Experimental Design","title":"Utilities for Data Analysis in Agriculture","text":"function check_design_met helps us check quality data also identify experimental design trials. works quality check quality control fit model. Inspecting output.","code":"library(agriutilities) library(agridat) data(besag.met) dat <- besag.met results <- check_design_met( data = dat, genotype = \"gen\", trial = \"county\", traits = \"yield\", rep = \"rep\", block = \"block\", col = \"col\", row = \"row\" ) plot(results, type = \"connectivity\") plot(results, type = \"missing\") print(results) --------------------------------------------------------------------- Summary Traits by Trial: --------------------------------------------------------------------- # A tibble: 6 x 11 county traits Min Mean Median Max SD CV n n_miss miss_perc 1 C1 yield 87.9 149. 151. 200. 17.7 0.119 198 6 0.0303 2 C2 yield 24.4 56.1 52.1 125. 18.4 0.328 198 6 0.0303 3 C3 yield 28.2 87.9 89.2 137. 19.7 0.225 198 6 0.0303 4 C4 yield 103. 145. 143. 190. 17.1 0.118 198 6 0.0303 5 C5 yield 66.9 115. 116. 152. 16.4 0.142 198 6 0.0303 6 C6 yield 29.2 87.6 87.8 148. 26.6 0.304 198 6 0.0303 --------------------------------------------------------------------- Experimental Design Detected: --------------------------------------------------------------------- county exp_design 1 C1 row_col 2 C2 row_col 3 C3 row_col 4 C4 row_col 5 C5 row_col 6 C6 row_col --------------------------------------------------------------------- Summary Experimental Design: --------------------------------------------------------------------- # A tibble: 6 x 9 county n n_gen n_rep n_block n_col n_row num_of_reps num_of_gen 1 C1 198 64 3 8 11 18 3_9 63_1 2 C2 198 64 3 8 11 18 3_9 63_1 3 C3 198 64 3 8 11 18 3_9 63_1 4 C4 198 64 3 8 11 18 3_9 63_1 5 C5 198 64 3 8 11 18 3_9 63_1 6 C6 198 64 3 8 11 18 3_9 63_1 --------------------------------------------------------------------- Connectivity Matrix: --------------------------------------------------------------------- C1 C2 C3 C4 C5 C6 C1 64 64 64 64 64 64 C2 64 64 64 64 64 64 C3 64 64 64 64 64 64 C4 64 64 64 64 64 64 C5 64 64 64 64 64 64 C6 64 64 64 64 64 64 --------------------------------------------------------------------- Filters Applied: --------------------------------------------------------------------- List of 1 $ yield:List of 4 ..$ missing_50% : chr(0) ..$ no_variation : chr(0) ..$ row_col_dup : chr(0) ..$ trials_to_remove: chr(0)"},{"path":"https://apariciojohan.github.io/agriutilities/index.html","id":"single-trial-analysis-sta","dir":"","previous_headings":"Automatic Data Analysis Pipeline","what":"Single Trial Analysis (STA)","title":"Utilities for Data Analysis in Agriculture","text":"results previous function used single_trial_analysis() fit single trial models. function can fit, Completely Randomized Designs (CRD), Randomized Complete Block Designs (RCBD), Resolvable Incomplete Block Designs (res-IBD), Non-Resolvable Row-Column Designs (Row-Col) Resolvable Row-Column Designs (res-Row-Col). NOTE: fits models based randomization detected. Inspecting output. returning object set lists trial summary, BLUEs, BLUPs, heritability, variance components, potential extreme observations, residuals, models fitted data used.","code":"obj <- single_trial_analysis(results, progress = FALSE) print(obj) --------------------------------------------------------------------- Summary Fitted Models: --------------------------------------------------------------------- trait trial heritability CV VarGen VarErr design 1: yield C1 0.73 6.022489 87.39848 82.86095 row_col 2: yield C2 0.37 17.104998 25.80684 108.68546 row_col 3: yield C3 0.64 12.357202 83.57907 118.55567 row_col 4: yield C4 0.41 8.179408 35.75568 136.21218 row_col 5: yield C5 0.80 7.037586 103.79822 66.97523 row_col 6: yield C6 0.49 16.632367 71.92232 207.53073 row_col --------------------------------------------------------------------- Outliers Removed: --------------------------------------------------------------------- trait trial genotype id outlier 1: yield C1 G60 50 TRUE --------------------------------------------------------------------- First Predicted Values and Standard Errors (BLUEs/BLUPs): --------------------------------------------------------------------- trait genotype trial BLUEs seBLUEs BLUPs seBLUPs wt 1: yield G01 C1 141.4161 6.078858 143.5308 5.249771 0.02706176 2: yield G02 C1 157.8110 5.979708 155.8037 5.194547 0.02796663 3: yield G03 C1 127.3836 6.091534 133.0256 5.269999 0.02694925 4: yield G04 C1 154.8445 6.093866 153.8364 5.270427 0.02692863 5: yield G05 C1 163.8950 6.132141 161.1831 5.271809 0.02659352 6: yield G06 C1 128.5168 6.087902 133.6857 5.247130 0.02698141 plot(obj, horizontal = TRUE, nudge_y_h2 = 0.12) plot(obj, type = \"correlation\")"},{"path":"https://apariciojohan.github.io/agriutilities/index.html","id":"two-stage-analysis-met","dir":"","previous_headings":"Automatic Data Analysis Pipeline","what":"Two-Stage Analysis (MET)","title":"Utilities for Data Analysis in Agriculture","text":"results previous function used met_analysis() fit multi-environmental trial models. Inspecting output.","code":"met_results <- met_analysis(obj, vcov = \"fa2\", progress = FALSE) Online License checked out Fri Mar 17 08:56:24 2023 Online License checked out Fri Mar 17 08:56:25 2023 print(met_results) --------------------------------------------------------------------- Trial Effects (BLUEs): --------------------------------------------------------------------- trait trial predicted.value std.error status 1 yield C1 149.75463 1.357203 Estimable 2 yield C2 65.99443 1.140633 Estimable 3 yield C3 90.60647 1.445419 Estimable 4 yield C4 148.12551 1.172065 Estimable 5 yield C5 121.77655 1.434386 Estimable 6 yield C6 88.31651 1.532150 Estimable --------------------------------------------------------------------- Heritability: --------------------------------------------------------------------- trait h2 1 yield 0.8253127 --------------------------------------------------------------------- First Overall Predicted Values and Standard Errors (BLUPs): --------------------------------------------------------------------- trait genotype predicted.value std.error status 1 yield G01 110.4107 2.524415 Estimable 2 yield G02 111.0488 2.534145 Estimable 3 yield G03 102.6031 2.538533 Estimable 4 yield G04 115.3953 2.530336 Estimable 5 yield G05 120.6700 2.545688 Estimable 6 yield G06 108.6678 2.552319 Estimable --------------------------------------------------------------------- Variance-Covariance Matrix: --------------------------------------------------------------------- Correlation Matrix ('fa2'): yield C1 C2 C3 C4 C5 C6 C1 1.00 0.54 0.67 0.81 0.93 0.35 C2 0.54 1.00 0.60 0.90 0.52 0.68 C3 0.67 0.60 1.00 0.73 0.70 0.40 C4 0.81 0.90 0.73 1.00 0.83 0.60 C5 0.93 0.52 0.70 0.83 1.00 0.34 C6 0.35 0.68 0.40 0.60 0.34 1.00 Covariance Matrix ('fa2'): yield C1 C2 C3 C4 C5 C6 C1 80.39 25.73 53.51 35.80 84.13 25.75 C2 25.73 28.74 28.50 23.86 28.05 29.67 C3 53.51 28.50 78.96 32.26 62.98 28.93 C4 35.80 23.86 32.26 24.54 41.43 24.38 C5 84.13 28.05 62.98 41.43 101.53 27.94 C6 25.75 29.67 28.93 24.38 27.94 66.57 --------------------------------------------------------------------- First Stability Coefficients: --------------------------------------------------------------------- trait genotype superiority static wricke predicted.value 1 yield G57 22.56100 33.35260 15.210394 92.44993 2 yield G29 16.98170 34.39632 4.243540 99.41798 3 yield G34 16.98545 33.64634 8.152888 99.81112 4 yield G59 16.68886 34.56884 5.361337 99.91280 5 yield G31 15.97985 31.29838 12.350068 101.69455 6 yield G10 15.61917 32.24828 11.747802 102.32827"},{"path":"https://apariciojohan.github.io/agriutilities/index.html","id":"exploring-factor-analytic-in-met-analysis","dir":"","previous_headings":"Automatic Data Analysis Pipeline","what":"Exploring Factor Analytic in MET analysis.","title":"Utilities for Data Analysis in Agriculture","text":"information learn described may find useful following sources: Isik, Holland, Maltecca (2017); Rodriguez-Alvarez et al. (2018).","code":"pvals <- met_results$trial_effects model <- met_results$met_models$yield fa_objt <- fa_summary( model = model, trial = \"trial\", genotype = \"genotype\", BLUEs_trial = pvals, k_biplot = 8, size_label_var = 4, filter_score = 1 ) fa_objt$plots$loadings_c fa_objt$plots$biplot"},{"path":"https://apariciojohan.github.io/agriutilities/index.html","id":"code-of-conduct","dir":"","previous_headings":"","what":"Code of Conduct","title":"Utilities for Data Analysis in Agriculture","text":"Please note agriutilities project released Contributor Code Conduct. contributing project, agree abide terms.","code":""},{"path":[]},{"path":"https://apariciojohan.github.io/agriutilities/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2023 agriutilities authors Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/check_connectivity.html","id":null,"dir":"Reference","previous_headings":"","what":"Check connectivity between trials — check_connectivity","title":"Check connectivity between trials — check_connectivity","text":"Check connectivity trials","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/check_connectivity.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Check connectivity between trials — check_connectivity","text":"","code":"check_connectivity( data = NULL, genotype = \"line\", trial = \"Experiment\", response = NULL, all = FALSE, return_matrix = FALSE )"},{"path":"https://apariciojohan.github.io/agriutilities/reference/check_connectivity.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Check connectivity between trials — check_connectivity","text":"data data.frame wide format. genotype character string indicating column data contains genotypes. trial character string indicating column data contains trials. response character string specifying trait. Whether print table. return_matrix logical value indicating user wants return (n_trial x n_trial) matrix amount genotypes shared pair trial. (FALSE default)","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/check_connectivity.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Check connectivity between trials — check_connectivity","text":"data.frame genotype connectivity. return_matrix TRUE, return n_trial x n_trial matrix amount genotypes shared pair trial.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/check_connectivity.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Check connectivity between trials — check_connectivity","text":"","code":"library(agridat) library(agriutilities) data(besag.met) dat <- besag.met head( check_connectivity( data = dat, genotype = \"gen\", trial = \"county\", response = \"yield\", all = TRUE, return_matrix = FALSE ) ) #> gen C1 C2 C3 C4 C5 C6 total n percent #> 1 G01 1 1 1 1 1 1 6 6 1 #> 2 G02 1 1 1 1 1 1 6 6 1 #> 3 G03 1 1 1 1 1 1 6 6 1 #> 4 G04 1 1 1 1 1 1 6 6 1 #> 5 G05 1 1 1 1 1 1 6 6 1 #> 6 G06 1 1 1 1 1 1 6 6 1"},{"path":"https://apariciojohan.github.io/agriutilities/reference/check_design_met.html","id":null,"dir":"Reference","previous_headings":"","what":"Check Experimental Design — check_design_met","title":"Check Experimental Design — check_design_met","text":"function helps identify experimental design trial, filters data provide summary traits experimental design. works quality check fit model. Returns object class checkAgri.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/check_design_met.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Check Experimental Design — check_design_met","text":"","code":"check_design_met( data = NULL, genotype = NULL, trial = NULL, traits = NULL, rep = NULL, block = NULL, row = NULL, col = NULL )"},{"path":"https://apariciojohan.github.io/agriutilities/reference/check_design_met.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Check Experimental Design — check_design_met","text":"data data.frame wide format. genotype character string indicating column data contains genotypes. trial character string indicating column data contains trials. traits character vector specifying traits models fitted. rep character string indicating column data contains replicates. block character string indicating column data contains sub blocks. row character string indicating column data contains row coordinates. col character string indicating column data contains column coordinates.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/check_design_met.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Check Experimental Design — check_design_met","text":"object class checkAgri, list : summ_traits data.frame containing summary traits. exp_design_resum data.frame containing summary experimental design. filter list trait containing filtered trials. exp_design_list data.frame containing experimental design trial. check_connectivity data.frame genotype connectivity. connectivity_matrix matrix amount genotypes shared pair trial. data_design data frame containing data used two additional columns, one realted experimental design sequential number (id) inputs list containing character string indicates column data contains genotype, trial, traits, rep, block, row col.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/check_design_met.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Check Experimental Design — check_design_met","text":"","code":"library(agridat) library(agriutilities) data(besag.met) dat <- besag.met results <- check_design_met( data = dat, genotype = \"gen\", trial = \"county\", traits = c(\"yield\"), rep = \"rep\", block = \"block\", col = \"col\", row = \"row\" ) print(results) #> --------------------------------------------------------------------- #> Summary Traits by Trial: #> --------------------------------------------------------------------- #> # A tibble: 6 × 11 #> county traits Min Mean Median Max SD CV n n_miss miss_perc #> #> 1 C1 yield 87.9 149. 151. 200. 17.7 0.119 198 6 0.0303 #> 2 C2 yield 24.4 56.1 52.1 125. 18.4 0.328 198 6 0.0303 #> 3 C3 yield 28.2 87.9 89.2 137. 19.7 0.225 198 6 0.0303 #> 4 C4 yield 103. 145. 143. 190. 17.1 0.118 198 6 0.0303 #> 5 C5 yield 66.9 115. 116. 152. 16.4 0.142 198 6 0.0303 #> 6 C6 yield 29.2 87.6 87.8 148. 26.6 0.304 198 6 0.0303 #> #> --------------------------------------------------------------------- #> Experimental Design Detected: #> --------------------------------------------------------------------- #> county exp_design #> 1 C1 row_col #> 2 C2 row_col #> 3 C3 row_col #> 4 C4 row_col #> 5 C5 row_col #> 6 C6 row_col #> #> --------------------------------------------------------------------- #> Summary Experimental Design: #> --------------------------------------------------------------------- #> # A tibble: 6 × 9 #> county n n_gen n_rep n_block n_col n_row num_of_reps num_of_gen #> #> 1 C1 198 64 3 8 11 18 3_9 63_1 #> 2 C2 198 64 3 8 11 18 3_9 63_1 #> 3 C3 198 64 3 8 11 18 3_9 63_1 #> 4 C4 198 64 3 8 11 18 3_9 63_1 #> 5 C5 198 64 3 8 11 18 3_9 63_1 #> 6 C6 198 64 3 8 11 18 3_9 63_1 #> #> --------------------------------------------------------------------- #> Connectivity Matrix: #> --------------------------------------------------------------------- #> C1 C2 C3 C4 C5 C6 #> C1 64 64 64 64 64 64 #> C2 64 64 64 64 64 64 #> C3 64 64 64 64 64 64 #> C4 64 64 64 64 64 64 #> C5 64 64 64 64 64 64 #> C6 64 64 64 64 64 64 #> #> --------------------------------------------------------------------- #> Filters Applied: #> --------------------------------------------------------------------- #> List of 1 #> $ yield:List of 4 #> ..$ missing_50% : chr(0) #> ..$ no_variation : chr(0) #> ..$ row_col_dup : chr(0) #> ..$ trials_to_remove: chr(0) #> plot(results, type = \"connectivity\") plot(results, type = \"missing\")"},{"path":"https://apariciojohan.github.io/agriutilities/reference/check_design_met_1.html","id":null,"dir":"Reference","previous_headings":"","what":"Check Experimental Design — check_design_met_1","title":"Check Experimental Design — check_design_met_1","text":"function helps identify experimental design trial, filters data provide summary traits experimental design. works quality check fit model. Returns object class checkAgri.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/check_design_met_1.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Check Experimental Design — check_design_met_1","text":"","code":"check_design_met_1( data = NULL, genotype = NULL, trial = NULL, traits = NULL, rep = NULL, block = NULL, row = NULL, col = NULL )"},{"path":"https://apariciojohan.github.io/agriutilities/reference/check_design_met_1.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Check Experimental Design — check_design_met_1","text":"data data.frame wide format. genotype character string indicating column data contains genotypes. trial character string indicating column data contains trials. traits character vector specifying traits models fitted. rep character string indicating column data contains replicates. block character string indicating column data contains sub blocks. row character string indicating column data contains row coordinates. col character string indicating column data contains column coordinates.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/check_design_met_1.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Check Experimental Design — check_design_met_1","text":"object class checkAgri, list : summ_traits data.frame containing summary traits. exp_design_resum data.frame containing summary experimental design. filter list trait containing filtered trials. exp_design_list data.frame containing experimental design trial. check_connectivity data.frame genotype connectivity. connectivity_matrix matrix amount genotypes shared pair trial. data_design data frame containing data used two additional columns, one realted experimental design sequential number (id) inputs list containing character string indicates column data contains genotype, trial, traits, rep, block, row col.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/check_design_met_1.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Check Experimental Design — check_design_met_1","text":"","code":"# \\donttest{ library(agridat) library(agriutilities) data(besag.met) dat <- besag.met results <- check_design_met_1( data = dat, genotype = \"gen\", trial = \"county\", traits = c(\"yield\"), rep = \"rep\", block = \"block\", col = \"col\", row = \"row\" ) print(results) #> --------------------------------------------------------------------- #> Summary Traits by Trial: #> --------------------------------------------------------------------- #> # A tibble: 6 x 9 #> county traits Mean Median SD CV n n_miss miss_perc #> #> 1 C1 yield 149. 151. 17.7 0.119 198 6 0.0303 #> 2 C2 yield 56.1 52.1 18.4 0.328 198 6 0.0303 #> 3 C3 yield 87.9 89.2 19.7 0.225 198 6 0.0303 #> 4 C4 yield 145. 143. 17.1 0.118 198 6 0.0303 #> 5 C5 yield 115. 116. 16.4 0.142 198 6 0.0303 #> 6 C6 yield 87.6 87.8 26.6 0.304 198 6 0.0303 #> #> --------------------------------------------------------------------- #> Experimental Design Detected: #> --------------------------------------------------------------------- #> county exp_design #> 1 C1 row_col #> 2 C2 row_col #> 3 C3 row_col #> 4 C4 row_col #> 5 C5 row_col #> 6 C6 row_col #> #> --------------------------------------------------------------------- #> Summary Experimental Design: #> --------------------------------------------------------------------- #> # A tibble: 6 x 9 #> county n n_gen n_rep n_block n_col n_row num_of_reps num_of_gen #> #> 1 C1 198 64 3 8 11 18 3_9 63_1 #> 2 C2 198 64 3 8 11 18 3_9 63_1 #> 3 C3 198 64 3 8 11 18 3_9 63_1 #> 4 C4 198 64 3 8 11 18 3_9 63_1 #> 5 C5 198 64 3 8 11 18 3_9 63_1 #> 6 C6 198 64 3 8 11 18 3_9 63_1 #> #> --------------------------------------------------------------------- #> Connectivity Matrix: #> --------------------------------------------------------------------- #> C1 C2 C3 C4 C5 C6 #> C1 64 64 64 64 64 64 #> C2 64 64 64 64 64 64 #> C3 64 64 64 64 64 64 #> C4 64 64 64 64 64 64 #> C5 64 64 64 64 64 64 #> C6 64 64 64 64 64 64 #> #> --------------------------------------------------------------------- #> Filters Applied: #> --------------------------------------------------------------------- #> List of 1 #> $ yield:List of 4 #> ..$ missing_50% : chr(0) #> ..$ no_variation : chr(0) #> ..$ row_col_dup : chr(0) #> ..$ trials_to_remove: chr(0) #> # Plotting Connectivity Matrix plot(results, type = \"connectivity\") # Plotting Missing Data plot(results, type = \"missing\") # }"},{"path":"https://apariciojohan.github.io/agriutilities/reference/connectivity_matrix.html","id":null,"dir":"Reference","previous_headings":"","what":"Connectivity Matrix — connectivity_matrix","title":"Connectivity Matrix — connectivity_matrix","text":"Check amount genotypes shared pair trial.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/connectivity_matrix.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Connectivity Matrix — connectivity_matrix","text":"","code":"connectivity_matrix( data = NULL, genotype = \"germplasmName\", trial = \"trial\", response = NULL )"},{"path":"https://apariciojohan.github.io/agriutilities/reference/connectivity_matrix.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Connectivity Matrix — connectivity_matrix","text":"data data.frame wide format. genotype character string indicating column data contains genotypes. trial character string indicating column data contains trials. response character string specifying trait.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/connectivity_matrix.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Connectivity Matrix — connectivity_matrix","text":"function generates (n_trial x n_trial) matrix amount genotypes shared pair trial.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/connectivity_matrix.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Connectivity Matrix — connectivity_matrix","text":"","code":"# \\donttest{ library(agridat) data(besag.met) dat <- besag.met connectivity_matrix( data = dat, genotype = \"gen\", trial = \"county\", response = \"yield\" ) #> C1 C2 C3 C4 C5 C6 #> C1 64 64 64 64 64 64 #> C2 64 64 64 64 64 64 #> C3 64 64 64 64 64 64 #> C4 64 64 64 64 64 64 #> C5 64 64 64 64 64 64 #> C6 64 64 64 64 64 64 # }"},{"path":"https://apariciojohan.github.io/agriutilities/reference/covcor_heat.html","id":null,"dir":"Reference","previous_headings":"","what":"Correlation Covariance Heatmap — covcor_heat","title":"Correlation Covariance Heatmap — covcor_heat","text":"Correlation Covariance Heatmap","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/covcor_heat.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Correlation Covariance Heatmap — covcor_heat","text":"","code":"covcor_heat( matrix, corr = TRUE, size = 4, digits = 3, legend = c(0.6, 0.7), upper_tri = FALSE, reorder = FALSE )"},{"path":"https://apariciojohan.github.io/agriutilities/reference/covcor_heat.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Correlation Covariance Heatmap — covcor_heat","text":"matrix numeric matrix. corr logical value indicating matrix scaled form (TRUE default, correlation matrix) size numeric value define letter size. digits numeric integer define number digits plot. legend position legends (\"none\", \"left\", \"right\", \"bottom\", \"top\", two-element numeric vector) upper_tri logical value plot Lower Upper Triangular Part matrix. FALSE default. reorder logical value reorder Hierarchical Clustering. FALSE default.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/covcor_heat.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Correlation Covariance Heatmap — covcor_heat","text":"ggplot object showing upper triangular elements matrix.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/covcor_heat.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Correlation Covariance Heatmap — covcor_heat","text":"","code":"library(agriutilities) data(iris) M <- cor(iris[, -5]) covcor_heat(matrix = M, corr = TRUE)"},{"path":"https://apariciojohan.github.io/agriutilities/reference/extract_rcov.html","id":null,"dir":"Reference","previous_headings":"","what":"Extract Residual Variance-Covariance from ASReml-R — extract_rcov","title":"Extract Residual Variance-Covariance from ASReml-R — extract_rcov","text":"function specially useful extracting residual variance covariance matrices ASReml-R running repeated measurements models.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/extract_rcov.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Extract Residual Variance-Covariance from ASReml-R — extract_rcov","text":"","code":"extract_rcov(model = NULL, time = \"Time\", plot = \"Plot\", vc_error = NULL)"},{"path":"https://apariciojohan.github.io/agriutilities/reference/extract_rcov.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Extract Residual Variance-Covariance from ASReml-R — extract_rcov","text":"model asreml object time character string indicating \"Time\" plot character string indicating \"PlotID\" vc_error optional character string indicating variance covariance. Can \"corv\", \"corh\", \"corgh\", \"us\", \"expv\", \"exph\", \"ar1v\", \"ar1h\" \"ante\". using NULL function tries guess variance-covariance used.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/extract_rcov.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Extract Residual Variance-Covariance from ASReml-R — extract_rcov","text":"object list : corr_mat matrix residual correlation time points vcov_mat matrix estimated residual variance-covariance time points vc character string indicating variance-covariance fitted.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/extract_rcov.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Extract Residual Variance-Covariance from ASReml-R — extract_rcov","text":"","code":"if (FALSE) { library(ggpubr) library(agriutilities) library(tidyverse) library(asreml) head(grassUV) str(grassUV) # Exploration ------------------------------------------------------------- grassUV %>% ggplot( aes(x = Time, y = y, group = Plant, color = Plant) ) + geom_point() + geom_line() + facet_wrap(~Tmt) + theme_minimal(base_size = 15) tmp <- grassUV %>% group_by(Time, Plant) %>% summarise(mean = mean(y, na.rm = TRUE)) %>% spread(Time, mean) %>% column_to_rownames(\"Plant\") gg_cor(tmp, label_size = 5) tmp %>% cor(use = \"pairwise.complete.obs\") %>% as.data.frame() %>% rownames_to_column(var = \"Time\") %>% gather(\"DAP2\", \"corr\", -1) %>% type.convert(as.is = FALSE) %>% mutate(corr = ifelse(Time < DAP2, NA, corr)) %>% mutate(DAP2 = as.factor(DAP2)) %>% ggplot( aes(x = Time, y = corr, group = DAP2, color = DAP2) ) + geom_point() + geom_line() + theme_minimal(base_size = 15) + color_palette(palette = \"jco\") + labs(color = \"Time\", y = \"Pearson Correlation\") # Modeling ---------------------------------------------------------------- # Identity variance model. model_0 <- asreml( fixed = y ~ Time + Tmt + Tmt:Time, residual = ~ id(Plant):idv(Time), data = grassUV ) # Simple correlation model; homogeneous variance form. model_1 <- asreml( fixed = y ~ Time + Tmt + Tmt:Time, residual = ~ id(Plant):corv(Time), data = grassUV ) # Exponential (or power) model; homogeneous variance form. model_2 <- asreml( fixed = y ~ Time + Tmt + Tmt:Time, residual = ~ id(Plant):expv(Time), data = grassUV ) # Exponential (or power) model; heterogeneous variance form. model_3 <- asreml( fixed = y ~ Time + Tmt + Tmt:Time, residual = ~ id(Plant):exph(Time), data = grassUV ) # Antedependence variance model of order 1 model_4 <- asreml( fixed = y ~ Time + Tmt + Tmt:Time, residual = ~ id(Plant):ante(Time), data = grassUV ) # Autoregressive model of order 1; homogeneous variance form. model_5 <- asreml( fixed = y ~ Time + Tmt + Tmt:Time, residual = ~ id(Plant):ar1v(Time), data = grassUV ) # Autoregressive model of order 1; heterogeneous variance form. model_6 <- asreml( fixed = y ~ Time + Tmt + Tmt:Time, residual = ~ id(Plant):ar1h(Time), data = grassUV ) # Unstructured variance model. model_7 <- asreml( fixed = y ~ Time + Tmt + Tmt:Time, residual = ~ id(Plant):us(Time), data = grassUV ) # Model Comparison -------------------------------------------------------- models <- list( \"id\" = model_0, \"cor\" = model_1, \"exp\" = model_2, \"exph\" = model_3, \"ante\" = model_4, \"ar1\" = model_5, \"ar1h\" = model_6, \"us\" = model_7 ) summary_models <- data.frame( model = names(models), aic = unlist(lapply(models, \\(x) summary(x)$aic)), bic = unlist(lapply(models, \\(x) summary(x)$bic)), loglik = unlist(lapply(models, \\(x) summary(x)$loglik)), nedf = unlist(lapply(models, \\(x) summary(x)$nedf)), param = unlist(lapply(models, \\(x) attr(summary(x)$aic, \"param\"))), row.names = NULL ) summary_models %>% ggplot( aes(x = reorder(model, -bic), y = bic, group = 1) ) + geom_point(size = 2) + geom_text(aes(x = model, y = bic + 5, label = param)) + geom_line() + theme_minimal(base_size = 15) + labs(x = NULL) # Extracting Variance Covariance Matrix ----------------------------------- extract_rcov(model_4, time = \"Time\", plot = \"Plant\") covcor_heat( matrix = extract_rcov(model_1, time = \"Time\", plot = \"Plant\")$corr, legend = \"none\", size = 5 ) + ggtitle(label = \"Uniform Correlation (corv)\") covcor_heat( matrix = extract_rcov(model_2, time = \"Time\", plot = \"Plant\")$corr, legend = \"none\", size = 5 ) + ggtitle(label = \"Exponetial (expv)\") }"},{"path":"https://apariciojohan.github.io/agriutilities/reference/extract_vcov.html","id":null,"dir":"Reference","previous_headings":"","what":"Extract Variance-Covariance from ASReml-R — extract_vcov","title":"Extract Variance-Covariance from ASReml-R — extract_vcov","text":"Extract Variance-Covariance ASReml-R","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/extract_vcov.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Extract Variance-Covariance from ASReml-R — extract_vcov","text":"","code":"extract_vcov(model = NULL, gen = \"genotype\", env = \"trial\", vc_model = \"corv\")"},{"path":"https://apariciojohan.github.io/agriutilities/reference/extract_vcov.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Extract Variance-Covariance from ASReml-R — extract_vcov","text":"model ASReml object gen character string indicating column data contains genotypes. env character string indicating column data contains environments trials. vc_model character string indicating variance-covariance fitted. Can 'diag', 'corv', 'corh', 'corgv', 'fa1', 'fa2', 'fa3', 'fa4', 'corgh', 'us' 'rr2'.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/extract_vcov.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Extract Variance-Covariance from ASReml-R — extract_vcov","text":"object list : VCOV matrix estimated variance-covariance trials. CORR n_trial x n_trial matrix correlation trials. vc_model character string indicating variance-covariance fitted.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/extract_vcov.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Extract Variance-Covariance from ASReml-R — extract_vcov","text":"","code":"if (FALSE) { library(agridat) library(agriutilities) data(besag.met) dat <- besag.met results <- check_design_met( data = dat, genotype = \"gen\", trial = \"county\", traits = c(\"yield\"), rep = \"rep\", block = \"block\", col = \"col\", row = \"row\" ) out <- single_trial_analysis(results, progress = FALSE) met_results <- met_analysis(out, progress = FALSE) extract_vcov( model = met_results$met_models$yield, vc_model = \"us\" ) }"},{"path":"https://apariciojohan.github.io/agriutilities/reference/fa2_summary.html","id":null,"dir":"Reference","previous_headings":"","what":"Factor Analytic Summary — fa2_summary","title":"Factor Analytic Summary — fa2_summary","text":"Factor Analytic Summary","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/fa2_summary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Factor Analytic Summary — fa2_summary","text":"","code":"fa2_summary( model = NULL, trial = \"trial\", genotype = \"genotype\", BLUEs_trial = NULL, mult_fa1 = -1, mult_fa2 = 1, filter_score = 1.5, k_biplot = 1, size_label_var = 2, alpha_label_var = 0.2, size_label_ind = 2, alpha_label_ind = 0.8, size_arrow = 0.2, alpha_arrow = 0.2, base_size = 12 )"},{"path":"https://apariciojohan.github.io/agriutilities/reference/fa2_summary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Factor Analytic Summary — fa2_summary","text":"model factor analytic model (asreml object) trial string genotype string BLUEs_trial data.frame trial BLUEs mult_fa1 c(1,-1) (-1 default) mult_fa2 c(1,-1) (1 default) filter_score value filter genotypes distance origin k_biplot factor multiply scores biplot size_label_var double alpha_label_var (0,1) size_label_ind double alpha_label_ind (0,1) size_arrow double alpha_arrow (0,1) base_size double","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/fa2_summary.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Factor Analytic Summary — fa2_summary","text":"list loadings = L, loading_star, Gvar, Cmat, summary_loadings, paf_site, var_tot, scores, plots = list(loadings, biplot, biplot_scaled, loadings_c)","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/fa2_summary.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Factor Analytic Summary — fa2_summary","text":"","code":"# library(tidyverse) # library(asreml) # library(agridat) # data(besag.met) # dat <- besag.met # # dat <- dat %>% arrange(county) # model <- asreml(fixed = yield ~ 1 + county, # random = ~ fa(county, 2):gen + county:rep + diag(county):rep:block, # residual = ~ dsum(~ units | county), # data = dat, # na.action = list(x=\"include\",y=\"include\")) # # pp <- predict(model, classify = \"county\")$pvals # fa2_summary( # model = model, # trial = \"county\", # genotype = \"gen\", # BLUEs_trial = pp, # mult_fa1 = -1, # mult_fa2 = -1, # filter_score = 1, # k_biplot = 10, # size_label_var = 3, # alpha_label_var = 0.5, # size_label_ind = 3, # alpha_label_ind = 0.8, # size_arrow = 0.2, # alpha_arrow = 0.1 # )"},{"path":"https://apariciojohan.github.io/agriutilities/reference/fa_summary.html","id":null,"dir":"Reference","previous_headings":"","what":"Factor Analytic Summary — fa_summary","title":"Factor Analytic Summary — fa_summary","text":"Factor Analytic Summary","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/fa_summary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Factor Analytic Summary — fa_summary","text":"","code":"fa_summary( model = NULL, trial = \"trial\", genotype = \"genotype\", BLUEs_trial = NULL, mult_fa1 = -1, mult_fa2 = 1, filter_score = 1.5, k_biplot = 1, size_label_var = 2, alpha_label_var = 0.2, size_label_ind = 2, alpha_label_ind = 0.8, size_arrow = 0.2, alpha_arrow = 0.2, base_size = 12 )"},{"path":"https://apariciojohan.github.io/agriutilities/reference/fa_summary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Factor Analytic Summary — fa_summary","text":"model Factor Analytic Model (ASReml object) trial character string indicating column data contains trials. genotype character string indicating column data contains genotypes. BLUEs_trial data.frame containing BLUEs trial. mult_fa1 constant multiply first loading. Must 1 -1. (-1 default) mult_fa2 constant multiply second loading. Must 1 -1. (1 default) filter_score numeric value filter genotypes distance origin. k_biplot numeric value multiply scores biplot. size_label_var numeric value define label size variables. alpha_label_var numeric value (0,1) define label variables. size_label_ind numeric value define label size individuals. alpha_label_ind numeric value (0,1) define label individuals. size_arrow numeric value define arrow size. alpha_arrow numeric value (0,1) define arrow. base_size numeric value define base size.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/fa_summary.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Factor Analytic Summary — fa_summary","text":"object list : loadings data.frame containing first second loading trial. loading_star data.frame containing first second loading rotated trial. Gvar matrix estimated variance-covariance trials. Cmat matrix correlation trials. summary_loading data.frame containing summary loadings. paf_site data.frame containing percentage variance explained component trial. var_tot numeric value total variance. scores data.frame containing scores genotype. plots list different plots. Includes plot loadings, biplot, biplot_scaled loadings_c.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/fa_summary.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Factor Analytic Summary — fa_summary","text":"","code":"if (FALSE) { library(agridat) library(agriutilities) data(besag.met) dat <- besag.met results <- check_design_met( data = dat, genotype = \"gen\", trial = \"county\", traits = c(\"yield\"), rep = \"rep\", block = \"block\", col = \"col\", row = \"row\" ) out <- single_trial_analysis(results, progress = FALSE) met_results <- met_analysis(out, vcov = \"fa2\", progress = FALSE) pp <- met_results$trial_effects model <- met_results$met_models$yield fa_summary( model = model, trial = \"trial\", genotype = \"genotype\", BLUEs_trial = pp, mult_fa1 = -1, mult_fa2 = -1, filter_score = 1, k_biplot = 10, size_label_var = 3, alpha_label_var = 0.5, size_label_ind = 3, alpha_label_ind = 0.8, size_arrow = 0.2, alpha_arrow = 0.1 ) }"},{"path":"https://apariciojohan.github.io/agriutilities/reference/ggCor.html","id":null,"dir":"Reference","previous_headings":"","what":"Triangular correlation plot — ggCor","title":"Triangular correlation plot — ggCor","text":"Return ggplot object plot triangular correlation figure 2 variables.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/ggCor.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Triangular correlation plot — ggCor","text":"","code":"ggCor( data, colours = c(\"#db4437\", \"white\", \"#FF9D00\"), blackLabs = c(-0.7, 0.7), showSignif = TRUE, pBreaks = c(0, 0.001, 0.01, 0.05, Inf), pLabels = c(\"***\", \"**\", \"*\", \"ns\"), showDiagonal = FALSE, Diag = NULL, returnTable = FALSE, returnN = FALSE, adjusted = TRUE, label_size = 3 )"},{"path":"https://apariciojohan.github.io/agriutilities/reference/ggCor.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Triangular correlation plot — ggCor","text":"data data.frame numerical columns variable compared. colours vector size three colors used values -1, 0 1. blackLabs numeric vector size two, min max correlation coefficient showSignif Logical scalar. Display significance values ? pBreaks Passed function 'cut'. Either numeric vector two unique cut points single number (greater equal 2) giving number intervals x cut. pLabels Passed function 'cut'. labels levels resulting category. default, labels constructed using \"(,b]\" interval notation. pLabels = FALSE, simple integer codes returned instead factor. showDiagonal Logical scalar. Display main diagonal values ? Diag named vector labels display main diagonal. names used place value corresponding coordinates diagonal. Hence, names must colnames data. returnTable Return table display instead ggplot object returnN Return plot shared information adjusted Use adjusted p values multiple testing instead raw coeffs. TRUE default. label_size Numeric value indicating label size. 3 default.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/ggCor.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Triangular correlation plot — ggCor","text":"ggplot object containing triangular correlation figure numeric variables data. returnTable TRUE, table used produce figure returned instead.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/ggCor.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Triangular correlation plot — ggCor","text":"Daniel Ariza, Johan Aparicio.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/ggCor.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Triangular correlation plot — ggCor","text":"","code":"# \\donttest{ data(iris) ggCor( data = iris, colours = c(\"#db4437\",\"white\",\"#4285f4\"), label_size = 6 ) #> Dropping non-numeric columns in the dataset: #> Species # }"},{"path":"https://apariciojohan.github.io/agriutilities/reference/gg_cor.html","id":null,"dir":"Reference","previous_headings":"","what":"Triangular Correlation Plot — gg_cor","title":"Triangular Correlation Plot — gg_cor","text":"Return ggplot object plot triangular correlation figure 2 variables.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/gg_cor.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Triangular Correlation Plot — gg_cor","text":"","code":"gg_cor( data, colours = c(\"#db4437\", \"white\", \"#4285f4\"), blackLabs = c(-0.7, 0.7), show_signif = TRUE, p_breaks = c(0, 0.001, 0.01, 0.05, Inf), p_labels = c(\"***\", \"**\", \"*\", \"ns\"), show_diagonal = FALSE, diag = NULL, return_table = FALSE, return_n = FALSE, adjusted = TRUE, label_size = 3, method = \"pearson\" )"},{"path":"https://apariciojohan.github.io/agriutilities/reference/gg_cor.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Triangular Correlation Plot — gg_cor","text":"data data.frame numerical columns variable compared. colours vector size three colors used values -1, 0 1. blackLabs numeric vector size two, min max correlation coefficient. show_signif Logical scalar. Display significance values ? p_breaks Passed function 'cut'. Either numeric vector two unique cut points single number (greater equal 2) giving number intervals x cut. p_labels Passed function 'cut'. labels levels resulting category. default, labels constructed using \"(,b]\" interval notation. p_labels = FALSE, simple integer codes returned instead factor. show_diagonal Logical scalar. Display main diagonal values ? diag named vector labels display main diagonal. names used place value corresponding coordinates diagonal. Hence, names must colnames data. return_table Return table display instead ggplot object. return_n Return plot shared information. adjusted Use adjusted p values multiple testing instead raw coeffs. TRUE default. label_size Numeric value indicating label size. 3 default. method method=\"pearson\" default value. alternatives passed cor \"spearman\" \"kendall\". last two much slower, particularly big data sets.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/gg_cor.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Triangular Correlation Plot — gg_cor","text":"ggplot object containing triangular correlation figure numeric variables data. return_table TRUE, table used produce figure returned instead.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/gg_cor.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Triangular Correlation Plot — gg_cor","text":"Daniel Ariza, Johan Aparicio.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/gg_cor.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Triangular Correlation Plot — gg_cor","text":"","code":"library(agriutilities) data(iris) gg_cor( data = iris, colours = c(\"#db4437\", \"white\", \"#4285f4\"), label_size = 6 ) #> Dropping non-numeric columns in the dataset: #> Species"},{"path":"https://apariciojohan.github.io/agriutilities/reference/heritability_fa.html","id":null,"dir":"Reference","previous_headings":"","what":"Heritability for Factor Analytic Models in ASReml-R — heritability_fa","title":"Heritability for Factor Analytic Models in ASReml-R — heritability_fa","text":"Heritability Factor Analytic Models ASReml-R","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/heritability_fa.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Heritability for Factor Analytic Models in ASReml-R — heritability_fa","text":"","code":"heritability_fa( model_fa = NULL, genotype = \"line\", env = \"loc\", vc_model = c(\"fa2\"), diag = FALSE )"},{"path":"https://apariciojohan.github.io/agriutilities/reference/heritability_fa.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Heritability for Factor Analytic Models in ASReml-R — heritability_fa","text":"model_fa Factor Analytic ASReml model genotype character string indicating column data contains genotypes. env character string indicating column data contains environments trials. vc_model character string indicating variance-covariance structure. Can \"fa1\", \"fa2\", \"fa3\", \"fa4\" \"us\". diag TRUE FALSE depending user want take elements diagonal variance-covariance matrix elements diagonal estimate heritability. FALSE default.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/heritability_fa.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Heritability for Factor Analytic Models in ASReml-R — heritability_fa","text":"object list : h2_cullis numerical value Cullis heritability estimate. h2_se numerical value Cullis heritability estimate based standard error.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/heritability_fa.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Heritability for Factor Analytic Models in ASReml-R — heritability_fa","text":"","code":"if (FALSE) { library(agridat) library(agriutilities) data(besag.met) dat <- besag.met results <- check_design_met( data = dat, genotype = \"gen\", trial = \"county\", traits = c(\"yield\"), rep = \"rep\", block = \"block\", col = \"col\", row = \"row\" ) out <- single_trial_analysis(results, progress = FALSE) met_results <- met_analysis(out, progress = FALSE) model <- met_results$met_models$yield heritability_fa( model_fa = model, genotype = \"genotype\", env = \"trial\", vc_model = \"us\" ) }"},{"path":"https://apariciojohan.github.io/agriutilities/reference/h_cullis.html","id":null,"dir":"Reference","previous_headings":"","what":"Cullis heritability for lme4 models — h_cullis","title":"Cullis heritability for lme4 models — h_cullis","text":"Cullis heritability lme4 models","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/h_cullis.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Cullis heritability for lme4 models — h_cullis","text":"","code":"h_cullis(model, genotype, re_MME = FALSE)"},{"path":"https://apariciojohan.github.io/agriutilities/reference/h_cullis.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Cullis heritability for lme4 models — h_cullis","text":"model Object class lmer. genotype character string indicating column data contains genotypes. re_MME logical value ask want reconstruct mixed models equations estimate Cullis heritability. (FALSE default)","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/h_cullis.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Cullis heritability for lme4 models — h_cullis","text":"numerical value Cullis heritability estimate. re_MME TRUE, list matrices mixed models equations returned.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/h_cullis.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Cullis heritability for lme4 models — h_cullis","text":"Paul Schmidt, Johan Aparicio.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/h_cullis.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Cullis heritability for lme4 models — h_cullis","text":"","code":"# \\donttest{ library(lme4) #> Loading required package: Matrix library(agridat) library(agriutilities) dat <- john.alpha g.ran <- lmer( formula = yield ~ rep + (1 | gen) + (1 | rep:block), data = dat ) h_cullis(model = g.ran, genotype = \"gen\") #> [1] 0.7979968 # }"},{"path":"https://apariciojohan.github.io/agriutilities/reference/met_analysis.html","id":null,"dir":"Reference","previous_headings":"","what":"Multi-Environmental Trial Analysis — met_analysis","title":"Multi-Environmental Trial Analysis — met_analysis","text":"results single_trial_analysis() function used met_analysis() fit multi-environmental trial models. Returns object class metAgri, list trial effects, BLUPs, heritability, variance components, stability models fitted.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/met_analysis.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Multi-Environmental Trial Analysis — met_analysis","text":"","code":"met_analysis( sma_output = NULL, h2_filter = 0.2, workspace = \"1gb\", vcov = NULL, filter_traits = NULL, remove_trials = NULL, progress = TRUE )"},{"path":"https://apariciojohan.github.io/agriutilities/reference/met_analysis.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Multi-Environmental Trial Analysis — met_analysis","text":"sma_output Object class smaAgri resulting executing single_trial_analysis() function. h2_filter Numeric value filter trials poor heritability. 0.2 default. workspace Sets workspace core REML routines form number optionally followed directly valid measurement unit. \"128mb\" default. vcov character string specifying Variance-Covariance structure fitted. Can \"fa2\", \"fa1\", \"us\", \"corh\" \"corv\". NULL function try fit \"us\" Variance-Covariance fails, try \"fa2\" \"fa1\". filter_traits character vector traits filter. NULL default. remove_trials character vector trials remove. NULL default. progress progress modeling printed. TRUE, every trait line output indicating model fitted.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/met_analysis.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Multi-Environmental Trial Analysis — met_analysis","text":"object class metAgri, list : trial_effects data.frame containing Trial BLUEs. overall_BLUPs data.frame containing Genotypic BLUPs across trials, trait. BLUPs_GxE data.frame containing Genotypic BLUPs trial/trait. VCOV list trait contanining variance-covariance fitted. stability data.frame containing several Stability coefficients resulting executing function stability(). heritability data.frame containing overall heritabilities trait. met_models list trait containing fitted models.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/met_analysis.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Multi-Environmental Trial Analysis — met_analysis","text":"","code":"if (FALSE) { library(agridat) library(agriutilities) data(besag.met) dat <- besag.met results <- check_design_met( data = dat, genotype = \"gen\", trial = \"county\", traits = c(\"yield\"), rep = \"rep\", block = \"block\", col = \"col\", row = \"row\" ) out <- single_trial_analysis(results, progress = FALSE) met_results <- met_analysis(out, progress = FALSE) print(met_results) covcor_heat(matrix = met_results$VCOV$yield$CORR) }"},{"path":"https://apariciojohan.github.io/agriutilities/reference/parameters_gg.html","id":null,"dir":"Reference","previous_headings":"","what":"Genetic Gain Parameters — parameters_gg","title":"Genetic Gain Parameters — parameters_gg","text":"Genetic Gain Parameters","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/parameters_gg.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Genetic Gain Parameters — parameters_gg","text":"","code":"parameters_gg(model, trait = \"trait\")"},{"path":"https://apariciojohan.github.io/agriutilities/reference/parameters_gg.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Genetic Gain Parameters — parameters_gg","text":"model Linear regression model (lm object) trait character string indicating column data contains trials.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/parameters_gg.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Genetic Gain Parameters — parameters_gg","text":"data.frame parameters linear regression (Slope, se_Slope, Intercept, r2, Pr(>F)) percentage Genetic Gain.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/parameters_gg.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Genetic Gain Parameters — parameters_gg","text":"","code":"# \\donttest{ library(ggplot2) library(agridat) library(magrittr) library(agriutilities) data(baker.barley.uniformity) dat <- baker.barley.uniformity head(dat) #> row col year yield #> 1 1 1 1924 2960 #> 2 1 2 1924 3060 #> 3 1 3 1924 3280 #> 4 1 4 1924 2570 #> 5 1 5 1924 2000 #> 6 1 6 1924 1800 model <- lm(yield ~ year, dat) dat %>% na.omit() %>% ggplot( aes(x = year, y = yield) ) + geom_point() + geom_smooth(method = \"lm\") + theme_bw() #> `geom_smooth()` using formula = 'y ~ x' parameters_gg(model = model, trait = \"yield\") #> trait first_year last_year Slope se_Slope Intercept r2 #> Regression yield 1924 1935 -109.7417 7.97398 214307.5 0.2507339 #> Pr(>F) Genetic_Gain% #> Regression 2.215553e-37 -3.468011 # }"},{"path":"https://apariciojohan.github.io/agriutilities/reference/pipe.html","id":null,"dir":"Reference","previous_headings":"","what":"Pipe operator — %>%","title":"Pipe operator — %>%","text":"See magrittr::%>% details.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/pipe.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Pipe operator — %>%","text":"","code":"lhs %>% rhs"},{"path":"https://apariciojohan.github.io/agriutilities/reference/pipe.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Pipe operator — %>%","text":"lhs value magrittr placeholder. rhs function call using magrittr semantics.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/pipe.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Pipe operator — %>%","text":"result calling `rhs(lhs)`.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/plot.checkAgri.html","id":null,"dir":"Reference","previous_headings":"","what":"Plot an object of class checkAgri — plot.checkAgri","title":"Plot an object of class checkAgri — plot.checkAgri","text":"Create several plots object class checkAgri","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/plot.checkAgri.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plot an object of class checkAgri — plot.checkAgri","text":"","code":"# S3 method for checkAgri plot( x, type = c(\"connectivity\", \"missing\", \"boxplot\"), axis_size = 15, text_size = 5, ... )"},{"path":"https://apariciojohan.github.io/agriutilities/reference/plot.checkAgri.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plot an object of class checkAgri — plot.checkAgri","text":"x object inheriting class checkAgri resulting executing function check_design_met() type character string specifiying type plot. \"connectivity\", \"missing\" \"boxplot\". axis_size Numeric input define axis size. text_size Numeric input define text size. ... graphical parameters. future improvements.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/plot.checkAgri.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Plot an object of class checkAgri — plot.checkAgri","text":"ggplot object.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/plot.checkAgri.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Plot an object of class checkAgri — plot.checkAgri","text":"Johan Aparicio [aut]","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/plot.checkAgri.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Plot an object of class checkAgri — plot.checkAgri","text":"","code":"library(agridat) library(agriutilities) data(besag.met) dat <- besag.met results <- check_design_met( data = dat, genotype = \"gen\", trial = \"county\", traits = c(\"yield\"), rep = \"rep\", block = \"block\", col = \"col\", row = \"row\" ) plot(results, type = \"missing\") plot(results, type = \"boxplot\") #> Warning: Removed 36 rows containing non-finite values (`stat_boxplot()`)."},{"path":"https://apariciojohan.github.io/agriutilities/reference/plot.metAgri.html","id":null,"dir":"Reference","previous_headings":"","what":"Plot an object of class metAgri — plot.metAgri","title":"Plot an object of class metAgri — plot.metAgri","text":"Create several plots object class metAgri","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/plot.metAgri.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plot an object of class metAgri — plot.metAgri","text":"","code":"# S3 method for metAgri plot( x, type = c(\"correlation\", \"covariance\", \"multi_traits\"), filter_traits = NULL, text_size = 4, ... )"},{"path":"https://apariciojohan.github.io/agriutilities/reference/plot.metAgri.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plot an object of class metAgri — plot.metAgri","text":"x object inheriting class metAgri resulting executing function met_analysis() type character string specifying type plot. \"correlation\", \"covariance\" \"multi_traits\" filter_traits optional character vector filter traits. text_size Numeric input define text size. ... graphical parameters passed covcor_heat().","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/plot.metAgri.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Plot an object of class metAgri — plot.metAgri","text":"ggplot object.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/plot.metAgri.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Plot an object of class metAgri — plot.metAgri","text":"Johan Aparicio [aut]","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/plot.metAgri.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Plot an object of class metAgri — plot.metAgri","text":"","code":"if (FALSE) { library(agridat) library(agriutilities) data(besag.met) dat <- besag.met results <- check_design_met( data = dat, genotype = \"gen\", trial = \"county\", traits = c(\"yield\"), rep = \"rep\", block = \"block\", col = \"col\", row = \"row\" ) out <- single_trial_analysis(results, progress = FALSE) met_results <- met_analysis(out, progress = FALSE) print(met_results) plot(met_results, type = \"correlation\") plot(met_results, type = \"covariance\") }"},{"path":"https://apariciojohan.github.io/agriutilities/reference/plot.smaAgri.html","id":null,"dir":"Reference","previous_headings":"","what":"Plot an object of class smaAgri — plot.smaAgri","title":"Plot an object of class smaAgri — plot.smaAgri","text":"Create several plots object class smaAgri","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/plot.smaAgri.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plot an object of class smaAgri — plot.smaAgri","text":"","code":"# S3 method for smaAgri plot( x, type = c(\"summary\", \"correlation\", \"spatial\"), filter_traits = NULL, nudge_y_cv = 3, nudge_y_h2 = 0.07, horizontal = FALSE, theme_size = 15, axis_size = 8, text_size = 4, ... )"},{"path":"https://apariciojohan.github.io/agriutilities/reference/plot.smaAgri.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plot an object of class smaAgri — plot.smaAgri","text":"x object inheriting class smaAgri resulting executing function single_trial_analysis() type character string specifiying type plot. \"summary\", \"correlation\" \"spatial\". filter_traits optional character vector filter traits. nudge_y_cv Vertical adjustment nudge labels plotting CV bars. works argument type \"summary\". 3 default. nudge_y_h2 Vertical adjustment nudge labels plotting h2 bars. works argument type \"summary\". 0.07 default. horizontal FALSE, default, labels plotted vertically. TRUE, labels plotted horizontally. theme_size Base font size, given pts. 15 default. axis_size Numeric input define axis size. text_size Numeric input define text size. ... graphical parameters. future improvements.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/plot.smaAgri.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Plot an object of class smaAgri — plot.smaAgri","text":"ggplot object.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/plot.smaAgri.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Plot an object of class smaAgri — plot.smaAgri","text":"Johan Aparicio [aut]","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/plot.smaAgri.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Plot an object of class smaAgri — plot.smaAgri","text":"","code":"# \\donttest{ library(agridat) library(agriutilities) data(besag.met) dat <- besag.met results <- check_design_met( data = dat, genotype = \"gen\", trial = \"county\", traits = c(\"yield\"), rep = \"rep\", block = \"block\", col = \"col\", row = \"row\" ) out <- single_trial_analysis(results, progress = FALSE) print(out) #> --------------------------------------------------------------------- #> Summary Fitted Models: #> --------------------------------------------------------------------- #> trait trial heritability CV VarGen VarErr design #> 1: yield C1 0.73 6.022489 87.39848 82.86095 row_col #> 2: yield C2 0.37 17.104998 25.80684 108.68546 row_col #> 3: yield C3 0.64 12.357202 83.57907 118.55567 row_col #> 4: yield C4 0.41 8.179408 35.75568 136.21218 row_col #> 5: yield C5 0.80 7.037586 103.79822 66.97523 row_col #> 6: yield C6 0.49 16.632367 71.92232 207.53073 row_col #> #> --------------------------------------------------------------------- #> Outliers Removed: #> --------------------------------------------------------------------- #> trait trial genotype id outlier #> 1: yield C1 G60 50 TRUE #> #> --------------------------------------------------------------------- #> First Predicted Values and Standard Errors (BLUEs/BLUPs): #> --------------------------------------------------------------------- #> trait genotype trial BLUEs seBLUEs BLUPs seBLUPs wt #> 1: yield G01 C1 141.4161 6.078858 143.5308 5.249771 0.02706176 #> 2: yield G02 C1 157.8110 5.979708 155.8037 5.194547 0.02796663 #> 3: yield G03 C1 127.3836 6.091534 133.0256 5.269999 0.02694925 #> 4: yield G04 C1 154.8445 6.093866 153.8364 5.270427 0.02692863 #> 5: yield G05 C1 163.8950 6.132141 161.1831 5.271809 0.02659352 #> 6: yield G06 C1 128.5168 6.087902 133.6857 5.247130 0.02698141 #> plot(out, type = \"summary\", horizontal = TRUE) #> Warning: The `facets` argument of `facet_grid()` is deprecated as of ggplot2 2.2.0. #> ℹ Please use the `rows` argument instead. #> ℹ The deprecated feature was likely used in the agriutilities package. #> Please report the issue at #> . plot(out, type = \"correlation\") plot(out, type = \"spatial\") # }"},{"path":"https://apariciojohan.github.io/agriutilities/reference/print.checkAgri.html","id":null,"dir":"Reference","previous_headings":"","what":"Print an object of class checkAgri — print.checkAgri","title":"Print an object of class checkAgri — print.checkAgri","text":"Prints information check_design_met() function.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/print.checkAgri.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Print an object of class checkAgri — print.checkAgri","text":"","code":"# S3 method for checkAgri print(x, ...)"},{"path":"https://apariciojohan.github.io/agriutilities/reference/print.checkAgri.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Print an object of class checkAgri — print.checkAgri","text":"x object fitted function check_design_met(). ... Options used tibble package format output. See `tibble::print()` details.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/print.checkAgri.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Print an object of class checkAgri — print.checkAgri","text":"object inheriting class checkAgri.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/print.checkAgri.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Print an object of class checkAgri — print.checkAgri","text":"Johan Aparicio [aut]","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/print.checkAgri.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Print an object of class checkAgri — print.checkAgri","text":"","code":"library(agridat) library(agriutilities) data(besag.met) dat <- besag.met results <- check_design_met( data = dat, genotype = \"gen\", trial = \"county\", traits = c(\"yield\"), rep = \"rep\", block = \"block\", col = \"col\", row = \"row\" ) print(results) #> --------------------------------------------------------------------- #> Summary Traits by Trial: #> --------------------------------------------------------------------- #> # A tibble: 6 × 11 #> county traits Min Mean Median Max SD CV n n_miss miss_perc #> #> 1 C1 yield 87.9 149. 151. 200. 17.7 0.119 198 6 0.0303 #> 2 C2 yield 24.4 56.1 52.1 125. 18.4 0.328 198 6 0.0303 #> 3 C3 yield 28.2 87.9 89.2 137. 19.7 0.225 198 6 0.0303 #> 4 C4 yield 103. 145. 143. 190. 17.1 0.118 198 6 0.0303 #> 5 C5 yield 66.9 115. 116. 152. 16.4 0.142 198 6 0.0303 #> 6 C6 yield 29.2 87.6 87.8 148. 26.6 0.304 198 6 0.0303 #> #> --------------------------------------------------------------------- #> Experimental Design Detected: #> --------------------------------------------------------------------- #> county exp_design #> 1 C1 row_col #> 2 C2 row_col #> 3 C3 row_col #> 4 C4 row_col #> 5 C5 row_col #> 6 C6 row_col #> #> --------------------------------------------------------------------- #> Summary Experimental Design: #> --------------------------------------------------------------------- #> # A tibble: 6 × 9 #> county n n_gen n_rep n_block n_col n_row num_of_reps num_of_gen #> #> 1 C1 198 64 3 8 11 18 3_9 63_1 #> 2 C2 198 64 3 8 11 18 3_9 63_1 #> 3 C3 198 64 3 8 11 18 3_9 63_1 #> 4 C4 198 64 3 8 11 18 3_9 63_1 #> 5 C5 198 64 3 8 11 18 3_9 63_1 #> 6 C6 198 64 3 8 11 18 3_9 63_1 #> #> --------------------------------------------------------------------- #> Connectivity Matrix: #> --------------------------------------------------------------------- #> C1 C2 C3 C4 C5 C6 #> C1 64 64 64 64 64 64 #> C2 64 64 64 64 64 64 #> C3 64 64 64 64 64 64 #> C4 64 64 64 64 64 64 #> C5 64 64 64 64 64 64 #> C6 64 64 64 64 64 64 #> #> --------------------------------------------------------------------- #> Filters Applied: #> --------------------------------------------------------------------- #> List of 1 #> $ yield:List of 4 #> ..$ missing_50% : chr(0) #> ..$ no_variation : chr(0) #> ..$ row_col_dup : chr(0) #> ..$ trials_to_remove: chr(0) #>"},{"path":"https://apariciojohan.github.io/agriutilities/reference/print.metAgri.html","id":null,"dir":"Reference","previous_headings":"","what":"Print an object of class metAgri — print.metAgri","title":"Print an object of class metAgri — print.metAgri","text":"Prints information met_analysis() function.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/print.metAgri.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Print an object of class metAgri — print.metAgri","text":"","code":"# S3 method for metAgri print(x, ...)"},{"path":"https://apariciojohan.github.io/agriutilities/reference/print.metAgri.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Print an object of class metAgri — print.metAgri","text":"x object fitted function met_analysis(). ... Options used tibble package format output. See `tibble::print()` details.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/print.metAgri.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Print an object of class metAgri — print.metAgri","text":"object inheriting class metAgri.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/print.metAgri.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Print an object of class metAgri — print.metAgri","text":"Johan Aparicio [aut]","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/print.metAgri.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Print an object of class metAgri — print.metAgri","text":"","code":"if (FALSE) { library(agridat) library(agriutilities) data(besag.met) dat <- besag.met results <- check_design_met( data = dat, genotype = \"gen\", trial = \"county\", traits = c(\"yield\"), rep = \"rep\", block = \"block\", col = \"col\", row = \"row\" ) out <- single_trial_analysis(results, progress = FALSE) met_results <- met_analysis(out, progress = FALSE) print(met_results) }"},{"path":"https://apariciojohan.github.io/agriutilities/reference/print.smaAgri.html","id":null,"dir":"Reference","previous_headings":"","what":"Print an object of class smaAgri — print.smaAgri","title":"Print an object of class smaAgri — print.smaAgri","text":"Prints information single_trial_analysis function.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/print.smaAgri.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Print an object of class smaAgri — print.smaAgri","text":"","code":"# S3 method for smaAgri print(x, ...)"},{"path":"https://apariciojohan.github.io/agriutilities/reference/print.smaAgri.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Print an object of class smaAgri — print.smaAgri","text":"x object fitted function single_trial_analysis(). ... Options used tibble package format output. See `tibble::print()` details.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/print.smaAgri.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Print an object of class smaAgri — print.smaAgri","text":"object inheriting class smaAgri.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/print.smaAgri.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Print an object of class smaAgri — print.smaAgri","text":"Johan Aparicio [aut]","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/print.smaAgri.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Print an object of class smaAgri — print.smaAgri","text":"","code":"# \\donttest{ library(agridat) library(agriutilities) data(besag.met) dat <- besag.met results <- check_design_met( data = dat, genotype = \"gen\", trial = \"county\", traits = c(\"yield\"), rep = \"rep\", block = \"block\", col = \"col\", row = \"row\" ) out <- single_trial_analysis(results, progress = FALSE) print(out) #> --------------------------------------------------------------------- #> Summary Fitted Models: #> --------------------------------------------------------------------- #> trait trial heritability CV VarGen VarErr design #> 1: yield C1 0.73 6.022489 87.39848 82.86095 row_col #> 2: yield C2 0.37 17.104998 25.80684 108.68546 row_col #> 3: yield C3 0.64 12.357202 83.57907 118.55567 row_col #> 4: yield C4 0.41 8.179408 35.75568 136.21218 row_col #> 5: yield C5 0.80 7.037586 103.79822 66.97523 row_col #> 6: yield C6 0.49 16.632367 71.92232 207.53073 row_col #> #> --------------------------------------------------------------------- #> Outliers Removed: #> --------------------------------------------------------------------- #> trait trial genotype id outlier #> 1: yield C1 G60 50 TRUE #> #> --------------------------------------------------------------------- #> First Predicted Values and Standard Errors (BLUEs/BLUPs): #> --------------------------------------------------------------------- #> trait genotype trial BLUEs seBLUEs BLUPs seBLUPs wt #> 1: yield G01 C1 141.4161 6.078858 143.5308 5.249771 0.02706176 #> 2: yield G02 C1 157.8110 5.979708 155.8037 5.194547 0.02796663 #> 3: yield G03 C1 127.3836 6.091534 133.0256 5.269999 0.02694925 #> 4: yield G04 C1 154.8445 6.093866 153.8364 5.270427 0.02692863 #> 5: yield G05 C1 163.8950 6.132141 161.1831 5.271809 0.02659352 #> 6: yield G06 C1 128.5168 6.087902 133.6857 5.247130 0.02698141 #> # }"},{"path":"https://apariciojohan.github.io/agriutilities/reference/single_trial_analysis.html","id":null,"dir":"Reference","previous_headings":"","what":"Single Trial Analysis — single_trial_analysis","title":"Single Trial Analysis — single_trial_analysis","text":"results check_design_met() function used single_trial_analysis() fit single trial models. function can fit, Completely Randomized Designs (CRD), Randomized Complete Block Designs (RCBD), Resolvable Incomplete Block Designs (res-IBD), Non-Resolvable Row-Column Designs (Row-Col) Resolvable Row-Column Designs (res-Row-Col). Returns object class smaAgri, list trial summary, BLUEs, BLUPs, heritability, variance components, potential extreme observations, residuals, models fitted data used. function generate required output used two-stage analysis.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/single_trial_analysis.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Single Trial Analysis — single_trial_analysis","text":"","code":"single_trial_analysis( results = NULL, progress = TRUE, engine = \"asreml\", remove_outliers = TRUE )"},{"path":"https://apariciojohan.github.io/agriutilities/reference/single_trial_analysis.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Single Trial Analysis — single_trial_analysis","text":"results Object class checkAgri resulting executing check_design_met() function. progress progress modeling printed. TRUE, every trial line output indicating traits fitted particular trial. engine character string specifying name mixed modeling engine use, either lme4 asreml. spatial designs, SpATS always used, designs asreml default. remove_outliers outliers removed? TRUE default.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/single_trial_analysis.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Single Trial Analysis — single_trial_analysis","text":"object class smaAgri, list : fitted_models list containing fitted models. (models, one Genotype Random one Genotype Fixed) resum_fitted_model data.frame containing summary fitted models. outliers data.frame containing extreme observations. remove_outliers TRUE, data.frame contain observations removed. blues_blups data.frame containing BLUPs/BLUEs genotypes trial. std_residuals data.frame containing standardized residuals model genotype random component. data data.frame containing data used. remove_outliers TRUE, data missing values outliers detected.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/single_trial_analysis.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Single Trial Analysis — single_trial_analysis","text":"","code":"# \\donttest{ library(agridat) library(agriutilities) data(besag.met) dat <- besag.met results <- check_design_met( data = dat, genotype = \"gen\", trial = \"county\", traits = c(\"yield\"), rep = \"rep\", block = \"block\", col = \"col\", row = \"row\" ) out <- single_trial_analysis(results, progress = FALSE) print(out) #> --------------------------------------------------------------------- #> Summary Fitted Models: #> --------------------------------------------------------------------- #> trait trial heritability CV VarGen VarErr design #> 1: yield C1 0.73 6.022489 87.39848 82.86095 row_col #> 2: yield C2 0.37 17.104998 25.80684 108.68546 row_col #> 3: yield C3 0.64 12.357202 83.57907 118.55567 row_col #> 4: yield C4 0.41 8.179408 35.75568 136.21218 row_col #> 5: yield C5 0.80 7.037586 103.79822 66.97523 row_col #> 6: yield C6 0.49 16.632367 71.92232 207.53073 row_col #> #> --------------------------------------------------------------------- #> Outliers Removed: #> --------------------------------------------------------------------- #> trait trial genotype id outlier #> 1: yield C1 G60 50 TRUE #> #> --------------------------------------------------------------------- #> First Predicted Values and Standard Errors (BLUEs/BLUPs): #> --------------------------------------------------------------------- #> trait genotype trial BLUEs seBLUEs BLUPs seBLUPs wt #> 1: yield G01 C1 141.4161 6.078858 143.5308 5.249771 0.02706176 #> 2: yield G02 C1 157.8110 5.979708 155.8037 5.194547 0.02796663 #> 3: yield G03 C1 127.3836 6.091534 133.0256 5.269999 0.02694925 #> 4: yield G04 C1 154.8445 6.093866 153.8364 5.270427 0.02692863 #> 5: yield G05 C1 163.8950 6.132141 161.1831 5.271809 0.02659352 #> 6: yield G06 C1 128.5168 6.087902 133.6857 5.247130 0.02698141 #> # }"},{"path":"https://apariciojohan.github.io/agriutilities/reference/stability.html","id":null,"dir":"Reference","previous_headings":"","what":"Stability Coefficients — stability","title":"Stability Coefficients — stability","text":"Stability Coefficients","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/stability.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Stability Coefficients — stability","text":"","code":"stability( predictions = NULL, genotype = NULL, trial = NULL, response = NULL, best = \"max\" )"},{"path":"https://apariciojohan.github.io/agriutilities/reference/stability.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Stability Coefficients — stability","text":"predictions data.frame one value per GxE combination. genotype character string indicating column predictions contains genotypes. trial character string indicating column predictions contains trials. response character string specifying response variable. best character string specifying define best genotype numeric value (\"min\", \"max\"). \"max\" default.","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/stability.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Stability Coefficients — stability","text":"data.frame several stability measures. \"superiority\" (cultivar-superiority measure), \"static\" (Shukla's stability variance) \"wricke\" (Wricke's ecovalence).","code":""},{"path":"https://apariciojohan.github.io/agriutilities/reference/stability.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Stability Coefficients — stability","text":"","code":"if (FALSE) { library(agridat) library(agriutilities) data(besag.met) dat <- besag.met results <- check_design_met( data = dat, genotype = \"gen\", trial = \"county\", traits = c(\"yield\"), rep = \"rep\", block = \"block\", col = \"col\", row = \"row\" ) out <- single_trial_analysis(results, progress = FALSE) met_results <- met_analysis(out, progress = FALSE) head( stability( predictions = met_results$BLUPs_GxE, genotype = \"genotype\", trial = \"trial\", response = \"predicted.value\" ) ) }"},{"path":"https://apariciojohan.github.io/agriutilities/news/index.html","id":"agriutilities-120","dir":"Changelog","previous_headings":"","what":"agriutilities 1.2.0","title":"agriutilities 1.2.0","text":"CRAN release: 2024-01-20 Add extract_rcov() extract variance-covariance matrices. Add method passed cor function gg_cor(). Change style naming parameters gg_cor(). Minor changes writing style. Add reorder logical value reorder Hierarchical Clustering covcor_heat().","code":""},{"path":"https://apariciojohan.github.io/agriutilities/news/index.html","id":"agriutilities-110","dir":"Changelog","previous_headings":"","what":"agriutilities 1.1.0","title":"agriutilities 1.1.0","text":"CRAN release: 2023-03-19","code":""},{"path":"https://apariciojohan.github.io/agriutilities/news/index.html","id":"minor-changesfixes-1-1-0","dir":"Changelog","previous_headings":"","what":"Minor changes/fixes","title":"agriutilities 1.1.0","text":"Add type = \"spatial\" plot.smaAgri() method. Add restriction identifying row-column designs. Add minimum maximum value returning summary check_design_met(). Add S3 method plot object class metAgri plot.metAgri(). Add S3 method plot object class smaAgri plot.smaAgri(). Fix argument working covcor_heat().","code":""},{"path":"https://apariciojohan.github.io/agriutilities/news/index.html","id":"agriutilities-100","dir":"Changelog","previous_headings":"","what":"agriutilities 1.0.0","title":"agriutilities 1.0.0","text":"CRAN release: 2023-02-16","code":""}] diff --git a/man/extract_rcov.Rd b/man/extract_rcov.Rd index 3c59bad..7f6da57 100644 --- a/man/extract_rcov.Rd +++ b/man/extract_rcov.Rd @@ -14,8 +14,8 @@ extract_rcov(model = NULL, time = "Time", plot = "Plot", vc_error = NULL) \item{plot}{A character string indicating the "PlotID"} \item{vc_error}{An optional character string indicating the variance covariance. -Can be "corv", "us", "expv", "exph", "ar1v", "ar1h" or "ante". By using NULL -the function tries to guess which was the variance-covariance used.} +Can be "corv", "corh", "corgh", "us", "expv", "exph", "ar1v", "ar1h" or "ante". +By using NULL the function tries to guess which was the variance-covariance used.} } \value{ An object with a list of: @@ -24,7 +24,8 @@ An object with a list of: \item{vc}{A character string indicating the variance-covariance fitted.} } \description{ -This function is specially useful when running repeated measurements models. +This function is specially useful for extracting residual variance covariance +matrices from ASReml-R when running repeated measurements models. } \examples{ \dontrun{ @@ -145,11 +146,11 @@ models <- list( summary_models <- data.frame( model = names(models), - aic = unlist(lapply(models, function(x) summary(x)$aic)), - bic = unlist(lapply(models, function(x) summary(x)$bic)), - loglik = unlist(lapply(models, function(x) summary(x)$loglik)), - nedf = unlist(lapply(models, function(x) summary(x)$nedf)), - param = unlist(lapply(models, function(x) attr(summary(x)$aic, "param"))), + aic = unlist(lapply(models, \(x) summary(x)$aic)), + bic = unlist(lapply(models, \(x) summary(x)$bic)), + loglik = unlist(lapply(models, \(x) summary(x)$loglik)), + nedf = unlist(lapply(models, \(x) summary(x)$nedf)), + param = unlist(lapply(models, \(x) attr(summary(x)$aic, "param"))), row.names = NULL ) @@ -165,6 +166,8 @@ summary_models \%>\% # Extracting Variance Covariance Matrix ----------------------------------- +extract_rcov(model_4, time = "Time", plot = "Plant") + covcor_heat( matrix = extract_rcov(model_1, time = "Time", plot = "Plant")$corr, legend = "none", diff --git a/vignettes/repeated_measurements.Rmd b/vignettes/repeated_measurements.Rmd index dd4e68d..bff2da6 100644 --- a/vignettes/repeated_measurements.Rmd +++ b/vignettes/repeated_measurements.Rmd @@ -21,12 +21,14 @@ The `extract_rcov()` function is a practical tool for extracting the residual va Currently, the structures available are: 1. Simple correlation model (`corv`); homogeneous variance form. -2. Exponential (or power) model (`expv`); homogeneous variance form. -3. Exponential (or power) model (`exph`); heterogeneous variance form. -4. Autoregressive model of order 1 (`ar1v`); homogeneous variance form. -5. Autoregressive model of order 1 (`ar1h`); heterogeneous variance form. -6. Antedependence variance model of order 1 (`ante`). -7. Unstructured variance model (`us`). +2. Simple correlation model (`corh`); heterogeneous variance form. +3. General correlation model (`corgh`); heterogeneous variance form. +4. Exponential (or power) model (`expv`); homogeneous variance form. +5. Exponential (or power) model (`exph`); heterogeneous variance form. +6. Autoregressive model of order 1 (`ar1v`); homogeneous variance form. +7. Autoregressive model of order 1 (`ar1h`); heterogeneous variance form. +8. Antedependence variance model of order 1 (`ante`). +9. Unstructured variance model (`us`). [Watch the tutorial](https://www.youtube.com/watch?v=BwvTFZDejXI): A good guide on fitting repeated measurement models in ASReml by VSNi. However, it might leave you wondering how to actually extract the fitted residual variance-covariance matrix. That's where `extract_rcov()` comes into play. @@ -42,8 +44,8 @@ library(dplyr) library(tibble) library(asreml) -head(grassUV) %>% print() -grassUV %>% +head(grassUV) |> print() +grassUV |> ggplot( aes(x = Time, y = y, group = Plant, color = Plant) ) + @@ -63,8 +65,8 @@ library(tibble) if (requireNamespace("asreml", quietly = TRUE)) { library(asreml) - head(grassUV) %>% print() - grassUV %>% + head(grassUV) |> print() + grassUV |> ggplot( aes(x = Time, y = y, group = Plant, color = Plant) ) + @@ -77,10 +79,10 @@ if (requireNamespace("asreml", quietly = TRUE)) { ## Exploration ```{r, eval = FALSE} -tmp <- grassUV %>% - group_by(Time, Plant) %>% - summarise(mean = mean(y, na.rm = TRUE)) %>% - spread(Time, mean) %>% +tmp <- grassUV |> + group_by(Time, Plant) |> + summarise(mean = mean(y, na.rm = TRUE)) |> + spread(Time, mean) |> column_to_rownames("Plant") a <- covcor_heat( @@ -90,16 +92,16 @@ a <- covcor_heat( ) + ggtitle(label = "Pearson Correlation") -b <- tmp %>% - cor(use = "pairwise.complete.obs") %>% - as.data.frame() %>% - rownames_to_column(var = "Time") %>% - gather("DAP2", "corr", -1) %>% - type.convert(as.is = FALSE) %>% - mutate(corr = ifelse(Time < DAP2, NA, corr)) %>% - mutate(DAP2 = as.factor(DAP2)) %>% +b <- tmp |> + cor(use = "pairwise.complete.obs") |> + as.data.frame() |> + rownames_to_column(var = "Time") |> + gather("Time2", "corr", -1) |> + type.convert(as.is = FALSE) |> + mutate(corr = ifelse(Time < Time2, NA, corr)) |> + mutate(Time2 = as.factor(Time2)) |> ggplot( - aes(x = Time, y = corr, group = DAP2, color = DAP2) + aes(x = Time, y = corr, group = Time2, color = Time2) ) + geom_point() + geom_line() + @@ -113,10 +115,10 @@ ggarrange(a, b) ```{r, warning=FALSE, message=FALSE, fig.width = 9, echo = FALSE} if (requireNamespace("asreml", quietly = TRUE)) { - tmp <- grassUV %>% - group_by(Time, Plant) %>% - summarise(mean = mean(y, na.rm = TRUE)) %>% - spread(Time, mean) %>% + tmp <- grassUV |> + group_by(Time, Plant) |> + summarise(mean = mean(y, na.rm = TRUE)) |> + spread(Time, mean) |> column_to_rownames("Plant") a <- covcor_heat( @@ -126,16 +128,16 @@ if (requireNamespace("asreml", quietly = TRUE)) { ) + ggtitle(label = "Pearson Correlation") - b <- tmp %>% - cor(use = "pairwise.complete.obs") %>% - as.data.frame() %>% - rownames_to_column(var = "Time") %>% - gather("DAP2", "corr", -1) %>% - type.convert(as.is = FALSE) %>% - mutate(corr = ifelse(Time < DAP2, NA, corr)) %>% - mutate(DAP2 = as.factor(DAP2)) %>% + b <- tmp |> + cor(use = "pairwise.complete.obs") |> + as.data.frame() |> + rownames_to_column(var = "Time") |> + gather("Time2", "corr", -1) |> + type.convert(as.is = FALSE) |> + mutate(corr = ifelse(Time < Time2, NA, corr)) |> + mutate(Time2 = as.factor(Time2)) |> ggplot( - aes(x = Time, y = corr, group = DAP2, color = DAP2) + aes(x = Time, y = corr, group = Time2, color = Time2) ) + geom_point() + geom_line() + @@ -296,9 +298,9 @@ summary_models <- data.frame( row.names = NULL ) -summary_models %>% print() +summary_models |> print() -summary_models %>% +summary_models |> ggplot( aes(x = reorder(model, -bic), y = bic, group = 1) ) + @@ -333,9 +335,9 @@ if (requireNamespace("asreml", quietly = TRUE)) { row.names = NULL ) - summary_models %>% print() + summary_models |> print() - summary_models %>% + summary_models |> ggplot( aes(x = reorder(model, -bic), y = bic, group = 1) ) + @@ -369,38 +371,38 @@ The table below shows the summary of Wald statistics for fixed effects for the m ```{r, echo=FALSE} if (requireNamespace("asreml", quietly = TRUE)) { library(gt) - models %>% - lapply(\(x) wald(x, denDF = "numeric", ssType = "conditional")$Wald) %>% - lapply(\(x) rownames_to_column(x, "Factor")) %>% - rbindlist(idcol = "Model") %>% - filter(Factor %in% c("Time", "Tmt", "Tmt:Time")) %>% - select(Model, Factor, F.con, Pr) %>% - pivot_wider(names_from = Factor, values_from = c(F.con, Pr)) %>% - mutate_if(is.numeric, round, 3) %>% - gt() %>% + models |> + lapply(\(x) wald(x, denDF = "numeric", ssType = "conditional")$Wald) |> + lapply(\(x) rownames_to_column(x, "Factor")) |> + rbindlist(idcol = "Model") |> + filter(Factor %in% c("Time", "Tmt", "Tmt:Time")) |> + select(Model, Factor, F.con, Pr) |> + pivot_wider(names_from = Factor, values_from = c(F.con, Pr)) |> + mutate_if(is.numeric, round, 3) |> + gt() |> tab_spanner( label = "Time", columns = c(F.con_Time, Pr_Time) - ) %>% + ) |> tab_spanner( label = "Tmt", columns = c(F.con_Tmt, Pr_Tmt) - ) %>% + ) |> tab_spanner( label = "Tmt:Time", columns = c(`F.con_Tmt:Time`, `Pr_Tmt:Time`) - ) %>% + ) |> data_color( columns = c(`Pr_Tmt:Time`), method = "numeric", palette = "ggsci::red_material", domain = c(0, 0.08), reverse = FALSE - ) %>% + ) |> cols_align( align = "center", columns = everything() - ) %>% + ) |> cols_label( F.con_Tmt = "F.value", Pr_Tmt = "P.value", @@ -479,7 +481,7 @@ if (requireNamespace("asreml", quietly = TRUE)) { ```{r, eval = FALSE} pvals <- predict(model_4, classify = "Tmt:Time")$pvals -grassUV %>% +grassUV |> ggplot( aes(x = Time, y = y, group = Tmt, color = Tmt, shape = Tmt) ) + @@ -493,7 +495,7 @@ grassUV %>% ```{r, warning=FALSE, message=FALSE, fig.width = 9, echo = FALSE} if (requireNamespace("asreml", quietly = TRUE)) { pvals <- predict(model_4, classify = "Tmt:Time")$pvals - grassUV %>% + grassUV |> ggplot( aes(x = Time, y = y, group = Tmt, color = Tmt, shape = Tmt) ) +