From c1ee67ff2c8b930046a26d35e5cfd2ffbb302247 Mon Sep 17 00:00:00 2001 From: Robert Ricci Date: Tue, 24 Feb 2015 11:12:53 -0700 Subject: [PATCH] Copy in working notes --- lectures/lecture12/notes.txt | 75 ++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 lectures/lecture12/notes.txt diff --git a/lectures/lecture12/notes.txt b/lectures/lecture12/notes.txt new file mode 100644 index 0000000..1b712de --- /dev/null +++ b/lectures/lecture12/notes.txt @@ -0,0 +1,75 @@ +Execution time: + Normally distributed - mean 5 seconds, sttdev 1 second +> dnorm: density, pnorm: distribution, qnorm: quantile + All: x, mean=, sd= + dnorm(5,mean=5,sd=1) + x <- seq(0, 10, by=.1) + plot(x,dnorm(x, mean=5, sd=1)) + plot(x,pnorm(x, mean=5, sd=1)) + + XXX draw area under curve + XXX plot lines default? + + Part A: probability of being more than 8s + pnorm(8, mean = 5, sd = 1) tells you prob of being 8 or less, so 1 - + Don't forget, probabilty, not percent + + Part B: probability of being less than 6s + pnorm(6, mean = 5, sd = 1) + + Part C: prob of being between 4 and 7 + pnorm(7, mean = 5, sd = 1) - pnorm(4, mean = 5, sd = 1) + + Part D: 95th percentile execution time + Inverting the PDF + qnorm(0.95, mean = 5, sd = 1) + > x = seq(0,1,by = 0.01) + > plot(x,qnorm(x,5,1)) + + +Question 5: + D <- c(9, 11, 13, 14, 15, 15, 16, 19, 21, 23, 23, 23, 23, 24, 24, 25, 28, 28, 29, 31, 33, 33, 34, 34, 34, 35, 35, 36, 36, 38, 39, 42, 45) + +A 10th and 90th percentiles + D[as.integer(length(D)*.10)] + D[as.integer(length(D)*.90)] + + quantile(D,.90) + +B mean + mean(D) + +C 90% ci + mean(D) - (qnorm(.95)*sd(D))/sqrt(10) + +D What fraction less than 25, and what is 90% CI for the fraction + XXX + +E One-sided confidence interval 90% + +Question 6: + c = concatenate + > A <- c(140, 120, 176, 288, 992, 144, 2736, 2796, 752, 17720, 96) + > B <- c(98, 120, 141, 317, 893, 86, 1642, 1678, 376, 8860, 67) + > D <- A - B + > mean(A) + > mean(B) + > mean(D) + + X +- z*s / sqrt(n) + + z_1-2/alpha + + XXX / 2 + XXX paired + XXX nonpaired + + > plot(x,mean(D) - (qnorm(x)*sd(D))/sqrt(10), type='l', + > ylim=c(-1000,3000)) + > lines(x,mean(D) + (qnorm(x)*sd(D))/sqrt(10)) + + mean(D) - (qnorm(0.9)*sd(D))/sqrt(10) + mean(D) + (qnorm(0.9)*sd(D))/sqrt(10) + (really 80%) + + XXX diff -- GitLab