knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
library(Lab1Intro)

Links

Here is a link to the Github repository containing this package, Lab1Intro. You can find documentation for making packages in R here: http://r-pkgs.had.co.nz/.

$\LaTeX$ formulae

Sample mean: $$\bar{x}{k} = \frac{1}{n}\sum{j=1}^{n}x_{jk}\qquad k = 1,2,...,p\qquad(1-1)$$ Sample covariance: $$s_{ik} = \frac{1}{n}\sum_{j=1}^{n}(x_{ji}-\bar{x}{i})(x{jk} - \bar{x}_{k})\qquad i=1,2,...,p\quad k=1,2,...,p\qquad (1-4)$$

Sample correlation coefficients: $$r_{ik} = \frac{s_{ik}}{\sqrt{s_{ii}}\sqrt{s_{kk}}}=\frac{\sum_{j=1}^{n}(x_{ji}-\bar{x}{i})(x{jk} - \bar{x}{k})}{\sqrt{\sum^{n}{j=1}(x_{ji}-\bar{x}{i})^2}\sqrt{\sum^{n}{j=1}(x_{jk}-\bar{x}{k})^2}}\qquad(1-5)$$ Sample covariance matrix: $$\textbf{S}=\frac{1}{1-n}\textbf{X}'\Big(\textbf{I}-\frac{1}{n}\textbf{11}'\Big)\textbf{X}\qquad (3-27)$$ Sample standard deviation matrix: $$\textbf{D}{(p\times p)}^{1/2} = \begin{bmatrix} \sqrt{s_{11}} & 0 & \cdots & 0\ 0 & \sqrt{s_{22}} & \cdots & 0\ \vdots & \vdots & \ddots & \vdots\ 0 & 0 & \cdots & \sqrt{s_{pp}} \end{bmatrix}\qquad (3-28)$$ Sample correlation matrix: $$\textbf{R}=\textbf{D}^{-1/2}\textbf{SD}^{-1/2}\qquad (3-29)$$

Paper mill data

Here is an analysis of the data from Table 1-2 from a paper mill using the functions created for this lab:

data = read.table("T1-2.DAT");

sampmean(data)
sampcov(data, c("Density", "Strength(MD)", "Strength(CD)"))
sampcor(data, c("Density", "Strength(MD)", "Strength(CD)"))

Assessment

The assessment for this course differs between 4793 and 5793. The assessment for 4793 is as follows:

For 5793:

The only difference between the two is that there is an additional project for 5793, with more weight placed on the third project than the other two.



coxjohn/Lab1Intro documentation built on Jan. 26, 2020, 4:10 a.m.