knitr::opts_chunk$set(echo = FALSE, results = 'asis')
Given are the following two vectors $v$ and $w$. Compute
\begin{center} $v = \left[\begin{array}{c} 3 \ -5 \ 1 \ 9 \ \end{array}\right]$, \hspace{2ex} $w = \left[\begin{array}{c} 1 \ 9 \ -12 \ 27 \ \end{array}\right]$ \end{center}
Verify your computations from Problem 1 in R. Start by assigning the vectors $v$ and $w$ with the components given in Problem 1. If you are not sure how to assign vectors in R, please have a look at https://bookdown.org/rdpeng/rprogdatascience/r-nuts-and-bolts.html#creating-vectors and its the corresponding video at https://youtu.be/w8_XdYI3reU
Given are two vectors
\begin{center}
$a = \left[\begin{array}{c}
8 \
0 \
4 \
\end{array}\right]$ and
$b = \left[\begin{array}{c}
2 \
21 \
x \
\end{array}\right]$
\end{center}
How do we have to choose $x$, such that the vectors are perpendicular? Verify your solution with R
# milk yield of Delilah vec_lact_perf_Delilah <- c(5852, 6833, 7984, 7869, 7322, 8216, 8622, 7851)
# milk yield of Rosy vec_lact_perf_Rosy <- c(6249, 7312)
# breeding values of Delilah nLactDelilah <- length(vec_lact_perf_Delilah) l_ebv_Delilah <- list(Milk = -1037, ND = 112) # breeding values of Rosy nLactRosy <- length(vec_lact_perf_Rosy) l_ebv_Rosy <- list(Milk = 471, ND = 122)
Farmer Frank Miller has two cows named Delilah
and Rosy
. Delilah has completed r nLactDelilah
lactations with the following results
knitr::kable(data.frame(Lactation = 1:nLactDelilah, `Milk Yield` = vec_lact_perf_Delilah))
Rosy is a young cow and has completed just r nLactRosy
lactation which is shown below.
knitr::kable(data.frame(Lactation = 1:nLactRosy, `Milk Yield` = vec_lact_perf_Rosy))
a. Compute for both cows the sum and the mean of all lactation results using R. Hint: Have a look at the functions mean()
and sum()
in R.
b. Our farmer wants to know which of the two cows would be a better mother for his breeding herd when looking at the traits milk yield and longevity. The trait longevity is defined as the number of years a cow is able to produce milk. From the breeding association the farmer receives the following predicted breeding values for the two cows. Please explain which of the two cows is the better choice as a mother.
knitr::kable(data.frame(Cows = c("Delilah", "Rosy"), `Milk Yield` = c(l_ebv_Delilah$Milk, l_ebv_Rosy$Milk), Longevity = c(l_ebv_Delilah$ND, l_ebv_Rosy$ND)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.