A z-test is an inferential technique to assess two competing hypotheses about the population proportion(s) across one or two samples. We can use the z-test for three specific purposes:

**One-Sample:**
tests whether the population proportion is lesser, greater than, or not equal to a prespecified value. The z statistic compares the observed data with what we expect under the null hypothesis, which states that the population proportion equals the testing value. The resulting p-value tells us how likely observing the evidence we have for the alternative hypothesis or more when the null hypothesis is true. If the p-value is less than the specified significance level (e.g., less than 0.05), we reject the null hypothesis in favor of the alternate hypothesis, which states that the population proportion is less than, greater than, or not equal to the testing value. Otherwise, we fail to reject the null hypothesis, indicating we do not have significant evidence for the alternative hypothesis.

**Two Samples:**
tests whether the difference of two population proportions is lesser, greater than, or not equal to a prespecified value, which we frequently take to be zero. The z statistic compares the observed data with what we expect under the null hypothesis, which states that the difference in population proportions equals the testing value; usually, we take the testing value to be zero (e.g., the proportions are the same). The resulting p-value tells us how likely observing the evidence we have for the alternative hypothesis or more when the null hypothesis is true. If the p-value is less than the specified significance level (e.g., less than 0.05), we reject the null hypothesis in favor of the alternate hypothesis, which states that the difference of population proportions is less than, greater than, or not equal to the testing value. Otherwise, we fail to reject the null hypothesis, indicating we do not have significant evidence for the alternative hypothesis.

The z-test can be used under the following conditions.

1. The observations are representative of the population of interest and independent. The samples are mutually independent.

2. The observations within each sample are Bernoulli distributed.

3. The Central Limit Theorem sample size conditions are met.

**Note:**
When (3.) above is not met, we can use an exact test (e.g., a binomial test in the one-sample case and Fisher's test in the two-sample test).

Step 1: To use this app, go to the Dataset and Hypothesis Tab and upload your .csv type dataset, or select a sample dataset.

Step 2: Next, you must select the type of z-test (One-Sample, Two Independent Samples, or Paired Sample).

Step 3: You can check the assumptions in the 'Assumptions' tab. This tab will provide information about which approach is most appropriate given your input.

Step 4: You can check the result of the z-test procedure (test statistics, decision making, and test visualization) in the 'Hypothesis Test' and 'Confidence Interval' tabs.

Step 5 (Optional): We also provide the results of a bootstrap approach for computing a confidence interval and a randomization test. These are nonparametric alternatives to the z-test that can be used when z-test assumptions are not met or to evaluate whether the results of the z-test procedure depend on its assumptions.

Please contact us if you have any questions at datascience@colgate.edu.

Coming soon.

Loading...

Loading...

Loading...

Attali, Dean. 2021. *Shinyjs: Easily Improve the User Experience of
Your Shiny Apps in Seconds*. https://deanattali.com/shinyjs/.

Attali, Dean, and Tristan Edwards. 2021. *Shinyalert: Easily Create
Pretty Popup Messages (Modals) in Shiny*. https://github.com/daattali/shinyalert
https://daattali.com/shiny/shinyalert-demo/.

Bailey, Eric. 2022. *shinyBS: Twitter Bootstrap Components for
Shiny*. https://ebailey78.github.io/shinyBS.

Campitelli, Elio. 2022. *Ggnewscale: Multiple Fill and Colour Scales
in Ggplot2*. https://eliocamp.github.io/ggnewscale/.

Chang, Winston. 2021. *Shinythemes: Themes for Shiny*. https://rstudio.github.io/shinythemes/.

Chang, Winston, Joe Cheng, JJ Allaire, Carson Sievert, Barret Schloerke,
Yihui Xie, Jeff Allen, Jonathan McPherson, Alan Dipert, and Barbara
Borges. 2022. *Shiny: Web Application Framework for r*. https://shiny.rstudio.com/.

Cheng, Joe, and Carson Sievert. 2021. *Shinymeta: Export Domain Logic
from Shiny Using Meta-Programming*. https://CRAN.R-project.org/package=shinymeta.

Dahl, David B., David Scott, Charles Roosen, Arni Magnusson, and
Jonathan Swinton. 2019. *Xtable: Export Tables to LaTeX or HTML*.
http://xtable.r-forge.r-project.org/.

Dorai-Raj, Sundar. 2022. *Binom: Binomial Confidence Intervals for
Several Parameterizations*. https://CRAN.R-project.org/package=binom.

Horst, Allison, Alison Hill, and Kristen Gorman. 2022.
*Palmerpenguins: Palmer Archipelago (Antarctica) Penguin Data*.
https://CRAN.R-project.org/package=palmerpenguins.

James, Gareth, Daniela Witten, Trevor Hastie, and Rob Tibshirani. 2021.
*ISLR: Data for an Introduction to Statistical Learning with
Applications in r*. https://www.statlearning.com.

Nijs, Vincent, Forest Fang, Trestle Technology, LLC, and Jeff Allen.
2022. *shinyAce: Ace Editor Bindings for Shiny*. https://CRAN.R-project.org/package=shinyAce.

Pedersen, Thomas Lin. 2022. *Patchwork: The Composer of Plots*.
https://CRAN.R-project.org/package=patchwork.

Peng, Roger D. 2019. *Simpleboot: Simple Bootstrap Routines*. https://github.com/rdpeng/simpleboot.

R Core Team. 2021. *R: A Language and Environment for Statistical
Computing*. Vienna, Austria: R Foundation for Statistical Computing.
https://www.R-project.org/.

Sali, Andras, and Dean Attali. 2020. *Shinycssloaders: Add Loading
Animations to a Shiny Output While It’s Recalculating*. https://github.com/daattali/shinycssloaders.

Topaz, Chad M, Jude Higdon, Avriel Epps-Darling, Ethan Siau, Harper
Kerkhoff, Shivani Mendiratta, and Eric Young. 2022. “Race-and
Gender-Based Under-Representation of Creative Contributors: Art,
Fashion, Film, and Music.” *Humanities and Social Sciences
Communications* 9 (1): 1–11.

Wickham, Hadley. 2022. *Tidyverse: Easily Install and Load the
Tidyverse*. https://CRAN.R-project.org/package=tidyverse.

Wickham, Hadley, Mara Averick, Jennifer Bryan, Winston Chang, Lucy
D’Agostino McGowan, Romain François, Garrett Grolemund, et al. 2019.
“Welcome to the tidyverse.”
*Journal of Open Source Software* 4 (43): 1686. https://doi.org/10.21105/joss.01686.

Xie, Yihui, Joe Cheng, and Xianying Tan. 2023. *DT: A Wrapper of the
JavaScript Library DataTables*. https://github.com/rstudio/DT.