Data Set

Reading data into a tibble

s_data_file <- "https://charlotte-ngs.github.io/gelasmss2021/data/ex03p01_data.csv"
tbl_geno_data <- readr::read_csv(file = s_data_file)

── Column specification ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
cols(
  Animal = col_double(),
  `SNP G` = col_double(),
  `SNP H` = col_double(),
  Observation = col_double()
)
tbl_geno_data

Modification of original Dataset

Because we want to demonstrate the effect of having \(p>>N\) and some of the SNP loci are not important for the phenotypic observations

n_nr_obs <- 5
tbl_first_problem <- tbl_geno_data[1:n_nr_obs,]
n_nr_loci_add <- 10
vec_genotypes <- c(-1,0,1)
for (idx in 1:n_nr_loci_add){
  vec_cur_geno <- sample(vec_genotypes, size = n_nr_obs, replace = TRUE)
  tbl_first_problem <- bind_cols(tbl_first_problem, tibble::tibble(cur_geno = vec_cur_geno))
  names(tbl_first_problem)[ncol(tbl_first_problem)] <- paste0('SNP_', idx)
}
tbl_first_problem

Mixed Linear Effect Models

There are two types of MLEM

  1. Marker Effect Models (MEM)
  2. Breeding-Value Models (BVM)

MEM

The MEM corresponds to

\[y = X\beta + Wq + e\]

The unknowns \(\beta\) and \(q\) are estimated based on Mixed Model equations.

## Matrix X

## Matrix W

## vector y

Using the above components, the mixed model equations can be setup

## Mixed model equations

## solutions

BVM

The BVM corresponds to

\[y = X\beta + Zg + e\]

The unknowns \(beta\) and \(g\) are estimated based on Mixed Model equations.

## Matrix X

## Matrix Z

# vector y

Using the above components, the mixed model equations can be setup

## Mixed model equations

## solutions
LS0tCnRpdGxlOiAiR2Vub21pYyBCcmVlZGluZyBWYWx1ZXMgVXNpbmcgTUxFTSIKb3V0cHV0OiBodG1sX25vdGVib29rCi0tLQoKCiMjIERhdGEgU2V0ClJlYWRpbmcgZGF0YSBpbnRvIGEgdGliYmxlCgpgYGB7cn0Kc19kYXRhX2ZpbGUgPC0gImh0dHBzOi8vY2hhcmxvdHRlLW5ncy5naXRodWIuaW8vZ2VsYXNtc3MyMDIxL2R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