January_2023_NFL_HealthSurvey

Author

C. Lexi Baird

Influences of age and race on health outcomes in retired athletes

installing packages

options(repos = c(CRAN = "https://cran.rstudio.com"))

library(readxl)
library(dplyr)

Attaching package: 'dplyr'
The following objects are masked from 'package:stats':

    filter, lag
The following objects are masked from 'package:base':

    intersect, setdiff, setequal, union
library(ggplot2)
library(tidyverse)
── Attaching packages
───────────────────────────────────────
tidyverse 1.3.2 ──
✔ tibble  3.1.8     ✔ purrr   1.0.1
✔ tidyr   1.2.1     ✔ stringr 1.5.0
✔ readr   2.1.3     ✔ forcats 0.5.2
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()
library(tidyr)

install.packages("effectsize")

The downloaded binary packages are in
    /var/folders/4w/gljslth537l5fz1ys3jw1xj40000gn/T//RtmprQNmWH/downloaded_packages
library(effectsize)

library(car)
Loading required package: carData

Attaching package: 'car'

The following object is masked from 'package:purrr':

    some

The following object is masked from 'package:dplyr':

    recode
HSD_GW_Only_UPDATED <- read_excel("~/Desktop/R/JH/HSD_GW_Only_UPDATED.xlsx")
New names:
• `RaceEthnMod` -> `RaceEthnMod...11`
• `RaceEthnMod` -> `RaceEthnMod...12`
• `SurgeriesPostRetire_Elbow_1_1` -> `SurgeriesPostRetire_Elbow_1_1...771`
• `SurgeriesPostRetire_Elbow_1_1` -> `SurgeriesPostRetire_Elbow_1_1...774`
d <- HSD_GW_Only_UPDATED

Distributions of age and race

library(effectsize)

hist(d$CurrAge)

class(d$AA_White)
[1] "character"
race <- as.factor(d$AA_White)

df_clean <- na.omit(d[ , "AA_White"])

d <- d %>% filter(AA_White %in% c(1, 2))

age <- d$CurrAge
race <- d$AA_White

d$RaceName <- ifelse(d$AA_White == 1, "Black", ifelse(d$AA_White == 2, "White", NA))

ggplot(d, aes(x = d$CurrAge)) +
  geom_histogram(binwidth = 5) +
  facet_wrap(~ d$RaceName, ncol = 2, labeller = label_both) +
  ggtitle("Age Distribution by Group") +
  xlab("Age") +
  ylab("Frequency")
Warning: Use of `d$CurrAge` is discouraged.
ℹ Use `CurrAge` instead.

#hist(d$CurrAge)
#table(race)
table(race)
race
  1   2 
 65 133 

Define four groups

age_group <- ifelse(d$CurrAge > 49, "50 and Older", "49 and Younger")
table(age_group)
age_group
49 and Younger   50 and Older 
            82            116 
age_group_n <- ifelse(d$CurrAge > 49, 2, 1)
table(age_group_n)
age_group_n
  1   2 
 82 116 
age_race <- ifelse(age_group == "49 and Younger" & d$AA_White == 2, 1,
                   ifelse(age_group == "49 and Younger" & d$AA_White == 1, 2,
                          ifelse(age_group  == "50 and Older" & d$AA_White == 2, 3,
                                 ifelse(age_group  == "50 and Older" & d$AA_White == 1, 4, NA)))) 

table(age_race)
age_race
 1  2  3  4 
51 31 82 34 
#Here, 1) Younger White, 2) Younger Black, 3) Older White, 4) Older Black


age_race_names <- ifelse(age_group == "49 and Younger" & d$AA_White == 2, "Younger White",
                   ifelse(age_group == "49 and Younger" & d$AA_White == 1, "Younger Black",
                          ifelse(age_group  == "50 and Older" & d$AA_White == 2, "Older White",
                                 ifelse(age_group  == "50 and Older" & d$AA_White == 1, "Older Black", NA)))) 
table(age_race_names)
age_race_names
  Older Black   Older White Younger Black Younger White 
           34            82            31            51 

