ht_1pop_mean | R Documentation |
Hypothesis testing for the mean (normal distribution)
ht_1pop_mean(
x,
mu = 0,
sd_pop = NULL,
alternative = "two.sided",
conf_level = NULL,
sig_level = 0.05,
na.rm = TRUE
)
x |
a (non-empty) numeric vector. |
mu |
a number indicating the true value of the mean. Default value is 0. |
sd_pop |
a number specifying the known standard deviation of the population. If |
alternative |
a character string specifying the alternative hypothesis, must be one of ‘"two.sided"’ (default), ‘"greater"’ or ‘"less"’. You can specify just the initial letter. |
conf_level |
a number indicating the confidence level to compute the confidence interval. If |
sig_level |
a number indicating the significance level to use in the General Procedure for Hypothesis Testing. |
na.rm |
a logical value indicating whether |
We have wrapped the t.test
and the BSDA::z.test
in a function as explained in the book of Montgomery and Runger (2010) <ISBN: 978-1-119-74635-5>.
a tibble
with the following columns:
the value of the test statistic.
the p-value of the test.
critical value in the General Procedure for Hypothesis Testing.
critical region in the General Procedure for Hypothesis Testing.
a number indicating the true value of the mean.
character string giving the direction of the alternative hypothesis.
lower bound of the confidence interval. It is presented only if !is.null(con_level)
.
upper bound of the confidence interval. It is presented only if !is.null(con_level)
.
sample <- rnorm(1000, mean = 10, sd = 2) #t-test
ht_1pop_mean(sample, mu = -1) # H0: mu == -1
sample <- rnorm(1000, mean = 5, sd = 3) # z-test
ht_1pop_mean(sample, mu = 0, sd_pop = 3, alternative = 'less') # H0: mu >= 0
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.