Type: | Package |
Title: | Moving Grid Adjustment in Plant Breeding Field Trials |
Version: | 0.1.6 |
Date: | 2023-10-09 |
Depends: | methods, stats |
Author: | Frank Technow |
Maintainer: | Frank Technow <mvnggrad@fastmail.com> |
Description: | Package for moving grid adjustment in plant breeding field trials. |
License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
LazyLoad: | TRUE |
Collate: | movG-class.R circularExtension.R entryData.R entryDataMethods.R extendHorVer.R fittedMethods.R movingGrid.R movingMean.R residualsMethods.R showMethods.R sketchGrid.R sketchGridMethods.R summaryMethods.R movingMeanMethods.R |
NeedsCompilation: | no |
Packaged: | 2023-10-09 20:37:16 UTC; frank |
Repository: | CRAN |
Date/Publication: | 2023-10-09 22:40:06 UTC |
R Package mvngGrAd: Moving Grid Adjustment In Plant Breeding Field Trials
Description
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.
Details
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
.
Rdversion
1.1
Author(s)
Frank Technow
Maintainer: Frank Technow mvnggrad@fastmail.com
Circular extension of the grid
Description
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.
Usage
circularExtension(i, j, layers, rowLimit, colLimit)
Arguments
i |
|
j |
|
layers |
|
rowLimit |
|
colLimit |
|
Details
This function is called by the function movingGrid
and is not
intended to be called by the user.
Value
A matrix with the row subscripts of the cells in column one and the column subscripts in column two.
Rdversion
1.1
Author(s)
Frank Technow
Examples
circularExtension(i = 1,
j = 10,
rowLimit = 50,
colLimit = 50,
layers = c(1,2,3))
Function to extract entry information
Description
Generic function to extract the most relevant information from the adjustment procedure for each entry included in the trial.
Usage
entryData(object,...)
Arguments
object |
an object from the context of moving grid adjustment |
... |
possible other arguments to methods |
Value
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
Rdversion
1.1
Author(s)
Frank Technow
See Also
movingGrid
(includes example of entryData
)
Methods for Function entryData
Description
Methods for function entryData
Methods
- object = "movG"
returned is a
data.frame
with: row, column, adj. phenotypic value, obs. phenotypic value, moving mean, number of values
Vertical and horizontal extension of the grid ('cross shape')
Description
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.
Usage
extendHorVer(i, j, shapeCross, rowLimit, colLimit)
Arguments
i |
|
j |
|
shapeCross |
Elements can be NULL (no extension in this direction) and must contain no '0', duplicated or negative values.
|
rowLimit |
|
colLimit |
|
Details
This function is called by the function movingGrid
and is not
intended to be called by the user.
Value
A matrix with the row subscripts of the cells in column one and the column subscripts in column two.
Rdversion
1.1
Author(s)
Frank Technow
Examples
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"
Description
Methods for function fitted
in Package "stats"
Methods
- object = "ANY"
default method, the S3 generic
- object = "movG"
Returns a vector with the adjusted values.
Class "movG"
Description
The "movG" Class Represents Objects From A Moving Grid Adjustment Using A Designed Grid
Rdversion
1.1
Objects from the Class
Objects can be created by calls of the form new("movG", ...)
or
by a call to function movingGrid
.
Slots
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.
Methods
- entryData
signature(object = "movG")
: extract all relevant information on each entry from the object- movingMean
signature(object = "movG")
: extract only the moving means from the object- fitted
signature(object = "movG")
: extract only the adjusted phenotypical values- residuals
signature(object = "movG")
: extract the residuals from the model for calculation of the regression coefficient- show
signature(object = "movG")
: show some summary statistics and informations- summary
signature(object = "movG")
: same as show, but with a list of the summarized values invisibly returned
Note
The data in the slots observedPhe
, adjustedPhe
,
movingMean
, and nValues
must correspond.
Author(s)
Frank Technow
See Also
Examples
showClass("movG")
Moving Grid Adjustment In Plant Breeding Field Trials
Description
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.
Usage
movingGrid(rows, columns, obsPhe, shapeCross, layers, excludeCenter = TRUE)
Arguments
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 |
Details
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.
Value
An object of class "movG
". See movG-class
for details.
Rdversion
1.1
Note
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
.
Author(s)
Frank Technow
See Also
sketchGrid
, entryData
,
movG
, mvngGrAd-package
Examples
### 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]
Function to extract the moving means from the object
Description
Generic function to extract the moving means, which are used as covariates, from the object.
Usage
movingMean(object,...)
Arguments
object |
an object from the context of moving grid adjustment |
... |
possible other arguments to methods |
Value
returned is a vector with the moving means
Rdversion
1.1
Author(s)
Frank Technow
See Also
movingGrid
(includes example of movingMean
)
Methods for Function movingMean
Description
Methods for function movingMean
Methods
- object = "movG"
returns a vector with the moving means
Methods for Function residuals in Package ‘stats’
Description
Methods for function residuals
in Package ‘stats’
Methods
- object = "ANY"
default method, the S3 generic
- object = "movG"
Residuals from the model to calculate the regression coefficient for adjustment by the covariate
Methods for Function show in Package ‘methods’
Description
Methods for function show
in Package ‘methods’
Methods
- object = "movG"
Some summary statistics and informations are calculated from the object and printed.
Function to aid with grid design
Description
The function aids with grid design by plotting the designed grid.
Usage
sketchGrid(i, j, rowLimit, colLimit, layers, shapeCross, excludeCenter,...)
Arguments
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 |
Details
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"
).
Value
A plot is created (via a call to function plot
from the
traditional R graphics system).
Rdversion
1.1
Author(s)
Frank Technow
See Also
Examples
## 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"
Description
Methods for function sketchGrid
in Package "mvngGrAd"
Methods
- objects:
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"
Description
Methods for function summary
in Package "base"
Methods
- object = "ANY"
default method, the S3 generic
- object = "movG"
Identical to method for function
show
, except that a list with the summarized values is invisibly returned. An additional argument (showSummary
with default valueTRUE
) is added. If set to FALSE, the summary is not printed, only the list is invisibly returned.