To create this survey, I used Google Forms. I posted it to my facebook page asking anyone over the age of 21 to take it if they had the time to. I ended up having 97 participants take the survey. The survey I created asked participants basic demographic information as well as questions about alcohol consumption effecting negative feelings and emotions. I asked participants to answer how many alcoholic beverages they drink on average per week. The options for this question were 0-10. I then asked participants if they believed that the consumption of alcoholic beverages alleviated feelings of anxiety, sadness, stress, and anger. To answer these questions, participants chose a number from 1-5 on a likert scale. The left side of the likert scale, or the number 1, represented strongly disagreeing. On the other side of the scale was the number 5 which represented strongly agreeing with the statement. In the middle of the likert scale was the number 3 which represented being neutral on the question. With that being said, the number 2 and 4 on the scale represented disagreeing and agreeing with the question being asked. My hypothesis is that the more an individual drinks, the more they agree that alcohol alleviates negative emotions and feelings. I based my hypothesis on a personal experience that I had regarding growing up with alcohol addiction present in the home. Now that both of my parents are in recovery, they have told me that they used to drink to try to cope with negative feelings and emotions. I decided to test whether or not a sample from the general population may feel the same way. It is important to note that after uploading my data into RStudio, missing data were labeled NA. This meant that RStudio already recognized it as missing data, and I did not have to translate it. There were 3 participants who answered “no” to the question “Do you drink alcohol?” and did not answer the remaining questions. Like stated above, this data were entered in RStudio as NA. In contrast, other participants answered “no” to “Do you drink alcohol?” but answered the rest of the survey questions so these data were not labeled NA.

  1. The following shows how the results from the survey were uploaded to RStudio along with the renaming and recoding of variables. The last part shows a summary of the survey data.
library(tidyverse)
library(readxl)

https://docs.google.com/spreadsheets/d/1OlQ5AWXBJTEq8bcoZIyT-7regVt4SnCNVxXNH5bbc9o/edit?usp=sharing

my_survey <- read_csv("https://docs.google.com/spreadsheets/d/1OlQ5AWXBJTEq8bcoZIyT-7regVt4SnCNVxXNH5bbc9o/export?format=csv")
my_survey <- my_survey %>%
  rename(age = "How old are you?") %>%
  rename(gender = "What is your gender?") %>%
  rename(location = "Do you currently live in a rural or urban area?") %>%
  rename(consumption = "On average, how many alcoholic beverages do you consume in a week?") %>%
  rename(anxiety = "Does the consumption of alcohol alleviate your feelings of anxiety?") %>%
  rename(sadness = "Does the consumption of alcohol alleviate your feelings of sadness?") %>%
  rename(stress = "Does the consumption of alcohol alleviate your feelings of stress?") %>%
  rename(anger = "Does the consumption of alcohol alleviate your feelings of anger?") %>%
  rename(drinker = "Do you currently drink alcohol?")
my_survey <- my_survey %>%
  mutate(gender = recode(gender,
                         "Male" = 1,
                         "Female" = 2)) %>%
  mutate(location = recode(location,
                           "Urban" = 1,
                           "Rural" = 2)) 
my_survey %>%
  summary()
  Timestamp              age            gender         location    
 Length:97          Min.   :21.00   Min.   :1.000   Min.   :1.000  
 Class :character   1st Qu.:23.00   1st Qu.:2.000   1st Qu.:1.000  
 Mode  :character   Median :26.00   Median :2.000   Median :2.000  
                    Mean   :32.62   Mean   :1.819   Mean   :1.613  
                    3rd Qu.:37.00   3rd Qu.:2.000   3rd Qu.:2.000  
                    Max.   :78.00   Max.   :2.000   Max.   :2.000  
                    NA's   :7       NA's   :3       NA's   :4      
   drinker           consumption        anxiety         sadness     
 Length:97          Min.   : 0.000   Min.   :1.000   Min.   :1.000  
 Class :character   1st Qu.: 1.000   1st Qu.:2.000   1st Qu.:2.000  
 Mode  :character   Median : 2.000   Median :3.000   Median :2.000  
                    Mean   : 3.255   Mean   :2.871   Mean   :2.468  
                    3rd Qu.: 4.000   3rd Qu.:4.000   3rd Qu.:3.000  
                    Max.   :10.000   Max.   :5.000   Max.   :5.000  
                    NA's   :3        NA's   :4       NA's   :3      
     stress          anger     
 Min.   :1.000   Min.   :1.00  
 1st Qu.:2.000   1st Qu.:1.00  
 Median :3.000   Median :2.00  
 Mean   :2.979   Mean   :2.17  
 3rd Qu.:4.000   3rd Qu.:3.00  
 Max.   :5.000   Max.   :5.00  
 NA's   :3       NA's   :3     

