lsd: Calculate the LSD using a fitted model object

Description Usage Arguments Examples

View source: R/lsd.R

Description

Calculate the least-significant difference among the means of genotypes from a fitted model object.

Usage

1
2
3
4
5
6
7
8
9
lsd(object, ...)

## S3 method for class 'lm'
lsd(object, geno.term, env.term = NULL, ge.term = NULL,
  alpha = 0.05)

## S3 method for class 'lmerMod'
lsd(object, geno.term, env.term = NULL,
  ge.term = NULL, alpha = 0.05)

Arguments

object

A model object of class lm, aov, glm, or lmer.

geno.term

A character vector giving the model term for genotypes.

env.term

A character vector giving the model term for environments. If NULL (default), heritability is calculated within one environment. Note that env.term = NULL will ignore multiple environments, if present.

ge.term

A character vector giving the model term for genotype-by-environment interaction.

alpha

The significance level at which to calculate the LSD.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# Use the gauch.soy dataset
data("gauch.soy")

# Filter
gauch_soy1 <- gauch.soy %>%
  group_by(env) %>%
  filter(n_distinct(gen, rep) == 28)

# Fit a linear model using lm
mod <- lm(yield ~ gen + env + gen:env, data = gauch_soy1)
# Calculate heritability
lsd(object = mod, geno.term = "gen", env.term = "env", ge.term = "gen:env", alpha = 0.05)

# Fit a mixed-effects model with lmer
mod1 <- lmer(yield ~ (1|gen) + env + (1|gen:env), data = gauch_soy1)
# Calculate heritability
lsd(object = mod1, geno.term = "gen", env.term = "env", ge.term = "gen:env")

neyhartj/pbr documentation built on Jan. 7, 2020, 9:24 a.m.