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+n2–2
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!!!