Codebook Pdf: https://www.datafiles.samhsa.gov/sites/default/files/field-uploads-protected/studies/NSDUH-2021/NSDUH-2021-datasets/NSDUH-2021-DS0001/NSDUH-2021-DS0001-info/NSDUH-2021-DS0001-info-codebook.pdf

Research Question:

Is alcohol consumption associated with school absenteeism?

What is the purpose of the research?

The purpose of this study to measure the prevalence and correlates of alcohol use and school attendance in the United States.

What is the outcome variable?

EDUSKPCOM the combined number of days school was missed from skipping.

What are the predictors?

ALCYRTOT = Total number of days alcohol was used in the past 12 months. This is the predictor variable of interest. CATAG7 = This represents the age category of the respondents. NEWRACE2 = This represents the race of the respondents. IRSEX = This represents the gender of the respondents

DATA When was it collected?

This data set was collected in the year 2021.

How was it collected?

Data was collected by interview and web-based interviews surveys.

How many observations and variables are there?

The 2021 NSDUH contains information on 2,988 variables and 58,034 observations.

How were the outcome and predictors measured? (data types, categories, values)

EDUSKPCOM This is a numeric variable. It represents combined number of days respondents missed school from skipping and it is measured as follows: RANGE = 0 - 30, 94 = DON’T KNOW, 97 = REFUSED, 98 = BLANK (NO ANSWER), 99 = LEGITIMATE SKIP.

ALCYRTOT This is a numeric variable. It is measured as follows: RANGE = 1 - 365, 985 = BAD DATA Logically assigned, 991 = NEVER USED ALCOHOL, 993 = DID NOT USE ALCOHOL IN THE PAST 12 MOS, 994 = DON’T KNOW, 997 = REFUSED, 998 = BLANK (NO ANSWER)

CATAG7 This represents the age of the respondents. It is a factor type and measured as follows 1 = 12-13 Years Old, 2 = 14-15 Years Old, 3 = 16-17 Years Old, 4 = 18-20 Years Old, 5 = 21-25 Years Old, 6 = 26-34 Years Old, 7 = 35 or Older.

NEWRACE2 This is a factor variable and it represents the race of the respondents. It is measured as follows: 1 = NonHisp White, 2 = NonHisp Black/Afr Am, 3 = NonHisp Native Am/AK Native, 4 = NonHisp Native HI/Other Pac Isl, 5 = NonHisp Asian, 6 = NonHisp more than one race, 7 = Hispanic.

IRSEX This represents the gender of the respondents, it is a factor variable and measured as follows: 1 = Male, 2 = Female

knitr::opts_chunk$set(echo = TRUE)
library(package = "tidyverse")
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.2     ✔ readr     2.1.4
## ✔ forcats   1.0.0     ✔ stringr   1.5.0
## ✔ ggplot2   3.4.3     ✔ tibble    3.2.1
## ✔ lubridate 1.9.2     ✔ tidyr     1.3.0
## ✔ purrr     1.0.2     
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(package = "haven")
library(package = "gghalves")
library(package = "table1")
## 
## Attaching package: 'table1'
## 
## The following objects are masked from 'package:base':
## 
##     units, units<-
library(package = "descr")
library(package = "labelled")

Import NSDUH Data

summary(cars)
##      speed           dist       
##  Min.   : 4.0   Min.   :  2.00  
##  1st Qu.:12.0   1st Qu.: 26.00  
##  Median :15.0   Median : 36.00  
##  Mean   :15.4   Mean   : 42.98  
##  3rd Qu.:19.0   3rd Qu.: 56.00  
##  Max.   :25.0   Max.   :120.00
NSDUH.2021 <- load("C:/Users/demmy/Desktop/Checkpoint1/NSDUH_2021.RData")

Data Cleaning

# Clean School Skipped,Frequent alcohol use, age, race, and gender variables
NSDUH.2021 <- PUF2021_100622 %>%
  select (eduskpcom, alcyrtot, CATAG7, NEWRACE2, irsex)
  
