setwd("M:/web/17C - 2017.yrk/pracs")
m <- 100 # mean sd <- 15 # standard deviation
pnorm(115, m, sd)
IQ <- seq(40, 160, 1)
cord.x <- c(40, seq(40, 115, 1), 115)
cord.y <- c(0, dnorm(seq(40, 115, 1), 100, 15), 0)
curve(dnorm(x, 100, 15), xlim = c(40, 160), bty = "n",axes = F, xlab = "IQ", ylab = "")
polygon(cord.x, cord.y, col = "gray")
axis(1, pos = 0)
pnorm(115, m, sd, lower.tail = FALSE)
pnorm(115, m, sd) - pnorm(85, m, sd)
v <- 1.96 * 15
pnorm(m + v, m, sd) - pnorm(m - v, m, sd)
qnorm(0.2, m, sd)
qnorm(0.025, m, sd)
qnorm(0.005, m, sd) qnorm(0.995, m, sd)
z <- qnorm(0.995) cord.x <- c(-z, seq(-z, z, 0.01), z) cord.y <- c(0, dnorm(seq(-z, z, 0.01)), 0) curve(dnorm(x, 0, 1), xlim = c(-3, 3), bty = "n", axes = F, xlab = "IQ", ylab = "") polygon(cord.x, cord.y, col = "gray") arrows(-2.7, 0.1, -2.7, 0.01, length = .15) text(-2.6, 0.11, "p = 0.005") arrows(2.7, 0.1, 2.7, 0.01, length = .15) text(2.6, 0.11, "p = 0.005") text(0, 0.13, "p = 0.99") axis(1, pos = 0, labels = FALSE)
pnorm()
and qnorm()
for samplesn <- 5 # sample size se <- 15 / sqrt(n) # standard error
pnorm(115, m, se)
n <- 10 # sample size se <- 15 / sqrt(n) # standard error
pnorm(105, m, se, lower.tail = FALSE)
bee <- read.table("../data/beewing.txt", header = FALSE) str(bee)
names(bee) <- "wing" str(bee)
m <- mean(bee$wing) # mean sd <- sd(bee$wing) # standard deviation n <- length(bee$wing) # sample size se <-sd / sqrt(n) # standard error
q <- qnorm(0.975)
(lcl <- m - q * se) (ucl <- m + q * se)
q <- qnorm(0.995) lcl <- m - q * se ucl <- m + q * se
neur <- read.table("../data/neuron.txt", header = TRUE) str(neur)
m <- mean(neur$csa)
sd <-sd(neur$csa) # sample standard deviation n <- length(neur$csa) # sample size se <-sd / sqrt(n) # standard error
df <- length(neur$csa) - 1
t <- qt(0.975, df = df); t
round(m + t * se, 2) # upper limit round(m - t * se, 2) # lower limit
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.