RAND Scores

total_rand <- d$RAND_Total_Scaled
general_health <- d$Gen_Health_Average
pain <- d$Pain_Average
emotional_wb <- d$Emo_WellBeing_Average
fatigue <- d$`Energy/Fatigue_Average`
emotional_role <- d$Emo_Role_Limit_Average
physical_role <- d$Phys_Health_Role_Limit_Average
physical_func <- d$Phys_Func_Average


hist(total_rand, main = "RAND Total Scores", breaks = "Sturges")

hist(general_health, main = "General Health", breaks = "Sturges")

hist(pain, main = "Pain", breaks = "Sturges")

hist(emotional_wb, main = "Emotional Well Being", breaks = "Sturges")

hist(fatigue, main = "Fatigue", breaks = "Sturges")

hist(emotional_role, main = "Emotional Role Limitations", breaks = "Sturges")

hist(physical_func, main = "Physical Functioning", breaks = "Sturges")

ANOVA of age and race on total RAND scores

rand_aov <- aov(total_rand ~ age_group*race, data = d)
summary(rand_aov)
                Df Sum Sq Mean Sq F value  Pr(>F)   
age_group        1    348   347.8   1.360 0.24503   
race             1   1735  1735.4   6.784 0.00992 **
age_group:race   1     26    26.2   0.102 0.74924   
Residuals      193  49373   255.8                   
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
1 observation deleted due to missingness
install.packages("car")

The downloaded binary packages are in
    /var/folders/4w/gljslth537l5fz1ys3jw1xj40000gn/T//RtmprQNmWH/downloaded_packages
library(car)
leveneTest(total_rand ~ age_group*race, data = d)
Levene's Test for Homogeneity of Variance (center = median)
       Df F value  Pr(>F)  
group   3  3.6575 0.01347 *
      193                  
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Okay, for total scores from the RAND SF-36, no interaction between our age factor and race factor here. Data is not normally distributed. I am log transforming it here:

d$log_rand <- log1p(total_rand)
hist(d$log_rand)

leveneTest(log_rand ~ age_group*race, data = d)
Levene's Test for Homogeneity of Variance (center = median)
       Df F value Pr(>F)
group   3   1.459 0.2271
      193               

ANOVA with log transformed data

log_rand_aov <- aov(log_rand ~ age_group * race, data = d)
summary(log_rand_aov)
                Df Sum Sq Mean Sq F value Pr(>F)  
age_group        1   0.07  0.0661   0.277 0.5993  
race             1   0.77  0.7722   3.237 0.0736 .
age_group:race   1   0.27  0.2669   1.119 0.2915  
Residuals      193  46.04  0.2386                 
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
1 observation deleted due to missingness

Still no effect here.

Linear model predicting RAND scores from age (continuous) and race (binary)

rand_lm <- lm(log_rand ~ d$CurrAge*d$AA_White, data = d)
summary(rand_lm)

Call:
lm(formula = log_rand ~ d$CurrAge * d$AA_White, data = d)

Residuals:
    Min      1Q  Median      3Q     Max 
-4.2817 -0.0504  0.0892  0.1984  0.4214 

Coefficients:
                       Estimate Std. Error t value Pr(>|t|)    
(Intercept)            4.378339   0.236966  18.477   <2e-16 ***
d$CurrAge             -0.004353   0.004543  -0.958    0.339    
d$AA_White2            0.024495   0.285391   0.086    0.932    
d$CurrAge:d$AA_White2  0.002227   0.005352   0.416    0.678    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 0.4886 on 193 degrees of freedom
  (1 observation deleted due to missingness)
Multiple R-squared:  0.02286,   Adjusted R-squared:  0.007669 
F-statistic: 1.505 on 3 and 193 DF,  p-value: 0.2146
#t_rand_lm <- lm(total_rand ~ d$CurrAge*d$AA_White, data = d)
#summary(t_rand_lm)

Let’s check the rest of the subscales included in the RAND SF-36.

