mean1.ttest | R Documentation |
Given an univariate sample x, it tests
H_0 : μ_x = μ_0\quad vs\quad H_1 : μ_x \neq μ_0
using the procedure by Student (1908).
mean1.ttest(x, mu0 = 0, alternative = c("two.sided", "less", "greater"))
x |
a length-n data vector. |
mu0 |
hypothesized mean μ_0. |
alternative |
specifying the alternative hypothesis. |
a (list) object of S3
class htest
containing:
a test statistic.
p-value under H_0.
alternative hypothesis.
name of the test.
name(s) of provided sample data.
student_probable_1908SHT
\insertRefstudent_probable_1908aSHT
## empirical Type 1 error niter = 1000 counter = rep(0,niter) # record p-values for (i in 1:niter){ x = rnorm(10) # sample from N(0,1) counter[i] = ifelse(mean1.ttest(x)$p.value < 0.05, 1, 0) } ## print the result cat(paste("\n* Example for 'mean1.ttest'\n","*\n", "* number of rejections : ", sum(counter),"\n", "* total number of trials : ", niter,"\n", "* empirical Type 1 error : ",round(sum(counter/niter),5),"\n",sep=""))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.