BlogAnalytics 2014-12-01 23:21:00

December 1, 2014

(This article was first published on BlogAnalytics, and kindly contributed to R-bloggers)

                                                    Hypothesis Testing for Two Populations

Code :
App :

Added a new functionality to my stats app – Hypothesis testing for comparing two population means.

There are various techniques to compare means of two populations based on the type available sample data and the assumptions on population variance.
Comparing two independent populations’ means using Z-test. This test is applied when sample sizes are large or population variances are known.
This can be performed using “Hypothesis Testing” tab  in the app.
–  Comparing two independent populations’ means using t-test. t-test is applied to compare two independent populations means when sample sizes are small or population variances are not known.
Based on assumptions on population variances two techniques are available.
Pooled Variance Test – When population variances are unknown and are assumed equal, pooled variance test is applied. Pooled Variance and degree of freedom for test is
                      df = n1+n22

           s = sqrt(((s1^2*(n1-1) + s2^2*(n2-1))/(n1+n2-2))*(1/n1+1/n2))

Unpooled Variance Test – When population Variances are unknown and are assumed not equal.
  Unpooled Variance and degree of freedom are

          df = (s1^2/n1+s2^2/n2)/((s1^2/n1)^2/(n1-1) + (s2^2/n2)^2/(n2-1) ) 
s = sqrt(s1^2/n1 + s2^2/n2)

Both these tests can be performed at “independent sample” tab in the app.
– Paired Sample Test –  When same sample is tested two times to observe the difference paired sample test is performed (Like before and after cases).
“Paired Sample” tab in the app
– Comparing two population Proportions: Two populations can be compared when sample proportions are available.
“Proportions” tab in the app

Shiny R provides a number of functionality to create such applications.
Feedback and comments are welcome!!!

To leave a comment for the author, please follow the link and comment on their blog: BlogAnalytics. offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Search R-bloggers


Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)