health_aov <- aov(general_health ~ age_group * race, data = d)
pain_aov <- aov(pain ~ age_group * race, data = d)
emotionalwb_aov <- aov(emotional_wb ~ age_group * race, data = d)
fatigue_aov <- aov(fatigue ~ age_group * race, data = d)
emotionalrole_aov <- aov(emotional_role ~ age_group * race, data = d)
physicalrole_aov <- aov(physical_role ~ age_group * race, data = d)
physicalfunc_aov <- aov(physical_func ~ age_group * race, data = d)

summary(pain_aov)
                Df Sum Sq Mean Sq F value Pr(>F)  
age_group        1   3816    3816   6.395 0.0122 *
race             1   2255    2255   3.780 0.0533 .
age_group:race   1    114     114   0.191 0.6628  
Residuals      194 115757     597                 
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(emotionalwb_aov)
                Df Sum Sq Mean Sq F value Pr(>F)  
age_group        1   1328  1328.5   3.440 0.0651 .
race             1      8     8.2   0.021 0.8846  
age_group:race   1     17    16.7   0.043 0.8355  
Residuals      194  74917   386.2                 
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(fatigue_aov)
                Df Sum Sq Mean Sq F value  Pr(>F)   
age_group        1   4454    4454   9.842 0.00197 **
race             1    388     388   0.857 0.35584   
age_group:race   1    224     224   0.495 0.48259   
Residuals      194  87796     453                   
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(emotionalrole_aov)
                Df Sum Sq Mean Sq F value Pr(>F)
age_group        1   1616  1616.4   2.679  0.103
race             1    779   778.7   1.290  0.257
age_group:race   1    758   758.0   1.256  0.264
Residuals      194 117062   603.4               
summary(physicalrole_aov)
                Df Sum Sq Mean Sq F value Pr(>F)  
age_group        1   2516    2516   4.261 0.0403 *
race             1   3353    3353   5.678 0.0181 *
age_group:race   1    137     137   0.231 0.6311  
Residuals      194 114550     590                 
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(physicalfunc_aov)
                Df Sum Sq Mean Sq F value  Pr(>F)   
age_group        1   4480    4480   9.042 0.00299 **
race             1   2853    2853   5.757 0.01737 * 
age_group:race   1     45      45   0.090 0.76453   
Residuals      194  96131     496                   
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Nothing.

ggplot(d, aes(x = d$CurrAge, y = total_rand, color = d$AA_White)) +
  geom_point() +
  xlab("Age") +
  ylab("Total Rand Scores") +
  ggtitle("Scatterplot of Total Rand Scores by Age")
Warning: Use of `d$CurrAge` is discouraged.
ℹ Use `CurrAge` instead.
Warning: Use of `d$AA_White` is discouraged.
ℹ Use `AA_White` instead.
Warning: Removed 1 rows containing missing values (`geom_point()`).

Since most of the data has a very heavy left skew, lets just look at Pain and Fatigue, which have a bit more variance.

Pain scores

ggplot(d, aes(x = d$CurrAge, y = pain, color = d$AA_White)) +
  geom_point() +
  xlab("Age") +
  ylab("Pain Scores") +
  ggtitle("Scatterplot of Pain Scores by Age")
Warning: Use of `d$CurrAge` is discouraged.
ℹ Use `CurrAge` instead.
Warning: Use of `d$AA_White` is discouraged.
ℹ Use `AA_White` instead.

Fatigue

ggplot(d, aes(x = d$CurrAge, y = fatigue, color = d$AA_White)) +
  geom_point() +
  xlab("Age") +
  ylab("Fatigue Scores") +
  ggtitle("Scatterplot of Fatigue Scores by Age")
Warning: Use of `d$CurrAge` is discouraged.
ℹ Use `CurrAge` instead.
Warning: Use of `d$AA_White` is discouraged.
ℹ Use `AA_White` instead.

Hypertension

hypertension <- d$MedHistory_Hypertension_Diagnosed
hypertension_names <- ifelse(hypertension == 1, "Hypertension", "No Hypertension")


