Title: | Moving Grid Adjustment in Plant Breeding Field Trials |
---|---|
Description: | Package for moving grid adjustment in plant breeding field trials. |
Authors: | Frank Technow |
Maintainer: | Frank Technow <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.1.6 |
Built: | 2024-10-31 20:53:09 UTC |
Source: | CRAN |
The mvngGrAd package allows to perform a moving grid adjustment in plant breeding field trials. Please see the included vignette for a more detailed description of the package and the rational behind moving grid adjustment.
Package: | mvngGrAd |
Type: | Package |
Version: | 0.1.5 |
Date: | 2023-10-09 |
License: | GNU General Public License Version 2, June 1991 |
LazyLoad: | no |
The main function, movingGrid
, performs the adjustment with a
user designed grid. The function sketchGrid
helps with designing
the grid by plotting its shape. The functions fitted
,
movingMean
and entryData
are convenience functions to
extract the most relevant information from the object created by
movingGrid
. The package defines one new class, movG
, and
provides methods for it for the functions, movingMean
,
entryData
, fitted
, summary
, show
and
residuals
.
1.1
Frank Technow
Maintainer: Frank Technow [email protected]
The function finds the subscripts of the cells that extend the grid in layers that extend from the center in all directions other than 0, 90, 180 and 270 degree. The function is not intended to be called by the user.
circularExtension(i, j, layers, rowLimit, colLimit)
circularExtension(i, j, layers, rowLimit, colLimit)
i |
|
j |
|
layers |
|
rowLimit |
|
colLimit |
|
This function is called by the function movingGrid
and is not
intended to be called by the user.
A matrix with the row subscripts of the cells in column one and the column subscripts in column two.
1.1
Frank Technow
circularExtension(i = 1, j = 10, rowLimit = 50, colLimit = 50, layers = c(1,2,3))
circularExtension(i = 1, j = 10, rowLimit = 50, colLimit = 50, layers = c(1,2,3))
Generic function to extract the most relevant information from the adjustment procedure for each entry included in the trial.
entryData(object,...)
entryData(object,...)
object |
an object from the context of moving grid adjustment |
... |
possible other arguments to methods |
returned is a data.frame
with the following content
row |
the row of the entry |
column |
the column of the entry |
column |
the column of the entry |
adjustedPhe |
the adjusted phenotypic value |
observedPhe |
the observed phenotypic value |
movingMean |
the moving mean |
nValues |
the number of values to calculate the moving mean |
... and possibly more
1.1
Frank Technow
movingGrid
(includes example of entryData
)
Methods for function entryData
returned is a data.frame
with:
row, column, adj. phenotypic value,
obs. phenotypic value, moving mean, number of values
The function finds the subscripts of the cells that extend from the center in 0, 90, 180 and 270 degree direction ('cross shape'). The function is not intended to be called by the user.
extendHorVer(i, j, shapeCross, rowLimit, colLimit)
extendHorVer(i, j, shapeCross, rowLimit, colLimit)
i |
|
j |
|
shapeCross |
Elements can be NULL (no extension in this direction) and must contain no '0', duplicated or negative values.
|
rowLimit |
|
colLimit |
|
This function is called by the function movingGrid
and is not
intended to be called by the user.
A matrix with the row subscripts of the cells in column one and the column subscripts in column two.
1.1
Frank Technow
shape <- list(c(1,2,3), c(1,2,3), c(1:5), c(1:5)) extendHorVer(i = 25, j = 25, shapeCross = shape, rowLimit = 50, colLimit = 50)
shape <- list(c(1,2,3), c(1,2,3), c(1:5), c(1:5)) extendHorVer(i = 25, j = 25, shapeCross = shape, rowLimit = 50, colLimit = 50)
Methods for function fitted
in Package "stats"
default method, the S3 generic
Returns a vector with the adjusted values.
The "movG" Class Represents Objects From A Moving Grid Adjustment Using A Designed Grid
1.1
Objects can be created by calls of the form new("movG", ...)
or
by a call to function movingGrid
.
movingMeanMap
:Object of class "matrix"
for the
moving mean of the cell in the ith row and jth column.
row
:Object of class "integer"
for the row subscripts.
col
:Object of class "integer"
for the column subscripts.
observedPhe
:Object of class "numeric"
for the
observed phenotypic values.
adjustedPhe
:Object of class "numeric"
for the
adjusted phenotypic values.
movingMean
:Object of class "numeric"
for the
moving means.
nValues
:Object of class "integer"
for the
number of non-NA values used for calculating the moving mean.
adjModel
:Object of class "lm"
for the
model used for covariate adjustment.
correlation
:Object of class "numeric"
for the
coefficient of correlation between the moving means and the
observed phenotypic values.
maxValues
:Object of class "integer"
for the
maximum number of values possible given the design of the grid or
the number of nearest neighbors.
FunCall
:Object of class "call"
for the
function call.
signature(object = "movG")
: extract all
relevant information on each entry from the object
signature(object = "movG")
: extract only
the moving means from the object
signature(object = "movG")
: extract only the
adjusted phenotypical values
signature(object = "movG")
: extract the
residuals from the model for calculation of the regression coefficient
signature(object = "movG")
: show some
summary statistics and informations
signature(object = "movG")
: same as show, but
with a list of the summarized values invisibly returned
The data in the slots observedPhe
, adjustedPhe
,
movingMean
, and nValues
must correspond.
Frank Technow
showClass("movG")
showClass("movG")
The function uses the phenotypic information from plants or plots (entries) in a designed grid to obtain an adjusted (for environmental variation) phenotypic value of the entry in the center of the grid. The adjustment is done by calculating the mean of all the entries included and using it as a covariate.
movingGrid(rows, columns, obsPhe, shapeCross, layers, excludeCenter = TRUE)
movingGrid(rows, columns, obsPhe, shapeCross, layers, excludeCenter = TRUE)
rows |
An integer vector with the row subscripts of the phenotypic values to be adjusted. |
columns |
An integer vector with the column subscripts of the phenotypic values to be adjusted. |
obsPhe |
A numeric vector with the observed phenotypic values of the entries
that are to be adjusted. The arguments to |
shapeCross |
Elements can be NULL (no extension in this direction) and must contain no '0', duplicated or negative values.
|
layers |
|
excludeCenter |
Should the center entry (the one which is adjusted) be excluded from the
calculation of the moving mean, logical |
Please see the included vignette for a more detailed description of the rational underlining the adjustment procedure and usage of the function.
The function movingGrid
calls the functions extendHorVer
and extendCircular
to form the grid (i.e. determine the row and
column subscripts of the cells included). These two functions are not
intended to be called by the user.
An object of class "movG
". See movG-class
for details.
1.1
The field layout is always assumed to be a rectangular matrix with
max(rows) * max(columns)
cells! All of the cells that were
not mentioned in arguments rows
and columns
are NA.
If, for example, the last row was only planted with half the number of
entries as the other rows, the other half of the row will consist of
cells with NA
values.
These NA
values are ignored by movingGrid
and the
various extractor functions. They do not influence the results of
movingGrid
.
The general linear model, that is part of the adjustment procedure, is
fit via the function lm
.
Frank Technow
sketchGrid
, entryData
,
movG
, mvngGrAd-package
### data creation ### ##################### ### The field plan consists of 50 rows and 50 columns ### (= 2500 cells = 2500 entries) ## row vector rows <- rep(1:50,each=50) ## column vector cols <- rep(1:50,50) ## simulation of growing conditions with a horizontal gradient between ## the rows and some random noise within set.seed(666) growingCond <- rep(1:50,each=50) + rnorm(2500) ## simulation of the genotypic effects gEffects <- rnorm(2500,mean=0,sd=5) ## observed phenotypic values yield <- growingCond + gEffects ## adjustment with movingGrid cross <- list(c(1), c(1), c(1:4), c(1:4)) exampleResults <- movingGrid(rows = rows, columns = cols, obsPhe = yield, shapeCross = cross, layers = c(1,2), excludeCenter = TRUE) ## a summary summary(exampleResults) ## the adjusted phenotypic values of the first 25 entries fitted(exampleResults)[1:25] ## all information on entry, for the first 25 entryData(exampleResults)[1:25,] ## moving means for the first 25 movingMean(exampleResults)[1:25]
### data creation ### ##################### ### The field plan consists of 50 rows and 50 columns ### (= 2500 cells = 2500 entries) ## row vector rows <- rep(1:50,each=50) ## column vector cols <- rep(1:50,50) ## simulation of growing conditions with a horizontal gradient between ## the rows and some random noise within set.seed(666) growingCond <- rep(1:50,each=50) + rnorm(2500) ## simulation of the genotypic effects gEffects <- rnorm(2500,mean=0,sd=5) ## observed phenotypic values yield <- growingCond + gEffects ## adjustment with movingGrid cross <- list(c(1), c(1), c(1:4), c(1:4)) exampleResults <- movingGrid(rows = rows, columns = cols, obsPhe = yield, shapeCross = cross, layers = c(1,2), excludeCenter = TRUE) ## a summary summary(exampleResults) ## the adjusted phenotypic values of the first 25 entries fitted(exampleResults)[1:25] ## all information on entry, for the first 25 entryData(exampleResults)[1:25,] ## moving means for the first 25 movingMean(exampleResults)[1:25]
Generic function to extract the moving means, which are used as covariates, from the object.
movingMean(object,...)
movingMean(object,...)
object |
an object from the context of moving grid adjustment |
... |
possible other arguments to methods |
returned is a vector with the moving means
1.1
Frank Technow
movingGrid
(includes example of movingMean
)
Methods for function movingMean
returns a vector with the moving means
Methods for function residuals
in Package ‘stats’
default method, the S3 generic
Residuals from the model to calculate the regression coefficient for adjustment by the covariate
Methods for function show
in Package ‘methods’
Some summary statistics and informations are calculated from the object and printed.
The function aids with grid design by plotting the designed grid.
sketchGrid(i, j, rowLimit, colLimit, layers, shapeCross, excludeCenter,...)
sketchGrid(i, j, rowLimit, colLimit, layers, shapeCross, excludeCenter,...)
i |
|
j |
integer value, giving the column of the center cell |
rowLimit |
|
colLimit |
|
layers |
|
shapeCross |
Elements can be NULL (no extension in this direction) and must contain no '0', duplicated or negative values.
|
excludeCenter |
Should the center entry (the one which is adjusted) be included in the
calculation of the moving mean, logical |
... |
further arguments passed to or from other methods |
When using the function movingGrid
, this function can be used
to look at different designs, to see how many and which cells are
included when the center cell is close to the edge of the field
layout, and for verifying that the actual
arguments to shapeCross
and layers
really specify the
intended design.
sketchGrid
is a generic function with currently one method for
sketching a designed grid (as needed for function
movingGrid
). The method is dispatched when the arguments
shapeCross
and layers
are given (with class
"ANY"
).
A plot is created (via a call to function plot
from the
traditional R graphics system).
1.1
Frank Technow
## with method for designed grid sketchGrid(25, 25, shapeCross = list(c(1:4,7), c(1:4,7), c(1:4,7), c(1:4,7)), layers = c(1,2,3,5,6), excludeCenter = TRUE, rowLimit = 50, colLimit = 50)
## with method for designed grid sketchGrid(25, 25, shapeCross = list(c(1:4,7), c(1:4,7), c(1:4,7), c(1:4,7)), layers = c(1,2,3,5,6), excludeCenter = TRUE, rowLimit = 50, colLimit = 50)
Methods for function sketchGrid
in Package "mvngGrAd"
i = "ANY", j = "ANY", rowLimit = "ANY",colLimit = "ANY",
layers = "ANY", shapeCross = "ANY",
excludeCenter = "ANY"
Method to sketch designed grid, for example for usage with function
movingGrid
.
Methods for function summary
in Package "base"
default method, the S3 generic
Identical to method for function show
,
except that a list with the summarized values is invisibly returned.
An additional argument (showSummary
with default value TRUE
) is added. If
set to FALSE, the summary is not printed, only the list is invisibly returned.