# Summarize condensed data
summary(NSDUH.2021)
##    eduskpcom        alcyrtot         CATAG7        NEWRACE2         irsex      
##  Min.   : 0.00   Min.   :  1.0   Min.   :1.00   Min.   :1.000   Min.   :1.000  
##  1st Qu.:98.00   1st Qu.: 36.0   1st Qu.:4.00   1st Qu.:1.000   1st Qu.:1.000  
##  Median :99.00   Median :180.0   Median :6.00   Median :1.000   Median :2.000  
##  Mean   :78.69   Mean   :454.2   Mean   :5.34   Mean   :2.615   Mean   :1.545  
##  3rd Qu.:99.00   3rd Qu.:991.0   3rd Qu.:7.00   3rd Qu.:5.000   3rd Qu.:2.000  
##  Max.   :99.00   Max.   :998.0   Max.   :7.00   Max.   :7.000   Max.   :2.000
NSDUH21_clean <- NSDUH.2021 %>%
  mutate(eduskpcom = as.numeric(eduskpcom)) %>%
  mutate(eduskpcom = ifelse(eduskpcom == 94, 0, eduskpcom)) %>%
  mutate(eduskpcom = ifelse(eduskpcom == 97, 0, eduskpcom)) %>%
  mutate(eduskpcom = na_if(x = eduskpcom, 98)) %>%
  mutate(eduskpcom = na_if(x = eduskpcom, 99)) %>%
  mutate(alcyrtot = as.numeric(alcyrtot)) %>%
  mutate(alcyrtot = ifelse(alcyrtot == 991 , 0, alcyrtot)) %>%
  mutate(alcyrtot = ifelse(alcyrtot == 993 , 0, alcyrtot)) %>%
  mutate(alcyrtot = na_if(x= alcyrtot, 998 )) %>%
  mutate(alcyrtot = na_if(x= alcyrtot, 997 )) %>%
  mutate(alcyrtot = na_if(x= alcyrtot, 994 )) %>%
  mutate(alcyrtot = na_if(x= alcyrtot, 985 )) %>%
  
  mutate(CATAG7 = recode_factor(CATAG7,
                                `1` = "12-13", 
                                `2` = "14-15", 
                                `3` = "16-17", 
                                `4` = "18-20", 
                                `5` = "21-25", 
                                `6` = "26-34", 
                                `7` = "35 or Older")) %>%
  mutate(NEWRACE2 = recode_factor(NEWRACE2,
                                  `1` = "NonHisp White", 
                                  `2` = "NonHisp Black/Afr Am", 
                                  `3` = "NonHisp Native Am/AK Native", 
                                  `4` = "NonHisp Native HI/Other Pac Isl", 
                                  `5` = "NonHisp Asian", 
                                  `6` = "NonHisp more than one race", 
                                  `7` = "Hispanic")) %>%
  mutate(IRSEX = recode_factor(irsex,
                               `1` = "Male", 
                               `2` = "Female")) %>%
  rename(Daysskippedfromsch = eduskpcom) %>%
  rename(Freqalcoholuse = alcyrtot) %>%
  rename(Age = CATAG7) %>%
  rename(Race = NEWRACE2)%>%
  rename(Gender = irsex)

Select and compute appropriate descriptive statistics for each variable including the outcome and predictor variables

Plotting graph

NSDUH21_clean$Truancy <- cut(NSDUH21_clean$Daysskippedfromsch, breaks = c(-Inf, 15, Inf), labels = c("Low Truancy", "High Truancy"))

NSDUH21_clean %>%
  drop_na() %>%
  ggplot(aes(x = Truancy)) +
  geom_bar(aes(y = 100 * (..count..) / sum(..count..)), fill = "skyblue", color = "black") +
  theme_minimal() +
  labs(y = "Percentage of Participants",
       x = "Truancy",
       title = "Distribution of Truancy Levels") +
  coord_flip()
## Warning: The dot-dot notation (`..count..`) was deprecated in ggplot2 3.4.0.
## ℹ Please use `after_stat(count)` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.

Interpretation Description of the Truancy variable recoded from days missed from skipping variable. A considerably higher percentage of participants had low level of truancy while less than one percent had high truancy. The “High Truancy” category represents those respondents who skipped school on 16 or more days.

NSDUH21_clean %>%
  ggplot(aes(x = Freqalcoholuse)) +
  geom_histogram(bins = 30, fill = "skyblue", color = "black", alpha = 0.7) +
  theme_minimal() +
  labs(y = "Number of Participants",
       x = "Days Alcohol was Used",
       title = "Distribution of Total Number of Days Alcohol was Used in the Past 12 Months")
## Warning: Removed 390 rows containing non-finite values (`stat_bin()`).

