Site icon R-bloggers

BlogAnalytics 2014-12-01 23:21:00

[This article was first published on BlogAnalytics, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.



                                                    Hypothesis Testing for Two Populations

Code : https://github.com/sahuvaibhav/Stats.git
App : https://sahuvaibhav.shinyapps.io/Stats/

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.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.