ggplot(d, aes(x = hypertension_names)) + 
  geom_bar(na.rm = TRUE) 

ggplot(d, aes(x = age_race_names, fill = factor(hypertension_names))) + 
  geom_bar(position = "dodge") +
  ggtitle("Hypertension Frequency by Age Race Category") +
  xlab("Category") +
  ylab("Frequency") +
  scale_fill_discrete(name = "Hypertension Status", labels = c("Hypertension", "No Hypertension"))

Two-way anova for Hypertension outcomes by age and race

hypertension_aov <- aov(hypertension ~ age_group * race, data = d)
summary(hypertension_aov)
                Df Sum Sq Mean Sq F value   Pr(>F)    
age_group        1   5.55   5.549  26.866 5.52e-07 ***
race             1   1.34   1.335   6.466   0.0118 *  
age_group:race   1   0.05   0.049   0.239   0.6258    
Residuals      191  39.45   0.207                     
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
3 observations deleted due to missingness
leveneTest(hypertension ~ age_group*race, data = d)
Levene's Test for Homogeneity of Variance (center = median)
       Df F value    Pr(>F)    
group   3  5.7274 0.0008974 ***
      191                      
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

No interaction of age and race here. Also fails Levene’s test.

Logistic regression function

logit <- function(outcome, predictor1, predictor2, data, intercept = TRUE){
  if(intercept == TRUE){
    model <- glm(outcome ~ predictor1 + predictor2, data = data, family = binomial(link = "logit"))
  }
  else{
    model <- glm(outcome ~ predictor1 + predictor2 - 1, data = data, family = binomial(link = "logit"))
  }
  return(model)
}
reg_hyper_age <- logit(hypertension, d$CurrAge, d$AA_White, data = d)

summary(reg_hyper_age)

Call:
glm(formula = outcome ~ predictor1 + predictor2, family = binomial(link = "logit"), 
    data = data)

Deviance Residuals: 
    Min       1Q   Median       3Q      Max  
-1.7378  -0.8826  -0.5015   0.9902   2.2618  

Coefficients:
            Estimate Std. Error z value Pr(>|z|)    
(Intercept) -3.41322    0.69322  -4.924 8.49e-07 ***
predictor1   0.06674    0.01256   5.312 1.09e-07 ***
predictor22 -0.99930    0.35454  -2.819  0.00482 ** 
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

(Dispersion parameter for binomial family taken to be 1)

    Null deviance: 260.77  on 194  degrees of freedom
Residual deviance: 221.91  on 192  degrees of freedom
  (3 observations deleted due to missingness)
AIC: 227.91

Number of Fisher Scoring iterations: 4
predict_hyper <- predict(reg_hyper_age, type = "response")

# Create a data frame for plotting the predictions
plot_data <- data.frame(d$CurrAge, d$AA_White)
plot_data$predictions <- predict(reg_hyper_age, newdata = plot_data, type = "response")

# Plot the logistic regression using ggplot2
ggplot(plot_data, aes(x = d$CurrAge, y = predictions, color = d$AA_White)) +
  geom_line() +
  xlab("Age") +
  ylab("Predicted Probability of Hypertension") +
  ggtitle("Hypertension Diagnosis by Age and Race") +
  scale_color_discrete(name = "Race")

In this plot here, 1 is Black athletes, and 2 is white athletes.

Now, just the contact athletes

Here, predictor 1 is age and predictor 2 is race

contact_df <- subset(d, d$`Contact?` == 1)

contact_df 
# A tibble: 170 × 1,147
   `Subject ID` GW Sur…¹ CurrM…² CurrD…³ CurrY…⁴ CurrAge CurrH…⁵ CurrH…⁶ CurrW…⁷
   <chr>           <dbl>   <dbl>   <dbl>   <dbl>   <dbl>   <dbl>   <dbl>   <dbl>
 1 212                 1       6      16       2      66       6       2     208
 2 307                 1       5      26       2      33       6       3     220
 3 315                 1       6      29       2      72       5       8     165
 4 357                 1       3       3       3      34       5      11     223
 5 361                 1       2      16       3      30       6       0     195
 6 367                 1       3       1       3      48       5      10     200
 7 103                 1       7      14       2      51       5       9     185
 8 225                 1       6       9       2      36       5      11     183
 9 303                 1       5      22       2      52       5       9     175