Interpretation Description of the number of days alcohol was used in the past 12 months variable. The distribution is right-skewed, indicating that a significant portion of participants reported a lower frequency of alcohol use.

NSDUH21_clean %>%
  ggplot(aes(x = factor(Age, levels = c("12-13", "14-15", "16-17", "18-20", "21-25", "26-34", "35 or Older")))) +
  geom_bar(aes(y = 100 * (..count..) / sum(..count..)), fill = "skyblue", color = "black") +
  theme_minimal() +
  labs(y = "Percentage of Participants",
       x = "Age of Participants",
       title = "Age Distribution of Respondents") +
  coord_flip()

Interpretation The age group 35 or older had the highest proportion of respondents, followed by 26-34, while the 16-17 age group had the least proportion of respondents.

NSDUH21_clean %>%
  ggplot(aes(x = factor(Race, levels = c("NonHisp White", "NonHisp Black/Afr Am", "NonHisp Native Am/AK Native", "NonHisp Native HI/Other Pac Isl", "NonHisp Asian", "NonHisp more than one race", "Hispanic")))) +
  geom_bar(aes(y = 100 * (..count..) / sum(..count..)), fill = "skyblue", color = "black") +
  theme_minimal() +
  labs(y = "Percentage of Participants",
       x = "Race of Participants",
       title = "Distribution of Race in the Respondents") +
  coord_flip()

Interpretation Majority of participants were Non-Hispanic White, followed by Hispanic, and then Non-Hispanic Blacks. Non-Hispanic Native Hawaiians/Other Pacific Islander had the least proportion of respondents.

NSDUH21_clean %>%
  mutate(Gender = factor(Gender, labels = c("Male", "Female"))) %>% 
  ggplot(aes(x = Gender, y = 100*(..count..)/sum(..count..))) +
 geom_bar(aes(fill = factor(Gender)), position = "dodge") +
  scale_fill_manual(values = c("skyblue", "pink")) +  # Specify colors for Male and Female
  theme_minimal() +
  labs(y = "Percentage of participants",
       x = "Gender",
       title = "Distribution of gender in the Respondents")

Interpretation Majority of participants were female.

NSDUH21_table <- NSDUH21_clean[!is.na(NSDUH21_clean$Truancy), ]

# Label the variables in the new data frame
label(NSDUH21_table$Truancy) <- "Combined number of days respondents missed school from skipping"
label(NSDUH21_table$Freqalcoholuse) <- "Total number of days alcohol was used in the past 12 months"
label(NSDUH21_table$Age) <- "Age Distribution of Respondents"
label(NSDUH21_table$Race) <- "The race of the respondents"
label(NSDUH21_table$Gender) <- "The gender of the respondents"

# Create the table1 summary table using the new data frame
my_table <- table1(
  ~ Freqalcoholuse + Age + Race + factor(Gender, levels = c(1, 2), labels = c("Male", "Female")) | Truancy, 
  render.continuous = c(. = "median (IQR)"),
  data = NSDUH21_table
)

# Print the summary table
my_table
Low Truancy
(N=11992)
High Truancy
(N=90)
Overall
(N=12082)
Total number of days alcohol was used in the past 12 months
median (IQR) 0 (5.00) 0 (5.00) 0 (5.00)
Missing 121 (1.0%) 1 (1.1%) 122 (1.0%)
Age Distribution of Respondents
12-13 2517 (21.0%) 18 (20.0%) 2535 (21.0%)
14-15 2555 (21.3%) 26 (28.9%) 2581 (21.4%)
16-17 2447 (20.4%) 20 (22.2%) 2467 (20.4%)
18-20 2049 (17.1%) 14 (15.6%) 2063 (17.1%)
21-25 1622 (13.5%) 8 (8.9%) 1630 (13.5%)
26-34 453 (3.8%) 2 (2.2%) 455 (3.8%)
35 or Older 349 (2.9%) 2 (2.2%) 351 (2.9%)
The race of the respondents
NonHisp White 6164 (51.4%) 42 (46.7%) 6206 (51.4%)
NonHisp Black/Afr Am 1580 (13.2%) 14 (15.6%) 1594 (13.2%)
NonHisp Native Am/AK Native 108 (0.9%) 1 (1.1%) 109 (0.9%)
NonHisp Native HI/Other Pac Isl 30 (0.3%) 1 (1.1%) 31 (0.3%)
NonHisp Asian 813 (6.8%) 4 (4.4%) 817 (6.8%)
NonHisp more than one race 667 (5.6%) 8 (8.9%) 675 (5.6%)
Hispanic 2630 (21.9%) 20 (22.2%) 2650 (21.9%)
factor(Gender, levels = c(1, 2), labels = c("Male", "Female"))
Male 5744 (47.9%) 35 (38.9%) 5779 (47.8%)
Female 6248 (52.1%) 55 (61.1%) 6303 (52.2%)

