Problem 1 Marker Effect Model

Attaching package: ‘dplyr’

The following objects are masked from ‘package:stats’:

filter, lag

The following objects are masked from ‘package:base’:

intersect, setdiff, setequal, union

We are given the dataset that is shown in the table below. This dataset contains gentyping results of 10 for 2 SNP loci.

Animal SNP A SNP B Observation
1 0 0 156
2 1 0 168
3 0 1 161
4 1 0 164
5 -1 0 128
6 -1 1 124
7 0 -1 143
8 1 1 178
9 1 0 163
10 0 0 151

Your Task

  • The goal of this problem is to estimate SNP marker effects using a marker effect model. Because we have just 2 SNP loci, you can use a fixed effects linear model with the 2 loci as fixed effects. Furthermore you can also include a fixed intercept into the model.
  • Specify all the model components including the vector of observations, the design matrix \(X\), the vector of unknowns and the vector of residuals.
  • You can use the R-function lm() to get the solutions for estimates of the unknown SNP effects.

Solution

Problem 2 Breeding Value Model

Use the same data as in Problem 1 to estimate genomic breeding values using a breeding value model.

Hints

  • The only fixed effect in this model is the mean \(\mu\) which is the same for all observations.
  • You can use the following matrix as the genomic relationship matrix

\[G = \begin{bmatrix} 0.141 & -0.124 & -0.123 & -0.124 & 0.288 & 0.083 & 0.287 & -0.329 & -0.124 & 0.082 \\-0.124 & 0.76 & -0.33 & 0.701 & -0.949 & -1.155 & 0.082 & 0.495 & 0.701 & -0.124 \\-0.123 & -0.33 & 0.757 & -0.33 & 0.085 & 0.905 & -0.943 & 0.491 & -0.33 & -0.123 \\-0.124 & 0.701 & -0.33 & 0.76 & -0.949 & -1.155 & 0.082 & 0.495 & 0.701 & -0.124 \\0.288 & -0.949 & 0.085 & -0.949 & 1.584 & 1.322 & 0.492 & -1.152 & -0.949 & 0.288 \\0.083 & -1.155 & 0.905 & -1.155 & 1.322 & 2.202 & -0.738 & -0.333 & -1.155 & 0.083 \\0.287 & 0.082 & -0.943 & 0.082 & 0.492 & -0.738 & 1.576 & -1.148 & 0.082 & 0.287 \\-0.329 & 0.495 & 0.491 & 0.495 & -1.152 & -0.333 & -1.148 & 1.374 & 0.495 & -0.329 \\-0.124 & 0.701 & -0.33 & 0.701 & -0.949 & -1.155 & 0.082 & 0.495 & 0.76 & -0.124 \\0.082 & -0.124 & -0.123 & -0.124 & 0.288 & 0.083 & 0.287 & -0.329 & -0.124 & 0.141\end{bmatrix}\]

Your Tasks

  • Specify all model components of the linear mixed model, including the expected values and the variance-covariance matrix of the random effects.

Solution

LS0tCnRpdGxlOiBMaXZlc3RvY2sgQnJlZWRpbmcgYW5kIEdlbm9taWNzIC0gRXhlcmNpc2UgMTIKYXV0aG9yOiAiUGV0ZXIgdm9uIFJvaHIiCmRhdGU6ICIyMDIxLTEyLTEwIgpvdXRwdXQ6IGh0bWxfbm90ZWJvb2sKLS0tCgpgYGB7ciBzZXR1cCwgaW5jbHVkZT1GQUxTRX0Ka25pdHI6Om9wdHNfY2h1bmskc2V0KGVjaG8gPSBGQUxTRSwgcmVzdWx0cyA9ICdhc2lzJywgZmlnLnBvcyA9ICdIJykKa25pdHI6OmtuaXRfaG9va3Mkc2V0KGhvb2tfY29udmVydF9vZGcgPSBybWRoZWxwOjpob29rX2NvbnZlcnRfb2RnKQpgYGAKCmBgYHtyIFRhc2tDb3VudHMsIGVjaG89RkFMU0V9CmNudCA8LSBybWRoZWxwOjpSNkNsYXNzQ291bnQkbmV3KCkKY250JHNldF9wcmVmaXgocHNfcHJlZml4ID0gIiMjIFByb2JsZW0iKQpgYGAKCgpgYGB7ciwgZWNobz1GQUxTRSwgcmVzdWx0cz0nYXNpcyd9CmNhdChjbnQkb3V0KHBzX3N1ZmZpeCA9ICJNYXJrZXIgRWZmZWN0IE1vZGVsIiksICJcbiIpCmBgYAoKYGBge3IgZGF0YWZsZW1zbnBvYnMsIGVjaG89RkFMU0UsIG1lc3NhZ2U9RkFMU0V9CmxpYnJhcnkoZHBseXIpCiMjIyAjIGZpeCB0aGUgbnVtYmVyIG9mIGFuaW1hbHMKbl9ucl9hbmltYWwgPC0gMTAKIyMjICMgaW50ZXJjZXB0Cm5faW50ZXJfY2VwdCA8LSAxNTAKIyMjICMgcmVzaWR1YWwgc3RhbmRhcmQgZGV2aWF0aW9uCm5fcmVzX3NkIDwtIDkuMwojIyMgIyB2ZWN0b3Igb2YgZ2Vub3R5cGUgdmFsdWUgY29lZmZpY2llbnRzCnZlY19nZW5vX3ZhbHVlX2NvZWZmIDwtIGMoLTEsMCwxKQojIyMgIyBzYW1wbGUgZ2Vub3R5cGVzIG9mIHVubGlua2VkIFNOUCByYW5kb21seQpzZXQuc2VlZCg1NDMyKQojIyMgIyBmaXggYWxsZWxlIGZyZXF1ZW5jeSBvZiBwb3NpdGl2ZSBhbGxlbGUKbl9wcm9iX3NucHMgPC0gLjQ1CiMjIyAjIGdlbm90eXBpYyB2YWx1ZXMgCnZlY19nZW5vX3ZhbCA8LSBjKDE3LjksIDMuMykKbl9ucl9zbnAgPC0gbGVuZ3RoKHZlY19nZW5vX3ZhbCkKIyMjICMgcHV0IHRvZ2V0aGVyIHRoZSBnZW5vdHlwZXMgaW50byBhIG1hdHJpeAptYXRfZ2Vub19zbnAgPC0gbWF0cml4KGMoc2FtcGxlKHZlY19nZW5vX3ZhbHVlX2NvZWZmLCBuX25yX2FuaW1hbCwgcHJvYiA9IGMoKDEtbl9wcm9iX3NucHMpXjIsIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMiooMS1uX3Byb2Jfc25wcykqbl9wcm9iX3NucHMsIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbl9wcm9iX3NucHNeMiksIAogICAgICAgICAgICAgICAgICAgICAgIHJlcGxhY2UgPSBUUlVFKSwKICAgICAgICAgICAgICAgICAgICAgICBzYW1wbGUodmVjX2dlbm9fdmFsdWVfY29lZmYsIG5fbnJfYW5pbWFsLCBwcm9iID0gYyhuX3Byb2Jfc25wc14yLCAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg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