Skip to contents

Genetic Gain Parameters

Usage

parameters_gg(model, trait = "trait")

Arguments

model

Linear regression model (lm object)

trait

A character string indicating the column in data that contains trials.

Value

A data.frame with some parameters from the linear regression (Slope, se_Slope, Intercept, r2, Pr(>F)) and the percentage of Genetic Gain.

Examples

# \donttest{
library(ggplot2)
library(agridat)
library(magrittr)
library(agriutilities)

data(baker.barley.uniformity)
dat <- baker.barley.uniformity
head(dat)
#>   row col year yield
#> 1   1   1 1924  2960
#> 2   1   2 1924  3060
#> 3   1   3 1924  3280
#> 4   1   4 1924  2570
#> 5   1   5 1924  2000
#> 6   1   6 1924  1800

model <- lm(yield ~ year, dat)

dat %>%
  na.omit() %>%
  ggplot(
    aes(x = year, y = yield)
  ) +
  geom_point() +
  geom_smooth(method = "lm") +
  theme_bw()
#> `geom_smooth()` using formula = 'y ~ x'


parameters_gg(model = model, trait = "yield")
#>            trait first_year last_year     Slope se_Slope Intercept        r2
#> Regression yield       1924      1935 -109.7417  7.97398  214307.5 0.2507339
#>                  Pr(>F) Genetic_Gain%
#> Regression 2.215553e-37     -3.468011
# }