Interpretation Description of Table 1: A vast majority (99.3%) of the respondents fall into the Low Truancy category. The median number of days alcohol was used in the past year is zero for both groups, indicating low overall alcohol use among respondents. The age distribution across levels of truancy is relatively even for younger age groups but decreases in older age categories. Racially, Non-Hispanic Whites form the majority in both truancy categories (51.4% vs 46.7%), followed by Hispanics and Non-Hispanic Blacks. The gender distribution has more females across truancy levels (52.1% vs 61.1%).

Inferential Statistics

Grouping of gender by truancy.

NSDUH21_clean %>% 
  drop_na() %>%
  mutate(Gender = factor(Gender, labels = c("Male", "Female"))) %>% 
  group_by(Gender, Truancy) %>% 
  count() %>% 
  group_by(Gender) %>% 
  mutate(perc.Gender = 100 * n / sum(n)) %>% 
  ggplot(aes(x = Gender, y = perc.Gender, fill = Truancy)) +
  geom_col(position = "dodge") + 
  theme_minimal() +
  labs(x = "Participant Gender",
       y = "Percentage",
       fill = "Truancy") +
  coord_flip()

Interpretation A higher proportion of females than males fell in the high truancy category

Hypothesis

H0: There is no relationship between Gender and Truancy.

HA: There is a relationship between Gender and Truancy.

CrossTable(y = NSDUH21_clean$Truancy,
           x = NSDUH21_clean$Gender,
           chisq = TRUE,
           expected = TRUE,
           sresid = TRUE,
           prop.c = FALSE,
           prop.t = FALSE,
           prop.chisq = FALSE)
##    Cell Contents 
## |-------------------------|
## |                       N | 
## |              Expected N | 
## |           N / Row Total | 
## |            Std Residual | 
## |-------------------------|
## 
## ==========================================================
##                         NSDUH21_clean$Truancy
## NSDUH21_clean$Gender    Low Truancy   High Truancy   Total
## ----------------------------------------------------------
## 1                              5744             35    5779
##                                5736             43        
##                               0.994          0.006   0.478
##                               0.106         -1.227        
## ----------------------------------------------------------
## 2                              6248             55    6303
##                                6256             47        
##                               0.991          0.009   0.522
##                              -0.102          1.175        
## ----------------------------------------------------------
## Total                         11992             90   12082
## ==========================================================
## 
## Statistics for All Table Factors
## 
## Pearson's Chi-squared test 
## ------------------------------------------------------------
## Chi^2 = 2.905993      d.f. = 1      p = 0.0883 
## 
## Pearson's Chi-squared test with Yates' continuity correction 
## ------------------------------------------------------------
## Chi^2 = 2.556141      d.f. = 1      p = 0.11

This indicates that there’s no statistically significant relationship between Gender and the likelihood of Truancy. Both p-values exceed the conventional alpha level of 0.05 [χ²(1) = 2.91; p > 0.05 without correction, and χ²(1) = 2.56; p > 0.05 with correction], so we fail to reject the null hypothesis. This outcome suggests that there is insufficient evidence to assert a significant relationship between gender and truancy.

Checking the assumptions

Grouping of age category by truancy

NSDUH21_clean %>%
  drop_na() %>%
  group_by(Age, Truancy) %>% 
  count() %>% 
  group_by(Age) %>% 
  mutate(perc.Age = 100 * n / sum(n)) %>% 
  ggplot(aes(x = Age, y = perc.Age, fill = Truancy)) +
  geom_col(position = "dodge") + 
  theme_minimal() +
  labs(x = "Age",
       y = "Percent of Age category",
       fill = "Truancy") +
  coord_flip()

Interpretation majority of those who missed 16 or more days of school from skipping were in the 14-15 and 16-17 age groups

Hypothesis

H0: There is no relationship between Age and Truancy.

HA: There is a relationship between Age and Truancy.