10 305                 1       5      27       2      31       6       2     250
# … with 160 more rows, 1,138 more variables: RaceEthn <chr>,
#   RaceEthnMod...11 <dbl>, RaceEthnMod...12 <dbl>, SingleRaceEthn <chr>,
#   AA_White <chr>, EthnOther <chr>, MarStatus <dbl>, Education <dbl>,
#   RegionGrowUp <chr>, CountryGrowUp <chr>, MomEducation <dbl>,
#   DadEducation <chr>, DadJob <chr>, FinceGrowUp <chr>, CurrWork <dbl>,
#   CurrWorkOther <chr>, ExerciseReg <dbl>, ExerciseType <chr>,
#   GenCardio <dbl>, WalkGolf <dbl>, WeightLifting <dbl>, RecSport <dbl>, …
#reg_hyper_contact <- glm(contact_df$MedHistory_Hypertension_Diagnosed ~ contact_df$CurrAge + contact_df$AA_White, family = binomial)

reg_hyper_contact <- logit(contact_df$MedHistory_Hypertension_Diagnosed, contact_df$CurrAge, contact_df$AA_White, data = contact_df)

summary(reg_hyper_contact)

Call:
glm(formula = outcome ~ predictor1 + predictor2, family = binomial(link = "logit"), 
    data = data)

Deviance Residuals: 
    Min       1Q   Median       3Q      Max  
-1.7718  -0.9306  -0.5304   1.0099   2.1827  

Coefficients:
            Estimate Std. Error z value Pr(>|z|)    
(Intercept) -3.35170    0.75199  -4.457 8.31e-06 ***
predictor1   0.06584    0.01372   4.798 1.60e-06 ***
predictor22 -0.90884    0.37487  -2.424   0.0153 *  
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

(Dispersion parameter for binomial family taken to be 1)

    Null deviance: 228.33  on 166  degrees of freedom
Residual deviance: 198.07  on 164  degrees of freedom
  (3 observations deleted due to missingness)
AIC: 204.07

Number of Fisher Scoring iterations: 3
predict_hyper <- predict(reg_hyper_contact, type = "response")

# Create a data frame for plotting the predictions
plot_data_c <- data.frame(contact_df$CurrAge, contact_df$AA_White)
plot_data_c$predictions <- predict(reg_hyper_contact, newdata = plot_data_c, type = "response")

# Plot the logistic regression using ggplot2
ggplot(plot_data_c, aes(x = contact_df$CurrAge, y = predictions, color = contact_df$AA_White)) +
  geom_line() +
  xlab("Age") +
  ylab("Predicted Probability of Hypertension") +
  ggtitle("Hypertension Diagnosis by Age and Race") +
  scale_color_discrete(name = "Race")

These plots look pretty much the same, but the AIC is a bit lower

Same thing, but with contact participation included as a predictor (0 or 1)

reg_hyper_age2 <- glm(hypertension ~ d$CurrAge + d$AA_White + d$`Contact?`, family = binomial)
summary(reg_hyper_age2)

Call:
glm(formula = hypertension ~ d$CurrAge + d$AA_White + d$`Contact?`, 
    family = binomial)

Deviance Residuals: 
    Min       1Q   Median       3Q      Max  
-1.7351  -0.8764  -0.4838   0.9875   2.4787  

Coefficients:
             Estimate Std. Error z value Pr(>|z|)    
(Intercept)  -3.94035    0.84108  -4.685 2.80e-06 ***
d$CurrAge     0.06303    0.01286   4.901 9.54e-07 ***
d$AA_White2  -0.91212    0.36030  -2.532   0.0114 *  
d$`Contact?`  0.74896    0.60941   1.229   0.2191    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

(Dispersion parameter for binomial family taken to be 1)

    Null deviance: 260.77  on 194  degrees of freedom
