/
Table.Rmd
77 lines (60 loc) · 1.69 KB
/
Table.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
---
title: Standard Normal LookUp
params:
z: 1.23
jupyter:
kernelspec:
display_name: R
language: R
name: ir
---
Here is te table...
```{r params, echo=FALSE}
# in this code block we just set x,mu,sigma so we can use them below.
z<-params$z;
```
```{r tablesetup, echo = FALSE}
library(knitr)
colTitles <- c(" .00"," .01"," .02"," .03"," .04"," .05"," .06"," .07"," .08"," .09")
zStartOfLastRow <- 3.4
numRows <- zStartOfLastRow*10+1
# Pos z-table rows go like this: 0.0, 0.1,... , 2.9, 3.0
# Matrix of positive z-values
posZValues <- matrix(nrow=numRows, ncol=10)
for(i in 1:numRows) {
for(j in 1:10) {
posZValues[i, j] = (i-1)*.1 + (j-1)*(.01)
}
}
# left tail areas like '0.9324'
posZAreas <- format(round(pnorm(posZValues),4),nsmall=4)
# Has format '0.3742', so this lops off the '0' at start.
posZAreas <- substring(posZAreas, 2)
# eg this is .1, .2, .3, ..., 3.0
posRowNames <- seq(.1, zStartOfLastRow, by=.1)
rownames(posZAreas) <- c("0.0",posRowNames)
colnames(posZAreas) <- colTitles
# Neg z-table rows go like this: -3.0,-2.9,... ,-0.1, 0.0
# Matrix of negative z-values
negZValues <- matrix(nrow=numRows, ncol=10)
for(i in 1:numRows) {
for(j in 1:10) {
negZValues[i, j] = (numRows-i)*(-.1) - (j-1)*(.01)
}
}
negZAreas <- format(round(pnorm(negZValues),4),nsmall=4)
negZAreas <- substring(negZAreas, 2)
# eg this is -3.0, -2.9, ... , -.1
negRowNames <- seq(-zStartOfLastRow,-.1,by=.1)
rownames(negZAreas) <- c(negRowNames, "0.0")
colnames(negZAreas) <- colTitles
```
## Standard Normal Table
First find the negative z-values:
```{r negtable, echo = FALSE}
kable(negZAreas)
```
This is second half of the table:
```{r postable, echo = FALSE}
kable(posZAreas)
```