CrossTable(y = NSDUH21_clean$Truancy,
           x = NSDUH21_clean$Age,
           chisq = TRUE,
           expected = TRUE,
           sresid = TRUE,
           prop.c = FALSE,
           prop.t = FALSE,
           prop.chisq = FALSE)
## Warning in chisq.test(tab, correct = FALSE, ...): Chi-squared approximation may
## be incorrect
##    Cell Contents 
## |-------------------------|
## |                       N | 
## |              Expected N | 
## |           N / Row Total | 
## |            Std Residual | 
## |-------------------------|
## 
## =======================================================
##                      NSDUH21_clean$Truancy
## NSDUH21_clean$Age    Low Truancy   High Truancy   Total
## -------------------------------------------------------
## 12-13                       2517             18    2535
##                           2516.1           18.9        
##                            0.993          0.007   0.210
##                            0.018         -0.203        
## -------------------------------------------------------
## 14-15                       2555             26    2581
##                           2561.8           19.2        
##                            0.990          0.010   0.214
##                           -0.134          1.545        
## -------------------------------------------------------
## 16-17                       2447             20    2467
##                           2448.6           18.4        
##                            0.992          0.008   0.204
##                           -0.033          0.379        
## -------------------------------------------------------
## 18-20                       2049             14    2063
##                           2047.6           15.4        
##                            0.993          0.007   0.171
##                            0.030         -0.349        
## -------------------------------------------------------
## 21-25                       1622              8    1630
##                           1617.9           12.1        
##                            0.995          0.005   0.135
##                            0.103         -1.189        
## -------------------------------------------------------
## 26-34                        453              2     455
##                            451.6            3.4        
##                            0.996          0.004   0.038
##                            0.065         -0.755        
## -------------------------------------------------------
## 35 or Older                  349              2     351
##                            348.4            2.6        
##                            0.994          0.006   0.029
##                            0.033         -0.380        
## -------------------------------------------------------
## Total                      11992             90   12082
## =======================================================
## 
## Statistics for All Table Factors
## 
## Pearson's Chi-squared test 
## ------------------------------------------------------------
## Chi^2 = 4.856137      d.f. = 6      p = 0.562

The p-value of 0.562 [χ²(6) = 4.8; p > 0.05] indicates that the variations in truancy across different age groups can be attributed to randomchance rather than a systematic relationship between age and truancy. This suggests that there is no significant association between age and truancy.

Checking the assumptions

Hence we do a Fischer’s Exact Test

# Display the contingency table
contingency_table <- table(NSDUH21_clean$Truancy, NSDUH21_clean$Age)
contingency_table
##               
##                12-13 14-15 16-17 18-20 21-25 26-34 35 or Older
##   Low Truancy   2517  2555  2447  2049  1622   453         349
##   High Truancy    18    26    20    14     8     2           2
# Fisher's Exact Test with increased workspace
fisher_test <- fisher.test(contingency_table, workspace = 2e7)
fisher_test
## 
##  Fisher's Exact Test for Count Data
## 
## data:  contingency_table
## p-value = 0.6414
## alternative hypothesis: two.sided

Given the p-value of 0.6414, we fail to reject the null hypothesis. This indicates that there is no statistically significant association between age and truancy levels.

Grouping of race by truancy

NSDUH21_clean %>%
  drop_na() %>%
  group_by(Race, Truancy) %>% 
  count() %>% 
  group_by(Race) %>% 
  mutate(perc.Race = 100 * n / sum(n)) %>% 
  ggplot(aes(x = Race, y = perc.Race, fill = Truancy)) +
  geom_col(position = "dodge") + 
  theme_minimal() +
  labs(x = "Race",
       y = "Percent of Race category",
       fill = "Truancy") +
  coord_flip()

Interpretation Non-hispanic Native Hawaains or other Pacific Islander race had the greatest proportion in the High Truancy category

Hypothesis

H0: There is no relationship between Race and Truancy.

HA: There is a relationship between Race and Truancy.

# Chi-squared Race and Truancy}

CrossTable(y = NSDUH21_clean$Truancy,
           x = NSDUH21_clean$Race,
           chisq = TRUE,
           expected = TRUE,
           sresid = TRUE,
           prop.c = FALSE,
           prop.t = FALSE,
           prop.chisq = FALSE)
