library(ggplot2)
library(dplyr)
library(statsr)
Make sure your data and R Markdown files are in the same directory. When loaded your data file will be called gss
. Delete this note when before you submit your work.
load("gss.Rdata")
The data is an extract of the General Social Survey (GSS) Cumulative File 1972-2012. The objective of the ongoing surveys is to monitor societal change and study the growing complexity of American society (link). The surveys are collected from simple random sampling from a target population of English-speaking, non-institutionallized persons 18 years of age or over (see GSS Codebook).
The data set is observations from a retrospective study, so while it is reasonable to make inferences regarding associations, the influence of confounding variables generally undermines any conclusions regarding causality.
There are some potential sources of bias in the surveys that may influence the results. The Pew Research Center (link) notes that the surveys used in the GSS can create context effects. For example, if onerous questions are posed early in an interview, the respondent may begin to offer answers that are likely to limit further questions in an effort to reduce the burden of the exercise. The Pew Research Center also conjectured that words may change meaning over time. For example, respondents may increasingly feel like online communication is distinct from in-person communication, so that a question about “discussions” may exclude conversations using social media.
This study uses the GSS data to explore the relationship between religion and political economy. Do individuals who identify as atheist or non-religious express significantly different views on the role of government in social and economic matters than people of religious persuasion? This research question touches on a larger question of the relationship between rationalism and individualism. Does the absence of an after-life and ultimate judge leave atheists feeling less concerned with social welfare?
NOTE: Insert code chunks as needed by clicking on the “Insert a new code chunk” button (green button with orange arrow) above. Make sure that your code is visible in the project you submit. Delete this note when before you submit your work.
The GSS includes two factor variables related to spirituality: relig
(respondent’s religious preference), and attend
(how often the respondent attends religious services). As shown below, there are 14 levels for the relig
variable. For this study, we will conveniently group them into a new factor variable is_relig
with two levels, Yes and No.
gss %>%
filter(year == 2012) %>%
count(`relig`)
## # A tibble: 14 x 2
## relig n
## <fctr> <int>
## 1 Protestant 916
## 2 Catholic 444
## 3 Jewish 28
## 4 None 387
## 5 Other 25
## 6 Buddhism 6
## 7 Hinduism 9
## 8 Other Eastern 5
## 9 Moslem/Islam 13
## 10 Orthodox-Christian 6
## 11 Christian 120
## 12 Native American 6
## 13 Inter-Nondenominational 2
## 14 <NA> 7
gss12 <- gss %>%
filter(year == 2012) %>%
mutate(is_relig = factor(ifelse(relig == "None", "no", "yes")))
table(gss12$is_relig)
##
## no yes
## 387 1580
prop.table(table(gss12$is_relig))
##
## no yes
## 0.1967463 0.8032537
In 2012, about 20% of respondents indicated they were non-religious, with the remaining 80% identifying with a major religion. Notice in the plot below that being religious and attending service are not the same - many religious people do not attend service, and many non-religious people do attend service.
ggplot(gss12, aes(x = attend, fill = is_relig)) +
ggtitle("Respondent service attendence in 2012 survey") +
xlab("") + ylab("Respondents") +
labs(fill = "Religious") +
geom_bar(position = position_dodge()) +
scale_x_discrete(labels = function(attend) lapply(strwrap(attend, width = 10, simplify = FALSE), paste, collapse="\n"))
This study considers the responses to two socio-economic questions. The GSS variable and survey questions along with the tabulated results are:
natsoc
: We are faced with many problems in this country, none of which can be solved easily or inexpensively. I’m going to name some of these problems, and for each one I’d like you to tell me whether you think we’re spending too much money on it, too little money, or about the right amount. Social Security.with(gss12, table(natsoc, is_relig))
## is_relig
## natsoc no yes
## Too Little 187 858
## About Right 140 541
## Too Much 34 111
homosex
: What about sexual relations between two adults of the same sex?with(gss12, table(homosex, is_relig))
## is_relig
## homosex no yes
## Always Wrong 42 523
## Almst Always Wrg 4 33
## Sometimes Wrong 18 64
## Not Wrong At All 161 392
## Other 0 0
Finally, the study considers the relationship between spirituality and family income coninc
. This continuous numeric variable is the total family income and is therefore only an indirect measure of the income of the respondent. However, it may provide some insight into the relationship between religion and wealth (although we cannot conclude anything about causality). The box plot below suggests both groups have about equal IQRs, but that non-religious persons may have slightly higher median incomes.
gss12 %>%
filter(!is.na(coninc), !is.na(is_relig)) %>%
ggplot(aes(x = is_relig, y = coninc)) +
ggtitle("Family Income in 2012 survey") +
xlab("Religious") + ylab("Constant Dollars") +
geom_boxplot()
Question 1 concerns Social Security Spending. Again, the question posed to respondents was:
We are faced with many problems in this country, none of which can be solved easily or inexpensively. I’m going to name some of these problems, and for each one I’d like you to tell me whether you think we’re spending too much money on it, too little money, or about the right amount. Social Security.
A bar chart reveals that regardless of religiosity, repondents in the 2012 GSS survey overwhelming felt the U.S. spends too little on Social Security. However, because so many more respondents are religious, it is difficult to determine at a glance whether the groups differ.
gss12_natsoc <- gss12 %>%
filter(!is.na(natsoc), !is.na(is_relig))
with(gss12_natsoc, table(natsoc, is_relig))
## is_relig
## natsoc no yes
## Too Little 187 858
## About Right 140 541
## Too Much 34 111
ggplot(gss12, aes(x = natsoc, fill = is_relig)) +
ggtitle("Social Security Spending") +
xlab("") + ylab("Respondents") +
labs(fill = "Religious") +
geom_bar(position = position_dodge()) +
scale_x_discrete(labels = function(natsoc) lapply(strwrap(natsoc, width = 10, simplify = FALSE), paste, collapse="\n"))
Do religious and non-religious repondents differ in their attitudes about whether the U.S. spends too little on Social Security? Conduct a hypothesis test using the two-sample proportion test. This test applies if three conditions are met:
Our null hypothesis is H0: the proportions of individuals favoring more spending on Social Security is the same regardless of religious identification (religious vs. non-religious). The alternative hypothesis is that the proportions differ by religious identification.
gss12_natsoc <- gss12_natsoc %>%
mutate(amt = ifelse(natsoc == "Too Little", "Too Little", "Other"))
prop.test(table(gss12_natsoc$is_relig, gss12_natsoc$amt), correct = FALSE)
##
## 2-sample test for equality of proportions without continuity
## correction
##
## data: table(gss12_natsoc$is_relig, gss12_natsoc$amt)
## X-squared = 2.9784, df = 1, p-value = 0.08438
## alternative hypothesis: two.sided
## 95 percent confidence interval:
## -0.007073689 0.107486450
## sample estimates:
## prop 1 prop 2
## 0.4819945 0.4317881
The p-value = .08 is greater than the alpha = .05 level of significance, so do not reject the null hypothesis. There is not sufficient evidence to conclude that religious people are more supportive of spending more money on Social Security than non-religious people. This may be an indication that attitudes on social welfare are not driven by moral considerations inculcated by religious institutions.
Question 2 concerns attitudes regarding homosexuality. Again, the question posed to respondents was:
What about sexual relations between two adults of the same sex?
A bar chart reveals that non-religious individuals appear to have no issues with homosexuality. Religious individuals, on the other hand, often are strongly opposed.
gss12_homosex <- gss12 %>%
filter(!is.na(homosex), !is.na(is_relig))
with(gss12_homosex, table(homosex, is_relig))
## is_relig
## homosex no yes
## Always Wrong 42 523
## Almst Always Wrg 4 33
## Sometimes Wrong 18 64
## Not Wrong At All 161 392
## Other 0 0
ggplot(gss12_homosex, aes(x = homosex, fill = is_relig)) +
ggtitle("Homosexual Relations") +
xlab("") + ylab("Respondents") +
labs(fill = "Religious") +
geom_bar(position = position_dodge()) +
scale_x_discrete(labels = function(natsoc) lapply(strwrap(natsoc, width = 10, simplify = FALSE), paste, collapse="\n"))
Do religious and non-religious repondents differ in their attitudes about whether homosexual relations are okay? Again, conduct a hypothesis test using the two-sample proportion test. This test applies if three conditions are met:
Our null hypothesis is H0: the proportions of respondents who believe homosexual relations are not wrong at all is the same for religious and non-religious respondents. The alternative hypothesis is that the proportions differ.
gss12_homosex <- gss12_homosex %>%
mutate(att = ifelse(homosex == "Not Wrong At All", "Not Wrong At All", "Other"))
prop.test(table(gss12_homosex$is_relig, gss12_homosex$att), correct = FALSE)
##
## 2-sample test for equality of proportions without continuity
## correction
##
## data: table(gss12_homosex$is_relig, gss12_homosex$att)
## X-squared = 80.212, df = 1, p-value < 2.2e-16
## alternative hypothesis: two.sided
## 95 percent confidence interval:
## 0.2620539 0.3943536
## sample estimates:
## prop 1 prop 2
## 0.7155556 0.3873518
The p-value 2.2e-16 is much less than the alpha = .05 level of significance, so reject the null hypothesis and conclude that religious people and non-religious people hold differing attitudes regarding homosexual relations. In this case it appears likely that non-religious people have a more hands-off approach to sexual behavior. It may be that religious rules are explicit about such matters and respondents express the religious rule, not their personal attitude. Or it may be that disagreement with religious rules alienate otherwise spiritual persons.
Finally, the study considers the relationship between spirituality and family income coninc
. This continuous numeric variable is the total family income and is therefore only an indirect measure of the income of the respondent.
Perform a one-sample t-test to estimate a confidence interval of family income for religious individuals and non-religious individuals.
First check conditions for the sampling distribution of x:
gss12_coninc <- gss12 %>% filter(!is.na(coninc), !is.na(is_relig))
qqnorm(gss12_coninc$coninc)
qqline(gss12_coninc$coninc)
It appears that our sample violates the normality condition because it skews significantly to the right. However, we will continue with the analysis.
Construct a 95% confidence interval for family income for religious and non-religious individuals.
L = gss12$is_relig == "yes"
inc.relig = gss12[L,]$coninc
inc.nonrelig = gss12[!L,]$coninc
t.test(inc.relig)
##
## One Sample t-test
##
## data: inc.relig
## t = 38.893, df = 1404, p-value < 2.2e-16
## alternative hypothesis: true mean is not equal to 0
## 95 percent confidence interval:
## 44773.52 49529.88
## sample estimates:
## mean of x
## 47151.7
t.test(inc.nonrelig)
##
## One Sample t-test
##
## data: inc.nonrelig
## t = 19.446, df = 347, p-value < 2.2e-16
## alternative hypothesis: true mean is not equal to 0
## 95 percent confidence interval:
## 47918.84 58703.08
## sample estimates:
## mean of x
## 53310.96
The 95% confidence interval of family income for religious individuals is $47,151.70 +/- $2,378.18.
The 95% confidence interval of family income for non-religious individuals is $53,310.96 +/- $5,392.12.
Are these family incomes significantly different? Peform a two-sample mean comparison test.
t.test(inc.relig, inc.nonrelig)
##
## Welch Two Sample t-test
##
## data: inc.relig and inc.nonrelig
## t = -2.0547, df = 491.34, p-value = 0.04044
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -12049.0119 -269.5026
## sample estimates:
## mean of x mean of y
## 47151.70 53310.96
The answer is yes at the alpha = .05 level of significance. So we reject H0 that religious and non religious people have identical family incomes. This may be an indication that non-religious people are more occupied with material concerns while religious people have a relatively greater focus on non-material issues.