The summary of the survey provides useful information about the general demographics of the sample. The sample size was 97 participants. The average age of the sample was about 33 years old and the average number of alcoholic beverages one consumed in one week was about 3. The sample was overwhelmingly female consisting of only 14 participants being male. Lastly, 61.5% of participants reported living in a rural area and 38.5% reported living in an urban area.

  1. The following is a correlation test to determine if there is a statistically significant relationship between how much alcohol an individual consumes in one week and how likely they are to agree that alcohol alleviates anxiety. A graph of this information follows.
cor.test(my_survey$consumption, my_survey$anxiety)

    Pearson's product-moment correlation

data:  my_survey$consumption and my_survey$anxiety
t = 1.49, df = 91, p-value = 0.1397
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
 -0.05098392  0.34712269
sample estimates:
      cor 
0.1543272 
my_survey %>% 
  drop_na(consumption, anxiety) %>%
  ggplot(aes(consumption, anxiety)) +
  geom_point() +
  theme_minimal() +                                            
  geom_smooth(formula = y~x, method = lm, se = FALSE) +        
  labs(title = "Relationship Between Alcohol Consumption and Anxiety",      
       x = "Drinks per week",
       y = "Alleviation of anxiety")

The correlation between consumption of alcohol and alleviation of anxiety is not statistically significant, r(91) = 0.15, ns. The graph above shows that the more alcohol one consumes, the more they agree that it alleviates feelings of anxiety. Remember, the likert scale that participants used to answer this question was 1-5 with 1 meaning they strongly disagree, 3 meaning they are neutral, and 5 meaning they strongly agree. Although the relationship between consumption of alcohol and alleviation of anxiety exists, it is not statistically significant as proven by the correlation test results.

  1. The following is a correlation test to determine if there is a statistically significant relationship between how much alcohol an individual consumes in one week and how likely they are to agree that alcohol alleviates sadness. A graph of this information follows.
cor.test(my_survey$consumption, my_survey$sadness)

    Pearson's product-moment correlation

data:  my_survey$consumption and my_survey$sadness
t = 0.99797, df = 92, p-value = 0.3209
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
 -0.1012536  0.2998168
sample estimates:
      cor 
0.1034865 
my_survey %>% 
  drop_na(consumption, sadness) %>%                                  
  ggplot(aes(consumption, sadness)) +
  geom_point() +
  theme_minimal() +                                            
  geom_smooth(formula = y~x, method = lm, se = FALSE) +        
  labs(title = "Relationship Between Alcohol Consumption and Sadness",      
       x = "Drinks per week",
       y = "Alleviation of sadness")

The correlation between consumption of alcohol and alleviation of sadness is not statistically significant, r(92) = 0.10, ns. The graph above shows that the more alcohol one consumes, the more they agree that it alleviates feelings of sadness. Remember, the likert scale that participants used to answer this question was 1-5 with 1 meaning they strongly disagree, 3 meaning they are neutral, and 5 meaning they strongly agree. Although the relationship between consumption of alcohol and alleviation of sadness exists, it is not statistically significant as proven by the correlation test results.

  1. The following is a correlation test to determine if there is a statistically significant relationship between how much alcohol an individual consumes in one week and how likely they are to agree that alcohol alleviates stress. A graph of this information follows.
cor.test(my_survey$consumption, my_survey$stress)

    Pearson's product-moment correlation

data:  my_survey$consumption and my_survey$stress
t = 2.3841, df = 92, p-value = 0.01918
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
 0.04058317 0.42315222
sample estimates:
      cor 