## Warning in chisq.test(tab, correct = FALSE, ...): Chi-squared approximation may
## be incorrect
##    Cell Contents 
## |-------------------------|
## |                       N | 
## |              Expected N | 
## |           N / Row Total | 
## |            Std Residual | 
## |-------------------------|
## 
## =====================================================================
##                                    NSDUH21_clean$Truancy
## NSDUH21_clean$Race                 Low Truancy   High Truancy   Total
## ---------------------------------------------------------------------
## NonHisp White                             6164             42    6206
##                                         6159.8           46.2        
##                                          0.993          0.007   0.514
##                                          0.054         -0.622        
## ---------------------------------------------------------------------
## NonHisp Black/Afr Am                      1580             14    1594
##                                         1582.1           11.9        
##                                          0.991          0.009   0.132
##                                         -0.053          0.617        
## ---------------------------------------------------------------------
## NonHisp Native Am/AK Native                108              1     109
##                                          108.2            0.8        
##                                          0.991          0.009   0.009
##                                         -0.018          0.209        
## ---------------------------------------------------------------------
## NonHisp Native HI/Other Pac Isl             30              1      31
##                                           30.8            0.2        
##                                          0.968          0.032   0.003
##                                         -0.139          1.600        
## ---------------------------------------------------------------------
## NonHisp Asian                              813              4     817
##                                          810.9            6.1        
##                                          0.995          0.005   0.068
##                                          0.073         -0.846        
## ---------------------------------------------------------------------
## NonHisp more than one race                 667              8     675
##                                          670.0            5.0        
##                                          0.988          0.012   0.056
##                                         -0.115          1.325        
## ---------------------------------------------------------------------
## Hispanic                                  2630             20    2650
##                                         2630.3           19.7        
##                                          0.992          0.008   0.219
##                                         -0.005          0.058        
## ---------------------------------------------------------------------
## Total                                    11992             90   12082
## =====================================================================
## 
## Statistics for All Table Factors
## 
## Pearson's Chi-squared test 
## ------------------------------------------------------------
## Chi^2 = 5.891276      d.f. = 6      p = 0.435

The p-value of 0.435 [χ²(6) = 5.89; p > 0.05] suggests that the differences in truancy across various racial groups can likely be attributed to random chance, rather than a systematic relationship between race and truancy levels. This analysis indicates that there is no significant association between race and truancy.

Checking the assumptions

Hence we do a Fischer’s Exact Test

# Display the contingency table
contingency_table <- table(NSDUH21_clean$Truancy, NSDUH21_clean$Race)
contingency_table
##               
##                NonHisp White NonHisp Black/Afr Am NonHisp Native Am/AK Native
##   Low Truancy           6164                 1580                         108
##   High Truancy            42                   14                           1
##               
##                NonHisp Native HI/Other Pac Isl NonHisp Asian
##   Low Truancy                               30           813
##   High Truancy                               1             4
##               
##                NonHisp more than one race Hispanic
##   Low Truancy                         667     2630
##   High Truancy                          8       20
# Fisher's Exact Test with increased workspace
fisher_test <- fisher.test(contingency_table, workspace = 2e7)
fisher_test
## 
##  Fisher's Exact Test for Count Data
## 
## data:  contingency_table
## p-value = 0.297
## alternative hypothesis: two.sided

Given the p-value of 0.6414 (p > 0.05), we fail to reject the null hypothesis. This indicates that there is no statistically significant association between race and truancy levels.

Box plot comparing the medians of Freqalcoholuse by Truancy level

NSDUH21_clean %>% 
  drop_na() %>%
  ggplot(aes(x = Freqalcoholuse, y = Truancy)) +
  geom_boxplot() +
  theme_minimal() +
  labs(x = "Total number of days alcohol was used in the past 12 months", 
       y = "Combined number of days respondents missed school from skipping" ,
       title = "Frequent Alcohol Use")

The box plot shows no remarkable difference between the Low and High Truancy groups in terms of the median and IQR for alcohol use. Both truancy level groups have a low frequency of alcohol use as their median. While there are individuals who report higher frequencies of alcohol use, they represent outliers rather than common occurrences. Further statistical analysis would be required to determine if any difference is statistically significant.

Checking t-test assumptions:

# Remove NA values before plotting
valid_data <- NSDUH21_clean$Freqalcoholuse[!is.na(NSDUH21_clean$Freqalcoholuse)]

