x
of length 20 that contains the measurements for 20 randomly-chosen sticks.FakeMsmt <- function(n.samples, mu, sigma){
x <- rnorm(n = n.samples, mean = mu, sd = sigma)
mean(x) # Sometimes return the summary statistic
}
fake.means <- replicate(n = 10000, FakeMsmt(n = length(x), mu = 30, sigma = sd(x)))
p.val <- mean(abs(fake.means - 30) > abs(mean(x) - 30))
A small p-value means that the data is not consistent with the Null Hypothesis – it rarely happens that you observe observations as extreme or more extreme as what you actually observed if the data is generated using the null-hypothesis. In that case, you can reject the null hypothesis. A large p-value means that the data is consistent with the Null Hypothesis – the data that you actually observe is not extreme compared to what you would often see even if the null hypothesis is true.
By convention, we reject the null hypothesis if the p-value is under 5%. We say we have no evidence against the null hypothesis if the p-value is over 5%. N.B., we never accept the null hypothesis.
x
of length 20 that contains the measurements for 20 randomly-chosen sticks.x.bar = mean(x)
p.val <- 2*pt(-abs(x.bar-mu)/(sd(x)/sqrt(n)), df = n - 1)
A small p-value means that the data is not consistent with the Null Hypothesis – it rarely happens that you observe observations as extreme or more extreme as what you actually observed if the data is generated using the null-hypothesis. In that case, you can reject the null hypothesis. A large p-value means that the data is consistent with the Null Hypothesis – the data that you actually observe is not extreme compared to what you would often see even if the null hypothesis is true.
By convention, we reject the null hypothesis if the p-value is under 5%. We say we have no evidence against the null hypothesis if the p-value is over 5%. N.B., we never accept the null hypothesis.