covcor_design {metan}R Documentation

Variance-covariance matrices for designed experiments

Description

[Stable]

Compute variance-covariance and correlation matrices using data from a designed (RCBD or CRD) experiment.

Usage

covcor_design(.data, gen, rep, resp, design = "RCBD", by = NULL, type = NULL)

Arguments

.data

The data to be analyzed. It can be a data frame, possible with grouped data passed from dplyr::group_by().

gen

The name of the column that contains the levels of the genotypes.

rep

The name of the column that contains the levels of the replications/blocks.

resp

The response variables. For example resp = c(var1, var2, var3).

design

The experimental design. Must be RCBD or CRD.

by

One variable (factor) to compute the function by. It is a shortcut to dplyr::group_by(). To compute the statistics by more than one grouping variable use that function.

type

What the matrices should return? Set to NULL, i.e., a list of matrices is returned. The argument type allow the following values ⁠'pcor', 'gcor', 'rcor'⁠, (which will return the phenotypic, genotypic and residual correlation matrices, respectively) or ⁠'pcov', 'gcov', 'rcov'⁠ (which will return the phenotypic, genotypic and residual variance-covariance matrices, respectively). Alternatively, it is possible to get a matrix with the means of each genotype in each trait, by using type = 'means'.

Value

An object of class covcor_design containing the following items:

If .data is a grouped data passed from dplyr::group_by() then the results will be returned into a list-column of data frames.

Author(s)

Tiago Olivoto tiagoolivoto@gmail.com

Examples


library(metan)
# List of matrices
data <- subset(data_ge2, ENV == 'A1')
matrices <- covcor_design(data,
                          gen = GEN,
                          rep = REP,
                          resp = c(PH, EH, NKE, TKW))

# Genetic correlations
gcor <- covcor_design(data,
                      gen = GEN,
                      rep = REP,
                      resp = c(PH, EH, NKE, TKW),
                      type = 'gcor')

# Residual (co)variance matrix for each environment
rcov <- covcor_design(data_ge2,
                      gen = GEN,
                      rep = REP,
                      resp = c(PH, EH, CD, CL),
                      by = ENV,
                      type = "rcov")



[Package metan version 1.18.0 Index]