mean(yrbss$weight[sample.rows], na.rm = TRUE)
#load the dataset
require(OIBioStat)
data("yrbss")
#set parameters
sample.size = 10
set.seed(2401)
#obtain random sample of row numbers
sample.rows = sample(c(1:nrow(yrbss)), sample.size)
#calculate point estimates from sampled rows
mean(yrbss$weight[sample.rows], na.rm = TRUE)
sd(yrbss$weight[sample.rows], na.rm = TRUE)
mean(yrbss$weight[sample.rows], na.rm = TRUE)
sd(yrbss$weight[sample.rows], na.rm = TRUE)
mean(yrbss$weight[sample.rows], na.rm = TRUE)
sd(yrbss$weight[sample.rows], na.rm = TRUE)
qt(0.975, df = 9)
x.bar = mean(yrbss$weight[sample.rows], na.rm = TRUE)
s = sd(yrbss$weight[sample.rows], na.rm = TRUE)
n = 10
m = (s/sqrt(n)) * qt(0.975, df = 9)
x.bar - m
x.bar + m
x.bar = mean(yrbss$weight[sample.rows], na.rm = TRUE)
s = sd(yrbss$weight[sample.rows], na.rm = TRUE)
n = 10
m = (s/sqrt(n)) * qt(0.975, df = 9)
x.bar - m
x.bar + m
sample.size = 10
set.seed(2401)
sample.rows = sample(c(1:nrow(yrbss)), sample.size)
x.bar = mean(yrbss$weight[sample.rows], na.rm = TRUE)
s = sd(yrbss$weight[sample.rows], na.rm = TRUE)
n = 10
m = (s/sqrt(n)) * qt(0.975, df = 9)
x.bar - m
x.bar + m
s
x.bar
qt(0.975, df = 9)
s/sqrt(10)
qt(0.975, df = 9) * (s/sqrt(10))
x.bar + qt(0.975, df = 9) * (s/sqrt(10))
x.bar - qt(0.975, df = 9) * (s/sqrt(10))
?pt
setwd("C:/Users/Giouli777/Dropbox/1 Stat Project/teaching/stat102/spring_2017/lectures/unit_04_intro_inference/figures")
normTail(U = 2,
col = COL[1],
#xlim = c(-3, 3),
axes  =  FALSE,
lwd  =  2)
at <- c(-5, 0, 2, 5)
labels <- expression(0, ''*mu*' = 0  ',
't-statistic', 0)
axis(1, at, labels, cex.axis = 0.87)
library(openintro)
data(COL)
normTail(U = 2,
col = COL[1],
#xlim = c(-3, 3),
axes  =  FALSE,
lwd  =  2)
at <- c(-5, 0, 2, 5)
labels <- expression(0, ''*mu*' = 0  ',
't-statistic', 0)
axis(1, at, labels, cex.axis = 0.87)
yMax <- 0.4
dev.off()
normTail(U = -2,
col = COL[1],
#xlim = c(-3, 3),
axes  =  FALSE,
lwd  =  2)
at <- c(-5, 0, -2, 5)
labels <- expression(0, ''*mu*' = 0  ',
't-statistic', 0)
axis(1, at, labels, cex.axis = 0.87)
yMax <- 0.4
dev.off()
normTail(L = -2,
col = COL[1],
#xlim = c(-3, 3),
axes  =  FALSE,
lwd  =  2)
at <- c(-5, 0, -2, 5)
labels <- expression(0, ''*mu*' = 0  ',
't-statistic', 0)
axis(1, at, labels, cex.axis = 0.87)
yMax <- 0.4
dev.off()
myPDF('pValueOneSided.pdf', 6, 2.4,
mar = c(2, 0, 0.5, 0),
mgp = c(3, 0.65, 0))
normTail(L = -2,
col = COL[1],
#xlim = c(-3, 3),
axes  =  FALSE,
lwd  =  2)
at <- c(-5, 0, -2, 5)
labels <- expression(0, ''*mu*' = 0  ',
't-statistic', 0)
axis(1, at, labels, cex.axis = 0.87)
yMax <- 0.4
dev.off()
