fb_spatial_adj: Spatial adjustment of observations

Description Usage Arguments Details Value Examples

View source: R/fb_spatial_adj.R

Description

Uses a moving grid to adjust the phenotypic observations recorded in a Field Book table. This function wraps around functions provided in the mvngGrAd package.

Usage

1
2
fb_spatial_adj(fbt, traits, checks, grid.size = NULL,
  max.grid.size = NULL, use.rel.eff = TRUE)

Arguments

fbt

A Field Book Table object.

traits

Traits to be adjusted. Defaults to all numeric traits.

checks

A character of field.book.table entry names designated as checks.

grid.size

A nested list of grid dimensions that define the moving average grid. If grid.size is NULL, the grid size is optimized. See Details for more information.

max.grid.size

A nested list, similar to grid.size, but instead defining the maximum grid dimensions to use when optimizing the grid size. Here the components grid.rows, grid.cols, and grid.layers are integers defining the maximum rows, columns, and diagonal layers to use, respectively. Use this option if the field dimensions are large. This argument is ignored if grid.size is passed.

use.rel.eff

If TRUE, the relative efficiency is used to determine whether the adjusted data for a trait replaces the raw data in the fbt object. If FALSE, the adjusted data replaces the raw data.

Details

This function uses the moving average procedure implemented in mvngGrAd to spatially adjust the raw phenotypic observations from a grid. Briefly, the function uses the mean of observations surrounding a particularly plot in a field as a covariate to calculate the adjusted phenotypic value.

One can define the dimensions of the grid by passing a list to the grid.size argument. The first layer of the list must be the same length as the number of traits, and the names of this layer must be the trait names. The second layer of the list must have the components grid.rows, grid.cols, and grid.layers. grid.rows and grid.cols define the number of field rows and columns covered by the grid, respectively, while grid.layers defines the number of diagonal plots.

Alternatively, one can optimize the grid size for each trait. Grid optimization iterates over all possible grid dimensions and identifies the grid size that maximizes the correlation between the adjusted phenotypic values and the mean of the phenotypic values within that grid.

Finally, the adjusted phenotypic values can be kept or ignored depending on whether the within-environment variance (i.e. V_R) is reduced after adjustment. This function uses the individuals specified in checks to calculate this variance. Generally, traits that are less heritable tend to benefit from spatial adjustment.

Value

A list with two elements:

fbt

An fbt object with adjusted phenotypic values replacing the original values, if applicable.

summary

A list with 2 elements: the first returns the grid size used for each trait. The second returns summary statistics of the adjustment procedure, including the within-environment variance, relative efficiency, and whether the adjusted values were returned in place of the original values.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
data("fbt_sample")

# Specify a grid size
grid.size <- list(SpatialGradient = list(grid.rows = 5, grid.cols = 5, grid.layers = 5))

adj_out <- fb_spatial_adj(fbt = fbt_sample, traits = "SpatialGradient", 
                          checks = c("Kharkof", "TAM 107", "Scout 66"), 
                          grid.size = grid.size)                         
                          
## Not run: 

# Run spatial adjustment without conditions
adj_out <- fb_spatial_adj(fbt = fbt_sample, traits = "SpatialGradient", 
                          checks = c("Kharkof", "TAM 107", "Scout 66"))
                          
# Observe the output

                          
# Restrict the grid size
max.grid.size <- list(SpatialGradient = list(grid.rows = 5, grid.cols = 5, grid.layers = 5))

# Re-run spatial adjustment
adj_out <- fb_spatial_adj(fbt = fbt_sample, traits = "SpatialGradient", 
                          checks = c("Kharkof", "TAM 107", "Scout 66"), 
                          max.grid.size = max.grid.size)
   

## End(Not run)                       

neyhartj/fbutils documentation built on Feb. 10, 2020, 1:45 p.m.