These percentages are sample statistics derived from all the interviews conducted accross the world. It is not practical to ask every single person in this world their religious stand.
We must assume that the interviewees were simple randomly selected. It is very important to the accuracy of sample statistics that one group is not overly selected vs. the others. Only simple random sampling method can truly represent the different segments of human beliefs close to the appropriate proportions of the populatioin. Sample size almost is of importance.
download.file("http://www.tpmltd.com/ban/atheism.RData", destfile = "atheism.RData")
load("atheism.RData")
Each row of Table 6 correspond to a country with response percentages for all groups, whereas each row of atheism corresponds a country with responses only related to atheist and non-atheist.
us12 = subset(atheism, atheism$nationality == "United States" & atheism$year == "2012")
by(us12$nationality, us12$response, length)
us12$response: atheist
[1] 50
--------------------------------------------------------
us12$response: non-atheist
[1] 952
50/(952+50)
[1] 0.0499
The proportion of atheist responses for the US is 0.0499 which rounds to 0.05 in table 6.
The conditions are:
inference(data = us12$response, est = "proportion", type = "ci", method = "theoretical", success = "atheist")
Warning: package 'openintro' was built under R version 3.1.1
Please visit openintro.org for free statistics materials
Attaching package: 'openintro'
The following object is masked from 'package:datasets':
cars
Warning: package 'BHH2' was built under R version 3.1.1
Attaching package: 'BHH2'
The following object is masked from 'package:openintro':
dotPlot
One categorical variable
Single proportion
Observed proportion = 0.0499
Number of successes = 50 ; Number of failures = 952
Standard error = 0.0069
95 % Confidence interval = ( 0.04 , 0.06 )
ME <- 1.96* 0.0069
ME
ME for est. P [1] 0.01352
The two countries I picked are Spain and Vietnam. The conditions for the inference are met for Spain as again the sample size are much less than 10% of the total populations for these two countries. The sample sizes are big enough to also satisfy the Success_failure conditon. However, the condition for Vietnam failed as the proportion for atheist is 0% so np >= 10 condition is not met.
next country to test is Uzbekistan. All conditions are met.
Standard error for Spain = 0.0085
Spain12 = subset(atheism, atheism$nationality == "Spain" & atheism$year == "2012")
inference(data = Spain12$response, est = "proportion", type = "ci", method = "theoretical", success = "atheist")
One categorical variable
Single proportion
Observed proportion = 0.09
Number of successes = 103 ; Number of failures = 1042
Standard error = 0.0085
95 % Confidence interval = ( 0.07 , 0.11 )
Standard error for Vietnam = ??
Viet12 = subset(atheism, atheism$nationality == "Vietnam" & atheism$year == "2012")
inference(data = Viet12$response, est = "proportion", type = "ci", method = "theoretical", success = "atheist")
One categorical variable
Single proportion
Observed proportion = 0
Number of successes = 0 ; Number of failures = 500
Error: There aren't at least 10 successes and 10 failures, use simulation
methods instead.
Standard error for Uzbekistan = 0.0063
Uz12 = subset(atheism, atheism$nationality == "Uzbekistan" & atheism$year == "2012")
inference(data = Uz12$response, est = "proportion", type = "ci", method = "theoretical", success = "atheist")
One categorical variable
Single proportion
Observed proportion = 0.02
Number of successes = 10 ; Number of failures = 490
Standard error = 0.0063
95 % Confidence interval = ( 0.01 , 0.03 )
Based on the graph below the proportion of 0.50 is the proportion with the largest margin of error possible. the plot follows a bell curve. When the proportions move away from 0.50 and get closer to the extremes of 0.00 or 1.00, the margin of error decreases. There is an inverse Correlation between p and me as they move in opposite directions.
n <- 1000
p <- seq(0, 1, 0.01)
me <- 2 * sqrt(p * (1 - p)/n)
plot(me ~ p)
The simulation to produce 5000 samples of size 1040 sample proportions follow normal distribution with some outliers. The median and mean of the distribution are near identical at 0.1, which is also the population proportion. The range of the distribution is 0.0668 and the IQR is .0118.
set.seed(724)
p <- 0.1
n <- 1040
p_hats <- rep(0, 5000)
for (i in 1:5000) {
samp <- sample(c("atheist", "non_atheist"), n, replace = TRUE, prob = c(p,1 - p))
p_hats[i] <- sum(samp == "atheist")/n
}
summary(p_hats)
Min. 1st Qu. Median Mean 3rd Qu. Max.
0.0692 0.0942 0.1000 0.1000 0.1060 0.1360
hist(p_hats, main = "p = 0.1, n = 1040", xlim = c(0, 0.18))
boxplot(p_hats)
Since n is the denominator of p the bigger the n the smaller the p. n does not affect the center but affects the spread and shape of the distribution of sampling proportions. The spread (variability) decreases as the sample size increases. So larger samples usually give closer estimates of the population proportion p. As the sample sizes get larger the shape of the distribution also follows more the shape of normal distribtuion.
p <- 0.1
n <- 400
p_hats <- rep(0, 5000)
for (i in 1:5000) {
samp <- sample(c("atheist", "non_atheist"), n, replace = TRUE, prob = c(p,1 - p))
p_hats[i] <- sum(samp == "atheist")/n
}
p <- 0.02
n <- 1040
p_hats <- rep(0, 5000)
for (i in 1:5000) {
samp <- sample(c("atheist", "non_atheist"), n, replace = TRUE, prob = c(p,1 - p))
p_hats[i] <- sum(samp == "atheist")/n
}
p <- 0.02
n <- 400
p_hats <- rep(0, 5000)
for (i in 1:5000) {
samp <- sample(c("atheist", "non_atheist"), n, replace = TRUE, prob = c(p,1 - p))
p_hats[i] <- sum(samp == "atheist")/n
}
par(mfrow = c(2,2))
hist(p_hats, main = "p = 0.02, n = 1040", xlim = c(0.0001, 0.05))
hist(p_hats, main = "p = 0.1, n = 400", xlim = c(0, 0.18))
hist(p_hats, main = "p = 0.02, n = 400", xlim = c(0.0001, 0.06))
I would feel comfortable proceeding with the inference and me for Australia as the data met the conditions for the sampling distribution of p. However, Ecuador data did not meet the success-failure condition as np is only 8, which is smaller than the 10 needed.
The observed p-value is 0.3966, which is greater than the significance level 0.05. Therefore, we fail to reject the null hypothesis that there is no convincing evidence that Spain has seen a change in its atheism index between 2005 and 2012.
atheism$year = gsub(2005, "2005", atheism$year)
atheism$year = gsub(2012, "2012", atheism$year)
spain <- subset(atheism, atheism$nationality == "Spain")
inference(data = spain$response, group = spain$year, est = "proportion",type = "ht",null = 0, alternative = "twosided", method = "theoretical", success = "atheist")
Two categorical variables
Difference between two proportions
n_2005 = 1146 ; n_2012 = 1145
Observed difference between proportions = 0.0104
H0: p_2005 - p_2012 = 0
HA: p_2005 - p_2012 != 0
Pooled proportion = 0.0952
Group 1: Number of expected successes = 109 ; Number of expected failures = 1037
Group 2: Number of expected successes = 109 ; Number of expected failures = 1036
Standard error = 0.012
Test statistic: Z = 0.848
p-value: 0.3966
-5.25 -5.239 -5.229 -5.218 -5.208 -5.197 -5.187 -5.176 -5.166 -5.155 -5.145 -5.134 -5.124 -5.113 -5.103 -5.092 -5.082 -5.071 -5.061 -5.05 -5.04 -5.029 -5.019 -5.008 -4.997 -4.987 -4.976 -4.966 -4.955 -4.945 -4.934 -4.924 -4.913 -4.903 -4.892 -4.882 -4.871 -4.861 -4.85 -4.84 -4.829 -4.819 -4.808 -4.798 -4.787 -4.777 -4.766 -4.756 -4.745 -4.734 -4.724 -4.713 -4.703 -4.692 -4.682 -4.671 -4.661 -4.65 -4.64 -4.629 -4.619 -4.608 -4.598 -4.587 -4.577 -4.566 -4.556 -4.545 -4.535 -4.524 -4.514 -4.503 -4.492 -4.482 -4.471 -4.461 -4.45 -4.44 -4.429 -4.419 -4.408 -4.398 -4.387 -4.377 -4.366 -4.356 -4.345 -4.335 -4.324 -4.314 -4.303 -4.293 -4.282 -4.272 -4.261 -4.251 -4.24 -4.229 -4.219 -4.208 -4.198 -4.187 -4.177 -4.166 -4.156 -4.145 -4.135 -4.124 -4.114 -4.103 -4.093 -4.082 -4.072 -4.061 -4.051 -4.04 -4.03 -4.019 -4.009 -3.998 -3.987 -3.977 -3.966 -3.956 -3.945 -3.935 -3.924 -3.914 -3.903 -3.893 -3.882 -3.872 -3.861 -3.851 -3.84 -3.83 -3.819 -3.809 -3.798 -3.788 -3.777 -3.767 -3.756 -3.745 -3.735 -3.724 -3.714 -3.703 -3.693 -3.682 -3.672 -3.661 -3.651 -3.64 -3.63 -3.619 -3.609 -3.598 -3.588 -3.577 -3.567 -3.556 -3.546 -3.535 -3.525 -3.514 -3.504 -3.493 -3.482 -3.472 -3.461 -3.451 -3.44 -3.43 -3.419 -3.409 -3.398 -3.388 -3.377 -3.367 -3.356 -3.346 -3.335 -3.325 -3.314 -3.304 -3.293 -3.283 -3.272 -3.262 -3.251 -3.24 -3.23 -3.219 -3.209 -3.198 -3.188 -3.177 -3.167 -3.156 -3.146 -3.135 -3.125 -3.114 -3.104 -3.093 -3.083 -3.072 -3.062 -3.051 -3.041 -3.03 -3.02 -3.009 -2.998 -2.988 -2.977 -2.967 -2.956 -2.946 -2.935 -2.925 -2.914 -2.904 -2.893 -2.883 -2.872 -2.862 -2.851 -2.841 -2.83 -2.82 -2.809 -2.799 -2.788 -2.778 -2.767 -2.757 -2.746 -2.735 -2.725 -2.714 -2.704 -2.693 -2.683 -2.672 -2.662 -2.651 -2.641 -2.63 -2.62 -2.609 -2.599 -2.588 -2.578 -2.567 -2.557 -2.546 -2.536 -2.525 -2.515 -2.504 -2.493 -2.483 -2.472 -2.462 -2.451 -2.441 -2.43 -2.42 -2.409 -2.399 -2.388 -2.378 -2.367 -2.357 -2.346 -2.336 -2.325 -2.315 -2.304 -2.294 -2.283 -2.273 -2.262 -2.252 -2.241 -2.23 -2.22 -2.209 -2.199 -2.188 -2.178 -2.167 -2.157 -2.146 -2.136 -2.125 -2.115 -2.104 -2.094 -2.083 -2.073 -2.062 -2.052 -2.041 -2.031 -2.02 -2.01 -1.999 -1.988 -1.978 -1.967 -1.957 -1.946 -1.936 -1.925 -1.915 -1.904 -1.894 -1.883 -1.873 -1.862 -1.852 -1.841 -1.831 -1.82 -1.81 -1.799 -1.789 -1.778 -1.768 -1.757 -1.746 -1.736 -1.725 -1.715 -1.704 -1.694 -1.683 -1.673 -1.662 -1.652 -1.641 -1.631 -1.62 -1.61 -1.599 -1.589 -1.578 -1.568 -1.557 -1.547 -1.536 -1.526 -1.515 -1.505 -1.494 -1.483 -1.473 -1.462 -1.452 -1.441 -1.431 -1.42 -1.41 -1.399 -1.389 -1.378 -1.368 -1.357 -1.347 -1.336 -1.326 -1.315 -1.305 -1.294 -1.284 -1.273 -1.263 -1.252 -1.241 -1.231 -1.22 -1.21 -1.199 -1.189 -1.178 -1.168 -1.157 -1.147 -1.136 -1.126 -1.115 -1.105 -1.094 -1.084 -1.073 -1.063 -1.052 -1.042 -1.031 -1.021 -1.01 -0.9995 -0.989 -0.9785 -0.9679 -0.9574 -0.9469 -0.9364 -0.9259 -0.9153 -0.9048 -0.8943 -0.8838 -0.8732 -0.8627 -0.8522 -0.8417 -0.8312 -0.8206 -0.8101 -0.7996 -0.7891 -0.7786 -0.768 -0.7575 -0.747 -0.7365 -0.726 -0.7154 -0.7049 -0.6944 -0.6839 -0.6733 -0.6628 -0.6523 -0.6418 -0.6313 -0.6207 -0.6102 -0.5997 -0.5892 -0.5787 -0.5681 -0.5576 -0.5471 -0.5366 -0.5261 -0.5155 -0.505 -0.4945 -0.484 -0.4734 -0.4629 -0.4524 -0.4419 -0.4314 -0.4208 -0.4103 -0.3998 -0.3893 -0.3788 -0.3682 -0.3577 -0.3472 -0.3367 -0.3262 -0.3156 -0.3051 -0.2946 -0.2841 -0.2735 -0.263 -0.2525 -0.242 -0.2315 -0.2209 -0.2104 -0.1999 -0.1894 -0.1789 -0.1683 -0.1578 -0.1473 -0.1368 -0.1263 -0.1157 -0.1052 -0.09469 -0.08417 -0.07365 -0.06313 -0.05261 -0.04208 -0.03156 -0.02104 -0.01052 0 0.01052 0.02104 0.03156 0.04208 0.05261 0.06313 0.07365 0.08417 0.09469 0.1052 0.1157 0.1263 0.1368 0.1473 0.1578 0.1683 0.1789 0.1894 0.1999 0.2104 0.2209 0.2315 0.242 0.2525 0.263 0.2735 0.2841 0.2946 0.3051 0.3156 0.3262 0.3367 0.3472 0.3577 0.3682 0.3788 0.3893 0.3998 0.4103 0.4208 0.4314 0.4419 0.4524 0.4629 0.4734 0.484 0.4945 0.505 0.5155 0.5261 0.5366 0.5471 0.5576 0.5681 0.5787 0.5892 0.5997 0.6102 0.6207 0.6313 0.6418 0.6523 0.6628 0.6733 0.6839 0.6944 0.7049 0.7154 0.726 0.7365 0.747 0.7575 0.768 0.7786 0.7891 0.7996 0.8101 0.8206 0.8312 0.8417 0.8522 0.8627 0.8732 0.8838 0.8943 0.9048 0.9153 0.9259 0.9364 0.9469 0.9574 0.9679 0.9785 0.989 0.9995 1.01 1.021 1.031 1.042 1.052 1.063 1.073 1.084 1.094 1.105 1.115 1.126 1.136 1.147 1.157 1.168 1.178 1.189 1.199 1.21 1.22 1.231 1.241 1.252 1.263 1.273 1.284 1.294 1.305 1.315 1.326 1.336 1.347 1.357 1.368 1.378 1.389 1.399 1.41 1.42 1.431 1.441 1.452 1.462 1.473 1.483 1.494 1.505 1.515 1.526 1.536 1.547 1.557 1.568 1.578 1.589 1.599 1.61 1.62 1.631 1.641 1.652 1.662 1.673 1.683 1.694 1.704 1.715 1.725 1.736 1.746 1.757 1.768 1.778 1.789 1.799 1.81 1.82 1.831 1.841 1.852 1.862 1.873 1.883 1.894 1.904 1.915 1.925 1.936 1.946 1.957 1.967 1.978 1.988 1.999 2.01 2.02 2.031 2.041 2.052 2.062 2.073 2.083 2.094 2.104 2.115 2.125 2.136 2.146 2.157 2.167 2.178 2.188 2.199 2.209 2.22 2.23 2.241 2.252 2.262 2.273 2.283 2.294 2.304 2.315 2.325 2.336 2.346 2.357 2.367 2.378 2.388 2.399 2.409 2.42 2.43 2.441 2.451 2.462 2.472 2.483 2.493 2.504 2.515 2.525 2.536 2.546 2.557 2.567 2.578 2.588 2.599 2.609 2.62 2.63 2.641 2.651 2.662 2.672 2.683 2.693 2.704 2.714 2.725 2.735 2.746 2.757 2.767 2.778 2.788 2.799 2.809 2.82 2.83 2.841 2.851 2.862 2.872 2.883 2.893 2.904 2.914 2.925 2.935 2.946 2.956 2.967 2.977 2.988 2.998 3.009 3.02 3.03 3.041 3.051 3.062 3.072 3.083 3.093 3.104 3.114 3.125 3.135 3.146 3.156 3.167 3.177 3.188 3.198 3.209 3.219 3.23 3.24 3.251 3.262 3.272 3.283 3.293 3.304 3.314 3.325 3.335 3.346 3.356 3.367 3.377 3.388 3.398 3.409 3.419 3.43 3.44 3.451 3.461 3.472 3.482 3.493 3.504 3.514 3.525 3.535 3.546 3.556 3.567 3.577 3.588 3.598 3.609 3.619 3.63 3.64 3.651 3.661 3.672 3.682 3.693 3.703 3.714 3.724 3.735 3.745 3.756 3.767 3.777 3.788 3.798 3.809 3.819 3.83 3.84 3.851 3.861 3.872 3.882 3.893 3.903 3.914 3.924 3.935 3.945 3.956 3.966 3.977 3.987 3.998 4.009 4.019 4.03 4.04 4.051 4.061 4.072 4.082 4.093 4.103 4.114 4.124 4.135 4.145 4.156 4.166 4.177 4.187 4.198 4.208 4.219 4.229 4.24 4.251 4.261 4.272 4.282 4.293 4.303 4.314 4.324 4.335 4.345 4.356 4.366 4.377 4.387 4.398 4.408 4.419 4.429 4.44 4.45 4.461 4.471 4.482 4.492 4.503 4.514 4.524 4.535 4.545 4.556 4.566 4.577 4.587 4.598 4.608 4.619 4.629 4.64 4.65 4.661 4.671 4.682 4.692 4.703 4.713 4.724 4.734 4.745 4.756 4.766 4.777 4.787 4.798 4.808 4.819 4.829 4.84 4.85 4.861 4.871 4.882 4.892 4.903 4.913 4.924 4.934 4.945 4.955 4.966 4.976 4.987 4.997 5.008 5.019 5.029 5.04 5.05 5.061 5.071 5.082 5.092 5.103 5.113 5.124 5.134 5.145 5.155 5.166 5.176 5.187 5.197 5.208 5.218 5.229 5.239 5.254.907e-07 5.178e-07 5.463e-07 5.763e-07 6.08e-07 6.413e-07 6.764e-07 7.133e-07 7.521e-07 7.93e-07 8.361e-07 8.813e-07 9.29e-07 9.791e-07 1.032e-06 1.087e-06 1.145e-06 1.207e-06 1.271e-06 1.339e-06 1.41e-06 1.485e-06 1.564e-06 1.646e-06 1.733e-06 1.824e-06 1.92e-06 2.021e-06 2.126e-06 2.237e-06 2.354e-06 2.476e-06 2.605e-06 2.74e-06 2.881e-06 3.03e-06 3.186e-06 3.349e-06 3.521e-06 3.701e-06 3.89e-06 4.088e-06 4.295e-06 4.513e-06 4.741e-06 4.98e-06 5.231e-06 5.494e-06 5.769e-06 6.058e-06 6.361e-06 6.677e-06 7.009e-06 7.357e-06 7.721e-06 8.102e-06 8.501e-06 8.919e-06 9.357e-06 9.815e-06 1.029e-05 1.08e-05 1.132e-05 1.187e-05 1.244e-05 1.305e-05 1.367e-05 1.433e-05 1.502e-05 1.574e-05 1.649e-05 1.727e-05 1.809e-05 1.895e-05 1.985e-05 2.079e-05 2.176e-05 2.279e-05 2.385e-05 2.497e-05 2.614e-05 2.735e-05 2.862e-05 2.995e-05 3.133e-05 3.278e-05 3.428e-05 3.586e-05 3.75e-05 3.921e-05 4.1e-05 4.286e-05 4.48e-05 4.683e-05 4.894e-05 5.114e-05 5.344e-05 5.583e-05 5.833e-05 6.093e-05 6.363e-05 6.646e-05 6.94e-05 7.246e-05 7.565e-05 7.897e-05 8.243e-05 8.603e-05 8.978e-05 9.368e-05 9.774e-05 0.000102 0.0001064 0.0001109 0.0001157 0.0001207 0.0001258 0.0001312 0.0001367 0.0001425 0.0001486 0.0001548 0.0001613 0.0001681 0.0001751 0.0001824 0.00019 0.0001979 0.0002061 0.0002146 0.0002234 0.0002326 0.0002421 0.000252 0.0002623 0.0002729 0.000284 0.0002954 0.0003073 0.0003197 0.0003325 0.0003458 0.0003595 0.0003738 0.0003886 0.000404 0.0004199 0.0004364 0.0004535 0.0004712 0.0004895 0.0005085 0.0005282 0.0005486 0.0005698 0.0005916 0.0006143 0.0006377 0.000662 0.0006871 0.0007131 0.00074 0.0007679 0.0007967 0.0008265 0.0008573 0.0008892 0.0009221 0.0009562 0.0009915 0.001028 0.001066 0.001104 0.001145 0.001186 0.001229 0.001273 0.001319 0.001366 0.001415 0.001466 0.001518 0.001572 0.001627 0.001684 0.001743 0.001804 0.001867 0.001932 0.001999 0.002068 0.002139 0.002212 0.002288 0.002366 0.002446 0.002529 0.002614 0.002702 0.002793 0.002886 0.002982 0.003081 0.003183 0.003288 0.003396 0.003507 0.003622 0.00374 0.003861 0.003985 0.004114 0.004246 0.004381 0.004521 0.004664 0.004812 0.004963 0.005119 0.005279 0.005444 0.005613 0.005787 0.005966 0.006149 0.006337 0.006531 0.006729 0.006933 0.007142 0.007357 0.007577 0.007803 0.008035 0.008273 0.008517 0.008768 0.009025 0.009288 0.009558 0.009835 0.01012 0.01041 0.01071 0.01101 0.01132 0.01164 0.01197 0.01231 0.01265 0.01301 0.01337 0.01373 0.01411 0.0145 0.01489 0.0153 0.01571 0.01614 0.01657 0.01701 0.01747 0.01793 0.0184 0.01888 0.01938 0.01988 0.0204 0.02093 0.02146 0.02201 0.02257 0.02315 0.02373 0.02433 0.02494 0.02556 0.0262 0.02684 0.0275 0.02818 0.02886 0.02956 0.03028 0.03101 0.03175 0.0325 0.03327 0.03406 0.03486 0.03567 0.0365 0.03735 0.03821 0.03908 0.03998 0.04088 0.04181 0.04275 0.0437 0.04467 0.04566 0.04667 0.04769 0.04873 0.04979 0.05086 0.05196 0.05307 0.05419 0.05534 0.0565 0.05768 0.05888 0.0601 0.06134 0.06259 0.06387 0.06516 0.06647 0.0678 0.06915 0.07052 0.07191 0.07331 0.07474 0.07619 0.07765 0.07914 0.08064 0.08217 0.08371 0.08527 0.08686 0.08846 0.09008 0.09172 0.09338 0.09506 0.09677 0.09849 0.1002 0.102 0.1038 0.1056 0.1074 0.1092 0.1111 0.113 0.1148 0.1168 0.1187 0.1206 0.1226 0.1246 0.1266 0.1286 0.1307 0.1327 0.1348 0.1369 0.139 0.1411 0.1433 0.1455 0.1476 0.1498 0.152 0.1543 0.1565 0.1588 0.161 0.1633 0.1656 0.1679 0.1703 0.1726 0.175 0.1773 0.1797 0.1821 0.1845 0.1869 0.1894 0.1918 0.1942 0.1967 0.1992 0.2016 0.2041 0.2066 0.2091 0.2116 0.2141 0.2166 0.2191 0.2217 0.2242 0.2267 0.2293 0.2318 0.2343 0.2369 0.2394 0.242 0.2445 0.2471 0.2496 0.2521 0.2547 0.2572 0.2598 0.2623 0.2648 0.2673 0.2698 0.2723 0.2748 0.2773 0.2798 0.2823 0.2848 0.2872 0.2896 0.2921 0.2945 0.2969 0.2993 0.3017 0.304 0.3064 0.3087 0.311 0.3133 0.3156 0.3179 0.3201 0.3224 0.3246 0.3267 0.3289 0.331 0.3332 0.3352 0.3373 0.3394 0.3414 0.3434 0.3453 0.3473 0.3492 0.3511 0.3529 0.3547 0.3565 0.3583 0.36 0.3617 0.3634 0.365 0.3666 0.3682 0.3697 0.3712 0.3727 0.3741 0.3755 0.3768 0.3782 0.3794 0.3807 0.3819 0.3831 0.3842 0.3853 0.3863 0.3873 0.3883 0.3892 0.3901 0.3909 0.3917 0.3925 0.3932 0.3939 0.3945 0.3951 0.3957 0.3962 0.3966 0.3971 0.3974 0.3978 0.398 0.3983 0.3985 0.3986 0.3988 0.3988 0.3988 0.3988 0.3988 0.3986 0.3985 0.3983 0.398 0.3978 0.3974 0.3971 0.3966 0.3962 0.3957 0.3951 0.3945 0.3939 0.3932 0.3925 0.3917 0.3909 0.3901 0.3892 0.3883 0.3873 0.3863 0.3853 0.3842 0.3831 0.3819 0.3807 0.3794 0.3782 0.3768 0.3755 0.3741 0.3727 0.3712 0.3697 0.3682 0.3666 0.365 0.3634 0.3617 0.36 0.3583 0.3565 0.3547 0.3529 0.3511 0.3492 0.3473 0.3453 0.3434 0.3414 0.3394 0.3373 0.3352 0.3332 0.331 0.3289 0.3267 0.3246 0.3224 0.3201 0.3179 0.3156 0.3133 0.311 0.3087 0.3064 0.304 0.3017 0.2993 0.2969 0.2945 0.2921 0.2896 0.2872 0.2848 0.2823 0.2798 0.2773 0.2748 0.2723 0.2698 0.2673 0.2648 0.2623 0.2598 0.2572 0.2547 0.2521 0.2496 0.2471 0.2445 0.242 0.2394 0.2369 0.2343 0.2318 0.2293 0.2267 0.2242 0.2217 0.2191 0.2166 0.2141 0.2116 0.2091 0.2066 0.2041 0.2016 0.1992 0.1967 0.1942 0.1918 0.1894 0.1869 0.1845 0.1821 0.1797 0.1773 0.175 0.1726 0.1703 0.1679 0.1656 0.1633 0.161 0.1588 0.1565 0.1543 0.152 0.1498 0.1476 0.1455 0.1433 0.1411 0.139 0.1369 0.1348 0.1327 0.1307 0.1286 0.1266 0.1246 0.1226 0.1206 0.1187 0.1168 0.1148 0.113 0.1111 0.1092 0.1074 0.1056 0.1038 0.102 0.1002 0.09849 0.09677 0.09506 0.09338 0.09172 0.09008 0.08846 0.08686 0.08527 0.08371 0.08217 0.08064 0.07914 0.07765 0.07619 0.07474 0.07331 0.07191 0.07052 0.06915 0.0678 0.06647 0.06516 0.06387 0.06259 0.06134 0.0601 0.05888 0.05768 0.0565 0.05534 0.05419 0.05307 0.05196 0.05086 0.04979 0.04873 0.04769 0.04667 0.04566 0.04467 0.0437 0.04275 0.04181 0.04088 0.03998 0.03908 0.03821 0.03735 0.0365 0.03567 0.03486 0.03406 0.03327 0.0325 0.03175 0.03101 0.03028 0.02956 0.02886 0.02818 0.0275 0.02684 0.0262 0.02556 0.02494 0.02433 0.02373 0.02315 0.02257 0.02201 0.02146 0.02093 0.0204 0.01988 0.01938 0.01888 0.0184 0.01793 0.01747 0.01701 0.01657 0.01614 0.01571 0.0153 0.01489 0.0145 0.01411 0.01373 0.01337 0.01301 0.01265 0.01231 0.01197 0.01164 0.01132 0.01101 0.01071 0.01041 0.01012 0.009835 0.009558 0.009288 0.009025 0.008768 0.008517 0.008273 0.008035 0.007803 0.007577 0.007357 0.007142 0.006933 0.006729 0.006531 0.006337 0.006149 0.005966 0.005787 0.005613 0.005444 0.005279 0.005119 0.004963 0.004812 0.004664 0.004521 0.004381 0.004246 0.004114 0.003985 0.003861 0.00374 0.003622 0.003507 0.003396 0.003288 0.003183 0.003081 0.002982 0.002886 0.002793 0.002702 0.002614 0.002529 0.002446 0.002366 0.002288 0.002212 0.002139 0.002068 0.001999 0.001932 0.001867 0.001804 0.001743 0.001684 0.001627 0.001572 0.001518 0.001466 0.001415 0.001366 0.001319 0.001273 0.001229 0.001186 0.001145 0.001104 0.001066 0.001028 0.0009915 0.0009562 0.0009221 0.0008892 0.0008573 0.0008265 0.0007967 0.0007679 0.00074 0.0007131 0.0006871 0.000662 0.0006377 0.0006143 0.0005916 0.0005698 0.0005486 0.0005282 0.0005085 0.0004895 0.0004712 0.0004535 0.0004364 0.0004199 0.000404 0.0003886 0.0003738 0.0003595 0.0003458 0.0003325 0.0003197 0.0003073 0.0002954 0.000284 0.0002729 0.0002623 0.000252 0.0002421 0.0002326 0.0002234 0.0002146 0.0002061 0.0001979 0.00019 0.0001824 0.0001751 0.0001681 0.0001613 0.0001548 0.0001486 0.0001425 0.0001367 0.0001312 0.0001258 0.0001207 0.0001157 0.0001109 0.0001064 0.000102 9.774e-05 9.368e-05 8.978e-05 8.603e-05 8.243e-05 7.897e-05 7.565e-05 7.246e-05 6.94e-05 6.646e-05 6.363e-05 6.093e-05 5.833e-05 5.583e-05 5.344e-05 5.114e-05 4.894e-05 4.683e-05 4.48e-05 4.286e-05 4.1e-05 3.921e-05 3.75e-05 3.586e-05 3.428e-05 3.278e-05 3.133e-05 2.995e-05 2.862e-05 2.735e-05 2.614e-05 2.497e-05 2.385e-05 2.279e-05 2.176e-05 2.079e-05 1.985e-05 1.895e-05 1.809e-05 1.727e-05 1.649e-05 1.574e-05 1.502e-05 1.433e-05 1.367e-05 1.305e-05 1.244e-05 1.187e-05 1.132e-05 1.08e-05 1.029e-05 9.815e-06 9.357e-06 8.919e-06 8.501e-06 8.102e-06 7.721e-06 7.357e-06 7.009e-06 6.677e-06 6.361e-06 6.058e-06 5.769e-06 5.494e-06 5.231e-06 4.98e-06 4.741e-06 4.513e-06 4.295e-06 4.088e-06 3.89e-06 3.701e-06 3.521e-06 3.349e-06 3.186e-06 3.03e-06 2.881e-06 2.74e-06 2.605e-06 2.476e-06 2.354e-06 2.237e-06 2.126e-06 2.021e-06 1.92e-06 1.824e-06 1.733e-06 1.646e-06 1.564e-06 1.485e-06 1.41e-06 1.339e-06 1.271e-06 1.207e-06 1.145e-06 1.087e-06 1.032e-06 9.791e-07 9.29e-07 8.813e-07 8.361e-07 7.93e-07 7.521e-07 7.133e-07 6.764e-07 6.413e-07 6.08e-07 5.763e-07 5.463e-07 5.178e-07 4.907e-07
The observed p-value is 0, which is less than the significance level 0.05. Therefore, we reject the null hypothesis that there is no convincing evidence that US has seen a change in its atheism index between 2005 and 2012.
US<- subset(atheism, atheism$nationality == "United States")
inference(data = US$response, group = US$year, est = "proportion",type = "ht",null = 0, alternative = "twosided", method = "theoretical", success = "atheist")
Two categorical variables
Difference between two proportions
n_2005 = 1002 ; n_2012 = 1002
Observed difference between proportions = -0.0399
H0: p_2005 - p_2012 = 0
HA: p_2005 - p_2012 != 0
Pooled proportion = 0.0299
Group 1: Number of expected successes = 30 ; Number of expected failures = 972
Group 2: Number of expected successes = 30 ; Number of expected failures = 972
Standard error = 0.008
Test statistic: Z = -5.243
p-value: 0
-5.25 -5.239 -5.229 -5.218 -5.208 -5.197 -5.187 -5.176 -5.166 -5.155 -5.145 -5.134 -5.124 -5.113 -5.103 -5.092 -5.082 -5.071 -5.061 -5.05 -5.04 -5.029 -5.019 -5.008 -4.997 -4.987 -4.976 -4.966 -4.955 -4.945 -4.934 -4.924 -4.913 -4.903 -4.892 -4.882 -4.871 -4.861 -4.85 -4.84 -4.829 -4.819 -4.808 -4.798 -4.787 -4.777 -4.766 -4.756 -4.745 -4.734 -4.724 -4.713 -4.703 -4.692 -4.682 -4.671 -4.661 -4.65 -4.64 -4.629 -4.619 -4.608 -4.598 -4.587 -4.577 -4.566 -4.556 -4.545 -4.535 -4.524 -4.514 -4.503 -4.492 -4.482 -4.471 -4.461 -4.45 -4.44 -4.429 -4.419 -4.408 -4.398 -4.387 -4.377 -4.366 -4.356 -4.345 -4.335 -4.324 -4.314 -4.303 -4.293 -4.282 -4.272 -4.261 -4.251 -4.24 -4.229 -4.219 -4.208 -4.198 -4.187 -4.177 -4.166 -4.156 -4.145 -4.135 -4.124 -4.114 -4.103 -4.093 -4.082 -4.072 -4.061 -4.051 -4.04 -4.03 -4.019 -4.009 -3.998 -3.987 -3.977 -3.966 -3.956 -3.945 -3.935 -3.924 -3.914 -3.903 -3.893 -3.882 -3.872 -3.861 -3.851 -3.84 -3.83 -3.819 -3.809 -3.798 -3.788 -3.777 -3.767 -3.756 -3.745 -3.735 -3.724 -3.714 -3.703 -3.693 -3.682 -3.672 -3.661 -3.651 -3.64 -3.63 -3.619 -3.609 -3.598 -3.588 -3.577 -3.567 -3.556 -3.546 -3.535 -3.525 -3.514 -3.504 -3.493 -3.482 -3.472 -3.461 -3.451 -3.44 -3.43 -3.419 -3.409 -3.398 -3.388 -3.377 -3.367 -3.356 -3.346 -3.335 -3.325 -3.314 -3.304 -3.293 -3.283 -3.272 -3.262 -3.251 -3.24 -3.23 -3.219 -3.209 -3.198 -3.188 -3.177 -3.167 -3.156 -3.146 -3.135 -3.125 -3.114 -3.104 -3.093 -3.083 -3.072 -3.062 -3.051 -3.041 -3.03 -3.02 -3.009 -2.998 -2.988 -2.977 -2.967 -2.956 -2.946 -2.935 -2.925 -2.914 -2.904 -2.893 -2.883 -2.872 -2.862 -2.851 -2.841 -2.83 -2.82 -2.809 -2.799 -2.788 -2.778 -2.767 -2.757 -2.746 -2.735 -2.725 -2.714 -2.704 -2.693 -2.683 -2.672 -2.662 -2.651 -2.641 -2.63 -2.62 -2.609 -2.599 -2.588 -2.578 -2.567 -2.557 -2.546 -2.536 -2.525 -2.515 -2.504 -2.493 -2.483 -2.472 -2.462 -2.451 -2.441 -2.43 -2.42 -2.409 -2.399 -2.388 -2.378 -2.367 -2.357 -2.346 -2.336 -2.325 -2.315 -2.304 -2.294 -2.283 -2.273 -2.262 -2.252 -2.241 -2.23 -2.22 -2.209 -2.199 -2.188 -2.178 -2.167 -2.157 -2.146 -2.136 -2.125 -2.115 -2.104 -2.094 -2.083 -2.073 -2.062 -2.052 -2.041 -2.031 -2.02 -2.01 -1.999 -1.988 -1.978 -1.967 -1.957 -1.946 -1.936 -1.925 -1.915 -1.904 -1.894 -1.883 -1.873 -1.862 -1.852 -1.841 -1.831 -1.82 -1.81 -1.799 -1.789 -1.778 -1.768 -1.757 -1.746 -1.736 -1.725 -1.715 -1.704 -1.694 -1.683 -1.673 -1.662 -1.652 -1.641 -1.631 -1.62 -1.61 -1.599 -1.589 -1.578 -1.568 -1.557 -1.547 -1.536 -1.526 -1.515 -1.505 -1.494 -1.483 -1.473 -1.462 -1.452 -1.441 -1.431 -1.42 -1.41 -1.399 -1.389 -1.378 -1.368 -1.357 -1.347 -1.336 -1.326 -1.315 -1.305 -1.294 -1.284 -1.273 -1.263 -1.252 -1.241 -1.231 -1.22 -1.21 -1.199 -1.189 -1.178 -1.168 -1.157 -1.147 -1.136 -1.126 -1.115 -1.105 -1.094 -1.084 -1.073 -1.063 -1.052 -1.042 -1.031 -1.021 -1.01 -0.9995 -0.989 -0.9785 -0.9679 -0.9574 -0.9469 -0.9364 -0.9259 -0.9153 -0.9048 -0.8943 -0.8838 -0.8732 -0.8627 -0.8522 -0.8417 -0.8312 -0.8206 -0.8101 -0.7996 -0.7891 -0.7786 -0.768 -0.7575 -0.747 -0.7365 -0.726 -0.7154 -0.7049 -0.6944 -0.6839 -0.6733 -0.6628 -0.6523 -0.6418 -0.6313 -0.6207 -0.6102 -0.5997 -0.5892 -0.5787 -0.5681 -0.5576 -0.5471 -0.5366 -0.5261 -0.5155 -0.505 -0.4945 -0.484 -0.4734 -0.4629 -0.4524 -0.4419 -0.4314 -0.4208 -0.4103 -0.3998 -0.3893 -0.3788 -0.3682 -0.3577 -0.3472 -0.3367 -0.3262 -0.3156 -0.3051 -0.2946 -0.2841 -0.2735 -0.263 -0.2525 -0.242 -0.2315 -0.2209 -0.2104 -0.1999 -0.1894 -0.1789 -0.1683 -0.1578 -0.1473 -0.1368 -0.1263 -0.1157 -0.1052 -0.09469 -0.08417 -0.07365 -0.06313 -0.05261 -0.04208 -0.03156 -0.02104 -0.01052 0 0.01052 0.02104 0.03156 0.04208 0.05261 0.06313 0.07365 0.08417 0.09469 0.1052 0.1157 0.1263 0.1368 0.1473 0.1578 0.1683 0.1789 0.1894 0.1999 0.2104 0.2209 0.2315 0.242 0.2525 0.263 0.2735 0.2841 0.2946 0.3051 0.3156 0.3262 0.3367 0.3472 0.3577 0.3682 0.3788 0.3893 0.3998 0.4103 0.4208 0.4314 0.4419 0.4524 0.4629 0.4734 0.484 0.4945 0.505 0.5155 0.5261 0.5366 0.5471 0.5576 0.5681 0.5787 0.5892 0.5997 0.6102 0.6207 0.6313 0.6418 0.6523 0.6628 0.6733 0.6839 0.6944 0.7049 0.7154 0.726 0.7365 0.747 0.7575 0.768 0.7786 0.7891 0.7996 0.8101 0.8206 0.8312 0.8417 0.8522 0.8627 0.8732 0.8838 0.8943 0.9048 0.9153 0.9259 0.9364 0.9469 0.9574 0.9679 0.9785 0.989 0.9995 1.01 1.021 1.031 1.042 1.052 1.063 1.073 1.084 1.094 1.105 1.115 1.126 1.136 1.147 1.157 1.168 1.178 1.189 1.199 1.21 1.22 1.231 1.241 1.252 1.263 1.273 1.284 1.294 1.305 1.315 1.326 1.336 1.347 1.357 1.368 1.378 1.389 1.399 1.41 1.42 1.431 1.441 1.452 1.462 1.473 1.483 1.494 1.505 1.515 1.526 1.536 1.547 1.557 1.568 1.578 1.589 1.599 1.61 1.62 1.631 1.641 1.652 1.662 1.673 1.683 1.694 1.704 1.715 1.725 1.736 1.746 1.757 1.768 1.778 1.789 1.799 1.81 1.82 1.831 1.841 1.852 1.862 1.873 1.883 1.894 1.904 1.915 1.925 1.936 1.946 1.957 1.967 1.978 1.988 1.999 2.01 2.02 2.031 2.041 2.052 2.062 2.073 2.083 2.094 2.104 2.115 2.125 2.136 2.146 2.157 2.167 2.178 2.188 2.199 2.209 2.22 2.23 2.241 2.252 2.262 2.273 2.283 2.294 2.304 2.315 2.325 2.336 2.346 2.357 2.367 2.378 2.388 2.399 2.409 2.42 2.43 2.441 2.451 2.462 2.472 2.483 2.493 2.504 2.515 2.525 2.536 2.546 2.557 2.567 2.578 2.588 2.599 2.609 2.62 2.63 2.641 2.651 2.662 2.672 2.683 2.693 2.704 2.714 2.725 2.735 2.746 2.757 2.767 2.778 2.788 2.799 2.809 2.82 2.83 2.841 2.851 2.862 2.872 2.883 2.893 2.904 2.914 2.925 2.935 2.946 2.956 2.967 2.977 2.988 2.998 3.009 3.02 3.03 3.041 3.051 3.062 3.072 3.083 3.093 3.104 3.114 3.125 3.135 3.146 3.156 3.167 3.177 3.188 3.198 3.209 3.219 3.23 3.24 3.251 3.262 3.272 3.283 3.293 3.304 3.314 3.325 3.335 3.346 3.356 3.367 3.377 3.388 3.398 3.409 3.419 3.43 3.44 3.451 3.461 3.472 3.482 3.493 3.504 3.514 3.525 3.535 3.546 3.556 3.567 3.577 3.588 3.598 3.609 3.619 3.63 3.64 3.651 3.661 3.672 3.682 3.693 3.703 3.714 3.724 3.735 3.745 3.756 3.767 3.777 3.788 3.798 3.809 3.819 3.83 3.84 3.851 3.861 3.872 3.882 3.893 3.903 3.914 3.924 3.935 3.945 3.956 3.966 3.977 3.987 3.998 4.009 4.019 4.03 4.04 4.051 4.061 4.072 4.082 4.093 4.103 4.114 4.124 4.135 4.145 4.156 4.166 4.177 4.187 4.198 4.208 4.219 4.229 4.24 4.251 4.261 4.272 4.282 4.293 4.303 4.314 4.324 4.335 4.345 4.356 4.366 4.377 4.387 4.398 4.408 4.419 4.429 4.44 4.45 4.461 4.471 4.482 4.492 4.503 4.514 4.524 4.535 4.545 4.556 4.566 4.577 4.587 4.598 4.608 4.619 4.629 4.64 4.65 4.661 4.671 4.682 4.692 4.703 4.713 4.724 4.734 4.745 4.756 4.766 4.777 4.787 4.798 4.808 4.819 4.829 4.84 4.85 4.861 4.871 4.882 4.892 4.903 4.913 4.924 4.934 4.945 4.955 4.966 4.976 4.987 4.997 5.008 5.019 5.029 5.04 5.05 5.061 5.071 5.082 5.092 5.103 5.113 5.124 5.134 5.145 5.155 5.166 5.176 5.187 5.197 5.208 5.218 5.229 5.239 5.254.907e-07 5.178e-07 5.463e-07 5.763e-07 6.08e-07 6.413e-07 6.764e-07 7.133e-07 7.521e-07 7.93e-07 8.361e-07 8.813e-07 9.29e-07 9.791e-07 1.032e-06 1.087e-06 1.145e-06 1.207e-06 1.271e-06 1.339e-06 1.41e-06 1.485e-06 1.564e-06 1.646e-06 1.733e-06 1.824e-06 1.92e-06 2.021e-06 2.126e-06 2.237e-06 2.354e-06 2.476e-06 2.605e-06 2.74e-06 2.881e-06 3.03e-06 3.186e-06 3.349e-06 3.521e-06 3.701e-06 3.89e-06 4.088e-06 4.295e-06 4.513e-06 4.741e-06 4.98e-06 5.231e-06 5.494e-06 5.769e-06 6.058e-06 6.361e-06 6.677e-06 7.009e-06 7.357e-06 7.721e-06 8.102e-06 8.501e-06 8.919e-06 9.357e-06 9.815e-06 1.029e-05 1.08e-05 1.132e-05 1.187e-05 1.244e-05 1.305e-05 1.367e-05 1.433e-05 1.502e-05 1.574e-05 1.649e-05 1.727e-05 1.809e-05 1.895e-05 1.985e-05 2.079e-05 2.176e-05 2.279e-05 2.385e-05 2.497e-05 2.614e-05 2.735e-05 2.862e-05 2.995e-05 3.133e-05 3.278e-05 3.428e-05 3.586e-05 3.75e-05 3.921e-05 4.1e-05 4.286e-05 4.48e-05 4.683e-05 4.894e-05 5.114e-05 5.344e-05 5.583e-05 5.833e-05 6.093e-05 6.363e-05 6.646e-05 6.94e-05 7.246e-05 7.565e-05 7.897e-05 8.243e-05 8.603e-05 8.978e-05 9.368e-05 9.774e-05 0.000102 0.0001064 0.0001109 0.0001157 0.0001207 0.0001258 0.0001312 0.0001367 0.0001425 0.0001486 0.0001548 0.0001613 0.0001681 0.0001751 0.0001824 0.00019 0.0001979 0.0002061 0.0002146 0.0002234 0.0002326 0.0002421 0.000252 0.0002623 0.0002729 0.000284 0.0002954 0.0003073 0.0003197 0.0003325 0.0003458 0.0003595 0.0003738 0.0003886 0.000404 0.0004199 0.0004364 0.0004535 0.0004712 0.0004895 0.0005085 0.0005282 0.0005486 0.0005698 0.0005916 0.0006143 0.0006377 0.000662 0.0006871 0.0007131 0.00074 0.0007679 0.0007967 0.0008265 0.0008573 0.0008892 0.0009221 0.0009562 0.0009915 0.001028 0.001066 0.001104 0.001145 0.001186 0.001229 0.001273 0.001319 0.001366 0.001415 0.001466 0.001518 0.001572 0.001627 0.001684 0.001743 0.001804 0.001867 0.001932 0.001999 0.002068 0.002139 0.002212 0.002288 0.002366 0.002446 0.002529 0.002614 0.002702 0.002793 0.002886 0.002982 0.003081 0.003183 0.003288 0.003396 0.003507 0.003622 0.00374 0.003861 0.003985 0.004114 0.004246 0.004381 0.004521 0.004664 0.004812 0.004963 0.005119 0.005279 0.005444 0.005613 0.005787 0.005966 0.006149 0.006337 0.006531 0.006729 0.006933 0.007142 0.007357 0.007577 0.007803 0.008035 0.008273 0.008517 0.008768 0.009025 0.009288 0.009558 0.009835 0.01012 0.01041 0.01071 0.01101 0.01132 0.01164 0.01197 0.01231 0.01265 0.01301 0.01337 0.01373 0.01411 0.0145 0.01489 0.0153 0.01571 0.01614 0.01657 0.01701 0.01747 0.01793 0.0184 0.01888 0.01938 0.01988 0.0204 0.02093 0.02146 0.02201 0.02257 0.02315 0.02373 0.02433 0.02494 0.02556 0.0262 0.02684 0.0275 0.02818 0.02886 0.02956 0.03028 0.03101 0.03175 0.0325 0.03327 0.03406 0.03486 0.03567 0.0365 0.03735 0.03821 0.03908 0.03998 0.04088 0.04181 0.04275 0.0437 0.04467 0.04566 0.04667 0.04769 0.04873 0.04979 0.05086 0.05196 0.05307 0.05419 0.05534 0.0565 0.05768 0.05888 0.0601 0.06134 0.06259 0.06387 0.06516 0.06647 0.0678 0.06915 0.07052 0.07191 0.07331 0.07474 0.07619 0.07765 0.07914 0.08064 0.08217 0.08371 0.08527 0.08686 0.08846 0.09008 0.09172 0.09338 0.09506 0.09677 0.09849 0.1002 0.102 0.1038 0.1056 0.1074 0.1092 0.1111 0.113 0.1148 0.1168 0.1187 0.1206 0.1226 0.1246 0.1266 0.1286 0.1307 0.1327 0.1348 0.1369 0.139 0.1411 0.1433 0.1455 0.1476 0.1498 0.152 0.1543 0.1565 0.1588 0.161 0.1633 0.1656 0.1679 0.1703 0.1726 0.175 0.1773 0.1797 0.1821 0.1845 0.1869 0.1894 0.1918 0.1942 0.1967 0.1992 0.2016 0.2041 0.2066 0.2091 0.2116 0.2141 0.2166 0.2191 0.2217 0.2242 0.2267 0.2293 0.2318 0.2343 0.2369 0.2394 0.242 0.2445 0.2471 0.2496 0.2521 0.2547 0.2572 0.2598 0.2623 0.2648 0.2673 0.2698 0.2723 0.2748 0.2773 0.2798 0.2823 0.2848 0.2872 0.2896 0.2921 0.2945 0.2969 0.2993 0.3017 0.304 0.3064 0.3087 0.311 0.3133 0.3156 0.3179 0.3201 0.3224 0.3246 0.3267 0.3289 0.331 0.3332 0.3352 0.3373 0.3394 0.3414 0.3434 0.3453 0.3473 0.3492 0.3511 0.3529 0.3547 0.3565 0.3583 0.36 0.3617 0.3634 0.365 0.3666 0.3682 0.3697 0.3712 0.3727 0.3741 0.3755 0.3768 0.3782 0.3794 0.3807 0.3819 0.3831 0.3842 0.3853 0.3863 0.3873 0.3883 0.3892 0.3901 0.3909 0.3917 0.3925 0.3932 0.3939 0.3945 0.3951 0.3957 0.3962 0.3966 0.3971 0.3974 0.3978 0.398 0.3983 0.3985 0.3986 0.3988 0.3988 0.3988 0.3988 0.3988 0.3986 0.3985 0.3983 0.398 0.3978 0.3974 0.3971 0.3966 0.3962 0.3957 0.3951 0.3945 0.3939 0.3932 0.3925 0.3917 0.3909 0.3901 0.3892 0.3883 0.3873 0.3863 0.3853 0.3842 0.3831 0.3819 0.3807 0.3794 0.3782 0.3768 0.3755 0.3741 0.3727 0.3712 0.3697 0.3682 0.3666 0.365 0.3634 0.3617 0.36 0.3583 0.3565 0.3547 0.3529 0.3511 0.3492 0.3473 0.3453 0.3434 0.3414 0.3394 0.3373 0.3352 0.3332 0.331 0.3289 0.3267 0.3246 0.3224 0.3201 0.3179 0.3156 0.3133 0.311 0.3087 0.3064 0.304 0.3017 0.2993 0.2969 0.2945 0.2921 0.2896 0.2872 0.2848 0.2823 0.2798 0.2773 0.2748 0.2723 0.2698 0.2673 0.2648 0.2623 0.2598 0.2572 0.2547 0.2521 0.2496 0.2471 0.2445 0.242 0.2394 0.2369 0.2343 0.2318 0.2293 0.2267 0.2242 0.2217 0.2191 0.2166 0.2141 0.2116 0.2091 0.2066 0.2041 0.2016 0.1992 0.1967 0.1942 0.1918 0.1894 0.1869 0.1845 0.1821 0.1797 0.1773 0.175 0.1726 0.1703 0.1679 0.1656 0.1633 0.161 0.1588 0.1565 0.1543 0.152 0.1498 0.1476 0.1455 0.1433 0.1411 0.139 0.1369 0.1348 0.1327 0.1307 0.1286 0.1266 0.1246 0.1226 0.1206 0.1187 0.1168 0.1148 0.113 0.1111 0.1092 0.1074 0.1056 0.1038 0.102 0.1002 0.09849 0.09677 0.09506 0.09338 0.09172 0.09008 0.08846 0.08686 0.08527 0.08371 0.08217 0.08064 0.07914 0.07765 0.07619 0.07474 0.07331 0.07191 0.07052 0.06915 0.0678 0.06647 0.06516 0.06387 0.06259 0.06134 0.0601 0.05888 0.05768 0.0565 0.05534 0.05419 0.05307 0.05196 0.05086 0.04979 0.04873 0.04769 0.04667 0.04566 0.04467 0.0437 0.04275 0.04181 0.04088 0.03998 0.03908 0.03821 0.03735 0.0365 0.03567 0.03486 0.03406 0.03327 0.0325 0.03175 0.03101 0.03028 0.02956 0.02886 0.02818 0.0275 0.02684 0.0262 0.02556 0.02494 0.02433 0.02373 0.02315 0.02257 0.02201 0.02146 0.02093 0.0204 0.01988 0.01938 0.01888 0.0184 0.01793 0.01747 0.01701 0.01657 0.01614 0.01571 0.0153 0.01489 0.0145 0.01411 0.01373 0.01337 0.01301 0.01265 0.01231 0.01197 0.01164 0.01132 0.01101 0.01071 0.01041 0.01012 0.009835 0.009558 0.009288 0.009025 0.008768 0.008517 0.008273 0.008035 0.007803 0.007577 0.007357 0.007142 0.006933 0.006729 0.006531 0.006337 0.006149 0.005966 0.005787 0.005613 0.005444 0.005279 0.005119 0.004963 0.004812 0.004664 0.004521 0.004381 0.004246 0.004114 0.003985 0.003861 0.00374 0.003622 0.003507 0.003396 0.003288 0.003183 0.003081 0.002982 0.002886 0.002793 0.002702 0.002614 0.002529 0.002446 0.002366 0.002288 0.002212 0.002139 0.002068 0.001999 0.001932 0.001867 0.001804 0.001743 0.001684 0.001627 0.001572 0.001518 0.001466 0.001415 0.001366 0.001319 0.001273 0.001229 0.001186 0.001145 0.001104 0.001066 0.001028 0.0009915 0.0009562 0.0009221 0.0008892 0.0008573 0.0008265 0.0007967 0.0007679 0.00074 0.0007131 0.0006871 0.000662 0.0006377 0.0006143 0.0005916 0.0005698 0.0005486 0.0005282 0.0005085 0.0004895 0.0004712 0.0004535 0.0004364 0.0004199 0.000404 0.0003886 0.0003738 0.0003595 0.0003458 0.0003325 0.0003197 0.0003073 0.0002954 0.000284 0.0002729 0.0002623 0.000252 0.0002421 0.0002326 0.0002234 0.0002146 0.0002061 0.0001979 0.00019 0.0001824 0.0001751 0.0001681 0.0001613 0.0001548 0.0001486 0.0001425 0.0001367 0.0001312 0.0001258 0.0001207 0.0001157 0.0001109 0.0001064 0.000102 9.774e-05 9.368e-05 8.978e-05 8.603e-05 8.243e-05 7.897e-05 7.565e-05 7.246e-05 6.94e-05 6.646e-05 6.363e-05 6.093e-05 5.833e-05 5.583e-05 5.344e-05 5.114e-05 4.894e-05 4.683e-05 4.48e-05 4.286e-05 4.1e-05 3.921e-05 3.75e-05 3.586e-05 3.428e-05 3.278e-05 3.133e-05 2.995e-05 2.862e-05 2.735e-05 2.614e-05 2.497e-05 2.385e-05 2.279e-05 2.176e-05 2.079e-05 1.985e-05 1.895e-05 1.809e-05 1.727e-05 1.649e-05 1.574e-05 1.502e-05 1.433e-05 1.367e-05 1.305e-05 1.244e-05 1.187e-05 1.132e-05 1.08e-05 1.029e-05 9.815e-06 9.357e-06 8.919e-06 8.501e-06 8.102e-06 7.721e-06 7.357e-06 7.009e-06 6.677e-06 6.361e-06 6.058e-06 5.769e-06 5.494e-06 5.231e-06 4.98e-06 4.741e-06 4.513e-06 4.295e-06 4.088e-06 3.89e-06 3.701e-06 3.521e-06 3.349e-06 3.186e-06 3.03e-06 2.881e-06 2.74e-06 2.605e-06 2.476e-06 2.354e-06 2.237e-06 2.126e-06 2.021e-06 1.92e-06 1.824e-06 1.733e-06 1.646e-06 1.564e-06 1.485e-06 1.41e-06 1.339e-06 1.271e-06 1.207e-06 1.145e-06 1.087e-06 1.032e-06 9.791e-07 9.29e-07 8.813e-07 8.361e-07 7.93e-07 7.521e-07 7.133e-07 6.764e-07 6.413e-07 6.08e-07 5.763e-07 5.463e-07 5.178e-07 4.907e-07
A type 1 error is rejecting the null hypothesis when H0 is actually true. We typically do not want to incorrectly reject H0 more than 5% of the time. This corresponds to a significance level of 0.05. Since there are 39 countries in Table 4 that summarizes survey results from 2005 to 2012 we will need to multiply 0.05 by 39 to estimate how many countries we would expect to detect a change in the atheism index simply by chance. the result is 1.95, or 2 countries.
0.05*39
expected change [1] 1.95
There are two unknown variablies in this question: p and n. When we do not have and estimate for p we follow the guideline that the margin of error is largest when p is 0.5. So we typically use this worst case estimate if no other estimate is available. The estimate must have a margin of error no greater than 1%. We use the formula ME = z*SE = 1,96 * sqrt(p(1-p)/n)) <=0.01. Based on the calculation we would need at least 9604 participants to ensure the sample proportion is within 0.01 of the true porportion with 95% confidence.
P <-0.5
Z.alpha <-1.96
ME <-0.01
N<- Z.alpha^2*P*(1-P)/ME^2
N
[1] 9604
IN this lab we covered the concepts of making proportion inferences for categorical data with confidence intervals, hypothesis, and Chi-Square distribution. Most of the theories have been covered in previous chapters such as how to computer the confidence intervals, perform hypothesis tests, and beware of type 1 error. We used Anova again to calculate critical values and learned that When only two factors are involved, ANOVA and the t-test result in the same conclusion.
Based on the critical values calculated by ANOVa and two sample t test we reject the null hypothesis that there is no difference in the means.
score <-c(19,17,23,22,17,16,27,25,32,28,31,26,23,24)
method=c(rep("LP",8),rep("LT",6))
compare=data.frame(score,method)
compare
score method
1 19 LP
2 17 LP
3 23 LP
4 22 LP
5 17 LP
6 16 LP
7 27 LP
8 25 LP
9 32 LT
10 28 LT
11 31 LT
12 26 LT
13 23 LT
14 24 LT
boxplot (score ~ method, data = compare)
summary(aov(score ~ method, data = compare))
Df Sum Sq Mean Sq F value Pr(>F)
method 1 149 148.6 9.65 0.0091 **
Residuals 12 185 15.4
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
landpscore <-c(19,17,23,22,17,16,27,25)
landtscore <-c(32,28,31,26,23,24)
t.test(landpscore,landtscore,mu = 0,)
Welch Two Sample t-test
data: landpscore and landtscore
t = -3.159, df = 11.52, p-value = 0.008619
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-11.145 -2.022
sample estimates:
mean of x mean of y
20.75 27.33
p5yrago <- c(17,20,29,43,36,43,45,19,49,49,35,16,23,33,44,44,28,29,39,22)
pnow <- c(10,39,37,27,12,41,24,26,28,26,32,32,21,12,40,42,22,19,35,12)
t.test(pnow,p5yrago,mu = 0, alternative="less", conf.level = .99, paired=TRUE)
Paired t-test
data: pnow and p5yrago
t = -2.258, df = 19, p-value = 0.01795
alternative hypothesis: true difference in means is less than 0
99 percent confidence interval:
-Inf 0.7854
sample estimates:
mean of the differences
-6.3
the critical value of P for the test is 0.01795
because the p-value is greater than 0.01 we fail to reject the null hypothesis.
The sample size is too samll to fit the condition for normal model for p1-p2. Therefore, I used paired t test to find the critical value of P. Because we do not want to make type 1 error a confidence interval of 99% is used. we fail to reject the the null hypothesis that there is no difference in house cost because the income level could be moving with the housing cost in a positive relation. A larger sample would be needed to evaluate the true relationship.