Residual deviance: 220.26  on 191  degrees of freedom
  (3 observations deleted due to missingness)
AIC: 228.26

Number of Fisher Scoring iterations: 4
confint(reg_hyper_age)
Waiting for profiling to be done...
                  2.5 %      97.5 %
(Intercept) -4.83743049 -2.10752216
predictor1   0.04313506  0.09260526
predictor22 -1.71029627 -0.31475554

Effects of age and race remain the same, but the model fit seems a bit worse.

Diabetes

diabetes <- d$MedHistory_Diabetes_Diagnosed
table(diabetes)
diabetes
  0   1 
182  13 
diabetes_names <- ifelse(diabetes == 1, "Diabetes", "No Diabetes")

ggplot(d, aes(x = age_race_names, fill = factor(diabetes_names))) + 
  geom_bar(position = "dodge") +
  ggtitle("Diabetes Frequency by Age Race Category") +
  xlab("Category") +
  ylab("Frequency") +
  scale_fill_discrete(name = "Diabetes Status", labels = c("Diabetes", "No Diabetes"))

This is what I initially thought. We have no people in the younger white category that have been diagnosed with Diabetes.

Two-way anova for Diabetes by age and race

diabetes_aov <- aov(diabetes ~ age_group * race, data = d)
summary(diabetes_aov)
                Df Sum Sq Mean Sq F value Pr(>F)  
age_group        1  0.115  0.1154   1.893 0.1705  
race             1  0.369  0.3688   6.048 0.0148 *
age_group:race   1  0.003  0.0034   0.056 0.8129  
Residuals      191 11.646  0.0610                 
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
3 observations deleted due to missingness

Arthritis

r_arthritis <- d$MedHistory_RhArthritis_Diagnosed
o_arthritis <- d$MedHistory_Arthritis_Diagnosed

r_arthritis_names <- ifelse(r_arthritis == 1, "Rheumatoid Arthritis", "No Arthritis")
o_arthritis_names <- ifelse(o_arthritis == 1, "Osteoarthritis", "No Arthritis")

table(r_arthritis_names)
r_arthritis_names
        No Arthritis Rheumatoid Arthritis 
                 181                   14 
table(o_arthritis_names)
o_arthritis_names
  No Arthritis Osteoarthritis 
           145             50 
ggplot(d, aes(x = age_race_names, fill = factor(r_arthritis_names))) + 
  geom_bar(position = "dodge") +
  ggtitle("R. Arthritis Frequency by Age Race Category") +
  xlab("Category") +
  ylab("Frequency") +
  scale_fill_discrete(name = "Arthritis Status", labels = c("No Arthritis", "R. Arthritis"))

ggplot(d, aes(x = age_race_names, fill = factor(o_arthritis_names))) + 
  geom_bar(position = "dodge") +
  ggtitle("O. Arthritis Frequency by Age Race Category") +
  xlab("Category") +
  ylab("Frequency") +
  scale_fill_discrete(name = "Arthritis Status", labels = c("No Arthritis", "O. Arthritis"))

table(o_arthritis_names)
o_arthritis_names
  No Arthritis Osteoarthritis 
           145             50 
table(r_arthritis_names)
r_arthritis_names
        No Arthritis Rheumatoid Arthritis 
                 181                   14 

Looks like there are no participants in the younger black group with rheumatoid arthritis.

Two-way ANOVA of arthritis (both) by age and race

r_arth_aov <-aov(r_arthritis ~ age_group * race, data = d)
summary(r_arth_aov)
                Df Sum Sq Mean Sq F value  Pr(>F)   
age_group        1  0.477  0.4769   7.727 0.00598 **
race             1  0.339  0.3392   5.496 0.02009 * 
age_group:race   1  0.389  0.3893   6.307 0.01285 * 
Residuals      191 11.789  0.0617                   
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
3 observations deleted due to missingness
o_arth_aov <- aov(o_arthritis ~ age_group * race, data = d)
summary(o_arth_aov)
                Df Sum Sq Mean Sq F value  Pr(>F)   
