Analysis of Prostate Data

I am following the instructions of a book on R: Reproducible medical research with R

prostate %>% 
  mutate(aa = factor(aa, levels = c(0,1), 
      labels = c("White", "African-American"))) %>% 
  mutate(fam_hx = factor(fam_hx, levels = c(0,1), 
      labels = c("No Family History", "FHx of Prostate Cancer"))) ->
prostate_factors

This code allows to convert some variables into factors. The code generates some warnings that I don’t completely understand

prostate %>% 
  select(age, p_vol, preop_psa, aa, fam_hx) %>% 
  group_by(aa, fam_hx) %>% 
  summarize(across(age:preop_psa, mean, na.rm=TRUE))
## Warning: There was 1 warning in `summarize()`.
## ℹ In argument: `across(age:preop_psa, mean, na.rm = TRUE)`.
## ℹ In group 1: `aa = 0` and `fam_hx = 0`.
## Caused by warning:
## ! The `...` argument of `across()` is deprecated as of dplyr 1.1.0.
## Supply arguments directly to `.fns` through an anonymous function instead.
## 
##   # Previously
##   across(a:b, mean, na.rm = TRUE)
## 
##   # Now
##   across(a:b, \(x) mean(x, na.rm = TRUE))
## `summarise()` has grouped output by 'aa'. You can override using the `.groups`
## argument.
## # A tibble: 4 × 5
## # Groups:   aa [2]
##      aa fam_hx   age p_vol preop_psa
##   <dbl>  <dbl> <dbl> <dbl>     <dbl>
## 1     0      0  61.8  56.9      8.06
## 2     0      1  59.5  57.3      7.22
## 3     1      0  60.7  54.3      9.90
## 4     1      1  60.1  51.4      8.71

It do see to me that I will find only minimal significant differences in prostate volume

Including Plots

You can also embed plots, for example:

## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 11 rows containing non-finite outside the scale range
## (`stat_smooth()`).
## Warning: Removed 11 rows containing missing values or values outside the scale range
## (`geom_point()`).

Statistical testing

Based on the previous summary, it looks like the African-American patients in this data-set may have, on average, a higher preoperative PSA level. Let’s test this with Student’s T test

prostate_factors %>% 
  t_test(formula = preop_psa ~ aa,
         detailed = FALSE)
## # A tibble: 1 × 8
##   .y.       group1 group2              n1    n2 statistic    df      p
## * <chr>     <chr>  <chr>            <int> <int>     <dbl> <dbl>  <dbl>
## 1 preop_psa White  African-American   259    54     -1.96  71.7 0.0534

the hypothesis of that the AA patients had higher preoperative PSA level was not confirmed (p<0.05), but the differences between both samples were wide and could been affected the result