Difference between revisions of "Univariate data analysis (2014)"
Jump to navigation
Jump to search
Kevin Dunn (talk | contribs) |
Kevin Dunn (talk | contribs) |
||
Line 75: | Line 75: | ||
Please follow the [[Software_tutorial|software tutorial]] to install and run the course software. You should be able to quickly read, understand and use the material in steps 1 to 13. | Please follow the [[Software_tutorial|software tutorial]] to install and run the course software. You should be able to quickly read, understand and use the material in steps 1 to 13. | ||
== Class example, 15 Jan == | |||
Seeing the Central Limit Theorem in action: ''rolling dice''. | |||
<syntaxhighlight lang="rsplus"> | |||
N = 500 | |||
m <- t(matrix(seq(1,6), 3, 2)) | |||
layout(m) | |||
s1 <- as.integer(runif(N, 1, 7)) | |||
s2 <- as.integer(runif(N, 1, 7)) | |||
s3 <- as.integer(runif(N, 1, 7)) | |||
s4 <- as.integer(runif(N, 1, 7)) | |||
s5 <- as.integer(runif(N, 1, 7)) | |||
s6 <- as.integer(runif(N, 1, 7)) | |||
s7 <- as.integer(runif(N, 1, 7)) | |||
s8 <- as.integer(runif(N, 1, 7)) | |||
s9 <- as.integer(runif(N, 1, 7)) | |||
s10 <- as.integer(runif(N, 1, 7)) | |||
hist(s1, main="", xlab="One throw", breaks=seq(0,6)+0.5) | |||
bins = 8 | |||
hist((s1+s2)/2, breaks=bins, main="", xlab="Average of two throws") | |||
hist((s1+s2+s3+s4)/4, breaks=bins, main="", xlab="Average of 4 throws") | |||
hist((s1+s2+s3+s4+s5+s6)/6, breaks=bins, main="", xlab="Average of 6 throws") | |||
bins=12 | |||
hist((s1+s2+s3+s4+s5+s6+s7+s8)/8, breaks=bins, main="", xlab="Average of 8 throws") | |||
hist((s1+s2+s3+s4+s5+s6+s7+s8+s9+s10)/10, breaks=bins, main="", xlab="Average of 10 throws") | |||
</syntaxhighlight> | |||
<!-- Here was the example used in class: | <!-- Here was the example used in class: |
Revision as of 17:17, 16 January 2014
Class date(s): | 13 to 23 January 2014 | ||||
(PDF) | Course slides | ||||
| |||||
| |||||
Class materials
Date | Class number | Video and audio files | Other materials | Reading (PID) | Slides | |
---|---|---|---|---|---|---|
13 January | 02A | Video (343 M) | Audio (42 M) | R demo file | Chapter 2 | Slides for class |
15 January | 02B | Video (327 M) | Audio (42 M) | None | ||
16 January | 02C | None |
Software source code
Please follow the software tutorial to install and run the course software. You should be able to quickly read, understand and use the material in steps 1 to 13.
Class example, 15 Jan
Seeing the Central Limit Theorem in action: rolling dice.
N = 500
m <- t(matrix(seq(1,6), 3, 2))
layout(m)
s1 <- as.integer(runif(N, 1, 7))
s2 <- as.integer(runif(N, 1, 7))
s3 <- as.integer(runif(N, 1, 7))
s4 <- as.integer(runif(N, 1, 7))
s5 <- as.integer(runif(N, 1, 7))
s6 <- as.integer(runif(N, 1, 7))
s7 <- as.integer(runif(N, 1, 7))
s8 <- as.integer(runif(N, 1, 7))
s9 <- as.integer(runif(N, 1, 7))
s10 <- as.integer(runif(N, 1, 7))
hist(s1, main="", xlab="One throw", breaks=seq(0,6)+0.5)
bins = 8
hist((s1+s2)/2, breaks=bins, main="", xlab="Average of two throws")
hist((s1+s2+s3+s4)/4, breaks=bins, main="", xlab="Average of 4 throws")
hist((s1+s2+s3+s4+s5+s6)/6, breaks=bins, main="", xlab="Average of 6 throws")
bins=12
hist((s1+s2+s3+s4+s5+s6+s7+s8)/8, breaks=bins, main="", xlab="Average of 8 throws")
hist((s1+s2+s3+s4+s5+s6+s7+s8+s9+s10)/10, breaks=bins, main="", xlab="Average of 10 throws")