age_group        1   1.92  1.9181  10.529 0.00139 **
race             1   0.01  0.0055   0.030 0.86253   
age_group:race   1   0.46  0.4629   2.541 0.11258   
Residuals      191  34.79  0.1822                   
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
3 observations deleted due to missingness

Okay. There’s an interaction between age and race here for rheumatoid arthritis, but I wonder if this is because of the poor distribution across groups?

leveneTest(r_arthritis ~ age_group*race, data = d)
Levene's Test for Homogeneity of Variance (center = median)
       Df F value    Pr(>F)    
group   3    6.51 0.0003241 ***
      191                      
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Looks like there is a notable degree of variance across groups for Rheumatoid Arthritis.

reg_arth <- logit(o_arthritis, d$CurrAge, d$AA_White, data = d)

summary(reg_arth)

Call:
glm(formula = outcome ~ predictor1 + predictor2, family = binomial(link = "logit"), 
    data = data)

Deviance Residuals: 
    Min       1Q   Median       3Q      Max  
-1.3585  -0.8078  -0.5399   1.1121   2.2508  

Coefficients:
            Estimate Std. Error z value Pr(>|z|)    
(Intercept) -3.83272    0.76725  -4.995 5.87e-07 ***
predictor1   0.05212    0.01284   4.058 4.96e-05 ***
predictor22 -0.18108    0.37247  -0.486    0.627    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

(Dispersion parameter for binomial family taken to be 1)

    Null deviance: 222.01  on 194  degrees of freedom
Residual deviance: 203.12  on 192  degrees of freedom
  (3 observations deleted due to missingness)
AIC: 209.12

Number of Fisher Scoring iterations: 4
predict_hyper <- predict(reg_arth, type = "response")

# Create a data frame for plotting the predictions
plot_data <- data.frame(d$CurrAge, d$AA_White)
plot_data$predictions <- predict(reg_arth, newdata = plot_data, type = "response")

# Plot the logistic regression using ggplot2
ggplot(plot_data, aes(x = d$CurrAge, y = predictions, color = d$AA_White)) +
  geom_line() +
  xlab("Age") +
  ylab("Predicted Probability of O. Arthritis") +
  ggtitle("O. Arthritis Diagnosis by Age and Race") +
  scale_color_discrete(name = "Race")

Here’s a logistic model of osteoarthritis as predicted by age and race. Age appears to be driving the effect here, with no notable differences across our two racial groups

Recap of analyses steps to work on so we can start writing the paper.

  • Run two-way ANOVA for all analyses run with 4 groups. Use two factors: age factor and race factor. The Age factor has two levels: old and young. The Race factor has two levels: Black and White. Test the interaction age * race. The pairwise comparisons are only valid if the interaction test shows a significant (p < .05) result.

    • Done

       

  • Provide bar graphs showing mean and standard error for the four groups, young white, young black, old white, old black athletes.

 

  • Report the odds ratio result as a ratio rather than a percent. The formula is easy. Odds-ratio for hypertension in Blacks is  (#blacks w-htn /#blacks w-o-htn) / (#whites w-htn/#whites w-o-htn).

 

  • I would add the Cohen’s D effect size. It give the same information as Etta-squared but will be more familiar to a wider audience. The formula is easy if you have the means for Group-1 and Group-2. (MeanG1 – MeanG2) / pooled SD. Of course R will do it for you.

 

The following is just stuff to add to your presentation (slides or code output) but you have already done.

 

  • Show sample sizes of each of the 4 groups young white, young black, old white, old black. Provide this for hypertension, diabetes, RAND-total, rheumatoid, osteo, etc.

 

  • Show the full set of analyses for diabetes, rheumatoid, and osteo in the same way you did for hypertension, i.e. two-way ANOVA and then pairwise tests.

 

  • Show the full set of analyses for RAND subscales e.g. emotional well-being.

Other additional questions -> Emotional Impacts of physical impairments across the age spectrum

Next:

  • Plot fatigue x age

  • Plot pain x age

  • Plot the RAND