0.2412166 
my_survey %>% 
  drop_na(consumption, stress) %>%                                  
  ggplot(aes(consumption, stress)) +
  geom_point() +
  theme_minimal() +                                            
  geom_smooth(formula = y~x, method = lm, se = FALSE) +        
  labs(title = "Relationship Between Alcohol Consumption and Stress",      
       x = "Drinks per week",
       y = "Alleviation of Stress")

The correlation between consumption of alcohol and alleviation of stress is statistically significant, r(92) = 0.24, p < 0.05. The graph above shows that the more alcohol one consumes, the more they agree that it alleviates feelings of stress. Remember, the likert scale that participants used to answer this question was 1-5 with 1 meaning they strongly disagree, 3 meaning they are neutral, and 5 meaning they strongly agree. The correlation between consumption of alcohol and alleviation of stress can be seen by the positive slope on the scatterplot.

  1. The following is a correlation test to determine if there is a statistically significant relationship between how much alcohol an individual consumes in one week and how likely they are to agree that alcohol alleviates anger. A graph of this information follows.
cor.test(my_survey$consumption, my_survey$anger)

    Pearson's product-moment correlation

data:  my_survey$consumption and my_survey$anger
t = -1.0075, df = 92, p-value = 0.3163
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
 -0.3007167  0.1002746
sample estimates:
       cor 
-0.1044648 
my_survey %>% 
  drop_na(consumption, anger) %>%                                  
  ggplot(aes(consumption, anger)) +
  geom_point() +
  theme_minimal() +                                            
  geom_smooth(formula = y~x, method = lm, se = FALSE) +        
  labs(title = "Relationship Between Alcohol Consumption and Anger",      
       x = "Drinks per week",
       y = "Allevaition of anger")

The correlation between consumption of alcohol and alleviation of anger is not statistically significant, r(92) = -0.10, ns. The correlation between alcohol consumption and alleviation of anger is opposite of what was found on the previous 3 emotions. In this relationship, the more alcohol an individual consumes, the less they agree that alcohol alleviates anger. Remember, the likert scale that participants used to answer this question was 1-5 with 1 meaning they strongly disagree, 3 meaning they are neutral, and 5 meaning they strongly agree. This is shown by the negative slope on the above scatterplot.

The findings from this survey do show a relationship between alcohol consumption and alleviation of negative feelings. For the feelings of anxiety and sadness, the more alcohol and individual consumed in one week, the more they agreed that alcohol alleviated those feelings. However, both of these relationships were not statistically significant. In contrast, the relationship between consumption of alcoholic beverages per week and alleviation of anger was opposite of the other findings. The more alcohol an individual consumed per week, the less they agreed that it alleviates feelings of anger. Lastly, the relationship between consumption of alcohol and alleviation of stress was the only finding that was statistically significant. The more drinks an individual consumed in a one week period, the more likely they were to agree that alcohol alleviates feelings of stress.

If I were to do this survey again, I would do a few things differently. First, I would allow the participants to type in how many alcoholic beverages they consume in one week instead of having multiple choices for them to choose from. Originally, I had the choices be 1-2, 2-3, 3-4 and so on up to 10 drinks per week. For data interpretation purposes, I had to change participants answers to the lower number that they chose. For example, if a participant chose 1-2, there answer was changed to 1. With that being said, if they could of typed in their own answer, the results may have been different. Furthermore, I would like to do this survey again but ask participants if they believe alcohol alleviates their positive emotions (happiness, hope, and excitement) since alcohol is afterall a depressant. Lastly, I would try my best to get a more diverse sample from the general population.

LS0tCnRpdGxlOiAiU3VydmV5IgpvdXRwdXQ6IGh0bWxfbm90ZWJvb2sKLS0tCgpUbyBjcmVhdGUgdGhpcyBzdXJ2ZXksIEkgdXNlZCBHb29nbGUgRm9ybXMuIEkgcG9zdGVkIGl0IHRvIG15IGZhY2Vib29rIHBhZ2UgYXNraW5nIGFueW9uZSBvdmVyIHRoZSBhZ2Ugb2YgMjEgdG8gdGFrZSBpdCBpZiB0aGV5IGhhZCB0aGUgdGltZSB0by4gSSBlbmRlZCB1cCBoYXZpbmcgOTcgc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