##### script for slidedeck cB ##### ##### Slide deck for CLT ##### ### Preamble # Colors ito1 = "#FAFAFF" ## background ito2 = "#00AAE4" ## selected # Data dt = read.csv("http://rfs.kvasaheim.com/data/crime.csv") attach(dt) ##### ### Sample Means ## Ex2: Heights pnorm(65, m=69, s=sqrt(4.5)) ## Ex3: More Heights pnorm(65, m=69,s=sqrt(0.9)) ## Ex4: Crime qnorm(c(0.025,0.975), m=441.55, s=241.45/sqrt(51)) # Bootstrapping mn = numeric() # Initialize mn for (i in 1:1e4) { x = sample(vcrime00, replace=TRUE) # Random sample, with replacement mn[i] = mean(x) # Sample mean } quantile(mn, c(0.025,0.975) ) # Est. Conf Int ##### ### Sample Proportions ## Ex1: Poverty 1 - pnorm(0.20, m=0.18, s=sqrt(0.01476)) ## Ex2: More Poverty 1 - pnorm(0.20, m=0.18, s=sqrt(0.001476)) ## Ex 3: Much more poverty 1 - pnorm(0.20, m=0.18, s=sqrt(0.0001476)) ## Ex 4: Much, much more poverty 1 - pnorm(0.20, m=0.18, s=sqrt(0.00001476)) ##### End of File