Compute the Mahalanobis distance using data from an experiment conducted in a randomized complete block design or completely randomized design.
mahala_design( .data, gen, rep, resp, design = "RCBD", by = NULL, return = "distance" )
.data | The dataset containing the columns related to Genotypes,
replication/block and response variables, possible with grouped data passed
from |
---|---|
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 |
design | The experimental design. Must be RCBD or CRD. |
by | One variable (factor) to compute the function by. It is a shortcut
to |
return | What the function return? Default is 'distance', i.e., the
Mahalanobis distance. Alternatively, it is possible to return the matrix of
means |
A symmetric matrix with the Mahalanobis' distance. If .data
is
a grouped data passed from group_by()
then the results
will be returned into a list-column of data frames.
Tiago Olivoto tiagoolivoto@gmail.com
# \donttest{ library(metan) maha <- mahala_design(data_g, gen = GEN, rep = REP, resp = everything(), return = "covmat") # Compute one distance for each environment (all numeric variables) maha_group <- mahala_design(data_ge, gen = GEN, rep = REP, resp = everything(), by = ENV) # Return the variance-covariance matrix of residuals cov_mat <- mahala_design(data_ge, gen = GEN, rep = REP, resp = c(GY, HM), return = 'covmat') # }