## Inferential Statistical Functions

### Confidence Intervals - One population mean

The following tests have been implemented. You may consult the Function Reference for detailed use and examples. The tests compute the confidence intervals, margin of error and print some other useful information.

• The Z-test with known standard deviation (`ci_onesample_z()`).
• The T-test with unknown standard deviation (`ci_onesample_t()`).

Function `ci_onesample_zreqsize()` returns the sample size required to compute a confidence level for the mean with margin of error E, known standard deviation std, and confidence level cl.

### Hypothesis Tests - One population mean

The following tests have been implemented. You may consult the Function Reference for detailed use and examples. The tests compute P values, print useful information and a message indicating the outcome of the test.

• One-sample Z-Test for a population mean when the standard deviation is known (`ht_onesample_z()`).
• One-sample T-Test for a population mean with unknown standard deviation (`ht_onesample_t()`).
• Wilcoxon Signed-Rank Test (`ht_onesample_wilcoxon()`).

Function `ht_onesample_ztypeIIerror()` returns the probability of making the Type II Error associated with the Z-Test above.

Function `ht_onesample_zpower()` returns the Power (Power=1-P(Type II error)).

(See NOTE below)

For example, given a mean equal to 26, a sample size of 30, a standard deviation equal to 1.4, a 0.05 significance level, a true mean equal to 25, and assuming this is a left tail test (type=0), then the power (probability of making the Type II Error) is:

ht_onesample_zpower(26, 30, 1.4, .05, 25, 0)
0.9883

You may build a function that returns the power as a function of the true mean for different values of the other parameters. For example, for n=30 and n=100, the following two functions return the power as a function of the true mean. A plot of the functions is also presented.

p30(x) = ht_onesample_zpower(26, 30, 1.4, .05, x, 0)
p30(x) = ht_onesample_zpower(26, 30, 1.4, .05, x, 0)
p100(x) = ht_onesample_zpower(26, 100, 1.4, .05, x, 0)
p100(x) = ht_onesample_zpower(26, 100, 1.4, .05, x, 0)
plot( p30, 24.8, 26, 50)
plot( p100, 24.8, 26, 50, "red") Figure 1. Power as a function of the true mean for a sample size of n=30 and n=100.

### Confidence Intervals - Two Population means

The following tests have been implemented. You may consult the Function Reference for detailed use and examples. The tests compute the confidence intervals, margin of error and print some other useful information.

• Pooled T-test for two population means (`ci_twosample_tpooled()`). Both standard deviations are assumed equal.
• Nonpooled T-Test for two population means (`ci_twosample_tnonpooled()`). Standard deviations are not assumed equal.
• Paired T-test for two population means (`ci_twosample_tpaired()`). Test for paired samples.

### Hypothesis Tests - Two Population means

The following tests have been implemented. You may consult the Function Reference for detailed use and examples. The tests compute P values, print useful information and a message indicating the outcome of the test.

• Pooled T-Test for two population means (`ht_twosample_tpooled()`). Test assumes samples have equal standard deviations.
• Nonpooled T-Test for two population means (`ht_twosample_tnonpooled()`). Test assumes samples do not have equal standard deviations.
• Mann-Whitney test for two population means (`ht_twosample_mannwhithney()`) for same-shape, independent samples.
• Paired T-Test for two population means (`ht_twosample_tpaired()`) for paired samples.
• Paired Wilcoxon Signed-Rank Test (`ht_twosample_pairedwilcoxon()`) for paired samples which have symmetric differences.

### Inferences for Standard deviations

The following functions have been implemented. They print useful information and a message with the outcome of the test. Detailed information and examples of use can be found in the Function Reference.

• Confidence interval (Chi-Square-Test) for one population standard deviation (`ci_onesample_std()`).
• Confidence interval (F-Test) for the ratio of two population standard deviations (`ci_twosample_std()`).
• Hypothesis test (Chi-Square-Test) for one population standard deviation (`ht_onesample()`).
• Hypothesis test (F-Test) for the ratio of two population standard deviations (`ht_twosample_std()`).

### Inferences for Proportions

The following functions have been implemented. They print useful information and a message with the outcome of the test. Detailed information and examples of use can be found in the Function Reference.

• Confidence interval for one population proportion (`ci_onesample_pro()`).
• Required size of population for a given margin of error and value of a proportion (`ci_onesample_reqsize()`).
• Hypothesis test for one population proportion (`ht_onesample_pro()`).
• Confidence interval for the two population proportions (`ci_twosample_pro()`).
• Required size of two populations for a given margin of error (`ci_twosample_reqsize()`).
• Hypothesis for two population proportions (`ht_twosample_pro()`).

### Chi-Square procedures

The following functions have been implemented. They print useful information and a message with the outcome of the test. Detailed information and examples of use can be found in the Function Reference.

• Chi-Square goodness of fit test (`chi2_goodness()`).
• Chi-Square independence test (`chi2_independent()`).
• Utility function that builds a contingency table (`chi2_totable()`).

NOTE: The data used in this example was taken from the textbook Introductory Statistics 6th Ed. by Neil A. Weiss with kind permission of Addison Wesly Longman, Inc. (AWL). AWL does not endorse nor it supports the Calcugator.