
Define a continuous covariate (regression) effect in a phenotype model
Source:R/define_effect_fixed_cov.R
define_effect_fixed_cov.RdInserts a row into phenotype_effects representing a polynomial regression term.
At phenotyping time the contribution per individual is
slope * (source_column_value - center)^poly_order. When center is NULL
the mean of source_column is computed and stored automatically.
Usage
define_effect_fixed_cov(
pop,
phenotype_name,
effect_name,
source_column,
slope,
center = NULL,
poly_order = 1L,
source_table = "ind_meta",
overwrite = FALSE
)Arguments
- pop
A
tidybreed_popobject.- phenotype_name
Character. Name of an existing phenotype in
phenotype_meta.- effect_name
Character. Unique label for this effect within the phenotype.
- source_column
Character. Column in
source_tableholding the continuous predictor values.- slope
Numeric scalar. Regression coefficient.
- center
Numeric scalar or
NULL. Value subtracted before raising topoly_order. IfNULL, auto-computed as the column mean.- poly_order
Integer ≥ 1. Polynomial order. Default
1gives the standard linearslope * (x - center)term. Use2for quadratic, etc.- source_table
Character. Database table containing
source_column. Default"ind_meta".- overwrite
Logical. Replace an existing effect with the same name.
Examples
if (FALSE) { # \dontrun{
# Linear regression on age (center auto-computed)
pop <- pop |>
define_effect_fixed_cov("ADG", "age",
source_column = "age_days",
slope = 2.5)
# Quadratic regression on DIM (dairy)
pop <- pop |>
define_effect_fixed_cov("milk_td", "dim_sq",
source_column = "dim",
slope = -0.02,
center = 150,
poly_order = 2L)
} # }