Statistical Programming in R
Random sample
Population parameter
Sample statistic
The sampling distribution is the distribution of a sample statistic
Conditions for the CLT to hold
Statistical tests work with a null hypothesis, e.g.: \[ H_0:\mu=\mu_0 \]
\[ t_{(df)}=\frac{\bar{x}-\mu_0}{SEM} \]
The \(t\)-distribution has larger variance than the normal distribution (more uncertainty).
curve(dt(x, 100), -3, 3, ylab = "density") curve(dt(x, 2), -3, 3, ylab = "", add = T, col = "red") curve(dt(x, 1), -3, 3, ylab = "", add = T, col = "blue") legend(1.8, .4, c("t(df=100)", "t(df=2)", "t(df=1)"), col = c("black", "red", "blue"), lty=1)
curve(dnorm(x), -3, 3, ylab = "density") curve(dt(x, 2), -3, 3, ylab = "", add = T, col = "red") curve(dt(x, 1), -3, 3, ylab = "", add = T, col = "blue") legend(1.8, .4, c("normal", "t(df=2)", "t(df=1)"), col = c("black", "red", "blue"), lty=1)
The \(p\)-value in this situation is the probability that \(\bar{x}\) is at least that much different from \(\mu_0\):
We would reject \(H_0\) if \(p\) is smaller than the experimenters’ (that would be you) predetermined significance level \(\alpha\):
Example of two-sided test for \(t_{(df=10)}\) given that \(P(t<-1.559)=7.5\%\) (\(\alpha\) = 0.15)
t0 <- qt(.075, 10) cord.x1 <- c(-3, seq(-3, t0, 0.01), t0) cord.y1 <- c(0, dt(seq(-3, t0, 0.01), 10), 0) cord.x2 <- c(-t0, seq(-t0, 3, 0.01), 3) cord.y2 <- c(0, dt(seq(-t0, 3, 0.01), 10), 0) curve(dt(x,10),xlim=c(-3,3),ylab="density",main='',xlab="t-value") polygon(cord.x1,cord.y1,col='red') polygon(cord.x2,cord.y2,col='red')
The p-value is not the probability that the null hypothesis is true or the probability that the alternative hypothesis is false. It is not connected to either.
The p-value is not the probability that a finding is “merely a fluke.” In fact, the calculation of the p-value is based on the assumption that every finding is the product of chance alone.
The p-value is not the probability of falsely rejecting the null hypothesis.
The p-value is not the probability that replicating the experiment would yield the same conclusion.
The significance level, \(\alpha\), is not determined by the p-value. The significance level is decided by the experimenter a-priori and compared to the p-value that is obtained a-posteriori.
The p-value does not indicate the size or importance of the observed effect - they are related together with sample size.
If an infinite number of samples were drawn and CI’s computed, then the true population mean \(\mu\) would be in at least 95% of these intervals
\[ 95\%~CI=\bar{x}\pm{t}_{(1-\alpha/2)}\cdot SEM \]
Example
x.bar <- 7.6 # sample mean SEM <- 2.1 # standard error of the mean n <- 11 # sample size df <- n-1 # degrees of freedom alpha <- .15 # significance level t.crit <- qt(1 - alpha / 2, df) # t(1 - alpha / 2) for df = 10 c(x.bar - t.crit * SEM, x.bar + t.crit * SEM)
## [1] 4.325605 10.874395
Neyman, J. (1934). On the Two Different Aspects of the Representative Method: The Method of Stratified Sampling and the Method of Purposive Selection. Journal of the Royal Statistical Society, Vol. 97, No. 4 (1934), pp. 558-625
Confidence intervals are frequently misunderstood, even well-established researchers sometimes misinterpret them. .
that there is a 95% probability that the interval covers the population parameter
Once an experiment is done and an interval is calculated, the interval either covers, or does not cover the parameter value. Probability is no longer involved.
The 95% probability only has to do with the estimation procedure.