# Create Q-Q plot with the valid data
qqnorm(valid_data, main = "Q-Q Plot of Alcohol Use Frequency")
qqline(valid_data, col = "steelblue", lwd = 2)

The points in the Q-Q plot do not fall along the reference line, particularly in the tails. This indicates that the data significantly deviate from what would be expected if they were normally distributed.The curve in the plot also suggests a right-skewed distribution, with points that stray away from the line at the upper end indicating outliers. Given the apparent right skewness and presence of outliers, the assumption of normality for the alcohol use frequency data seems to be violated.

Assessing Homogeneity of Variances

Hypothesis

H0: The variances of the frequency of alcohol use are equal across the different truancy levels.

HA: The variances are not equal.

# Homogeneity of variances assumption test
# H0: Variances are equal (meets assumption)
# HA: Variances are not equal (does not meet assumption)
car::leveneTest(y = NSDUH21_clean$Freqalcoholuse, 
                group = NSDUH21_clean$Truancy, 
                center = median)
## Levene's Test for Homogeneity of Variance (center = median)
##          Df F value Pr(>F)
## group     1  0.8716 0.3505
##       11958

Based on the median-centered Levene’s test for equality of variances, there is no statistically significant difference in the variances of alcohol use frequency between the different truancy levels (F(1, 11958) = 0.87, p = 0.3505). This suggests that the homogeneity of variances assumption is met for the two truancy groups.

However, because the normality assumption is not met, we will do a non-parametric test.

wilcox_test_result <- wilcox.test(Freqalcoholuse ~ Truancy, data = NSDUH21_clean)

# Print the result
wilcox_test_result
## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  Freqalcoholuse by Truancy
## W = 504796, p-value = 0.3893
## alternative hypothesis: true location shift is not equal to 0

Since the p-value (0.3893) is greater than 0.05, we fail to reject the null hypothesis. This implies that there is no statistically significant difference (W = 504796, p = 0.3893) in the medians of alcohol use frequency between the Low Truancy and High Truancy groups. The result suggests that the median frequency of alcohol use does not significantly differ between students with low truancy and those with high truancy.

Conclusion

The analyses conducted so far do not provide strong evidence of associations between the predictor variables - frequent alcohol use, age,race, gender - and the outcome variable truancy. The Levene’s test, centered on the median for alcohol use, showed no significant difference in variances across truancy groups (p = 0.3505), indicating homogeneity of variances. Chi-square tests examining the relationships between gender, age, and race with truancy levels did not reveal any significant associations, suggesting that these demographic factors do not significantly influence truancy levels. Additionally, the Wilcoxon rank sum test (Mann-Whitney U test) further supported the absence of a significant relationship between frequency of alcohol use and truancy levels (p = 0.3893). Based on these results, alcohol consumption does not appear to be associated with school absenteeism. However, there is a need for additional analyses, specifically a multivariate analysis to assess the simultaneous impact of age, race, gender, and frequent alcohol use on truancy, adjusting for potential confounders.

In this study, truancy was used as a proxy for academic performance. The findings, which show no significant associations between substance use, demographic factors, and truancy, contrast with previous research. Cox et al. (2007) and Hallfors et al. (2002) found that substance use was associated with poor academic outcomes, while Scal et al. (2003), Albrecht & Amey (1996), and Sutherland & Shepherd (2001) highlighted varying influences of socio-demographic factors. This discrepancy highlights the varied impacts of these variables across different populations and settings, and suggests that the relationship between academic performance and substance use may be influenced by other contextual factors. There is a need for future research to delve deeper into these relationships, particularly focusing on how different socio-demographic factors and individual characteristics interact with substance use and academic performance.

References:

Albrecht SL, Amey C. Patterns of substance abuse among rural black adolescents. J Drug Issues. 1996;26(4):751-781.

Cox RG, Zhang L, Johnson WD, Bender DR. Academic performance and substance use: findings from a state survey of public high school students. J Sch Health. 2007; 77: 109-115.

Hallfors D, Vevea JL, Iritani B, et al. Truancy, grade point average, and sexual activity: a meta-analysis of risk indicators for youth substance use. J Sch Health. 2002;72(5):205-211.

Scal P, Ireland M, Borowsky IW. Smoking among American adolescents: a risk and protective factor analysis. J Community Health. 2003;28(2):79-97.

Sutherland I, Shepherd JP. Social dimensions of adolescent substance use. Addiction. 2001;96(3):445-458.