Description Usage Arguments Value See Also Examples
View source: R/hypothesisTesting.R
This function runs an hypothesis test to compare the distribution indicators (e.g. proportions, means, ratios)of two samples. In addition it calculates the p-value, standard error and confidence interval
1 2 | test.hypothesis(pm_ds, n_ds = NULL, r_ds = NULL, lower.tail = TRUE,
std_dev = NULL, conf_lvl = 0.95, distr_ind = "proportion")
|
pm_ds |
vector of distribution indicators of the populations to be compared |
n_ds |
vector of data sizes of the distribution indicators to be compared |
r_ds |
vector of ratios (in case the distribution indicator is a ratio) |
lower.tail |
whether the hypothesis test is a lower tail test |
std_dev |
standard deviation in case the distribution indicator is a mean |
conf_lvl |
confidence level |
distr_ind |
distribution indicator to be compared, e.g. proportion, mean or ratio |
The function does not return any value. But it prints the outcome of the hypotesis test on screen
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | #Proportions: fill the pm_ds and n_ds vectors with the 2 proportions and sample sizes respectively
test.hypothesis(pm_ds = c(0.0057, 0.0063), n_ds = c(6532, 58,774))
#Percentages: as above and set the distribution indicator: distr_ind = "percentage"
test.hypothesis(pm_ds = c(0.57, 0.63), n_ds = c(6532, 58,774), distr_ind = "percentage")
#Ratios: fill the pm_ds, n_ds and r_ds with the proportions, sample sizes and ratios respectively
test.hypothesis(pm_ds = c(0.0068, 0.0124, 0.0066, 0.0090), n_ds = c(6000, 54000, 6000, 54000), r_ds = c(1.82, 1.36), distr_ind = "ratio")
#Means: fill the n_ds with the sample size; fill the pm_ds vector with the means to be compared.
#provide the standard deviation of the sample by setting std_dev
test.hypothesis(pm_ds= c(68, 72), n_ds = c(100), std_dev = 10, distr_ind = "mean")
#Rates: fill the pm_ds with the weighted averages to be compared; set the distribution indicator
test.hypothesis(pm_ds= c(2.1, 1.8), distr_ind = "rate")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.