This is an R Markdown text showing statistics regarding prostate cancer. Hope you find this helpful!
Not much to say for now. I did not make this dataset, I am merely using the data to learn how to code in 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
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
Patients with a family history of prostate cancer tend to be diagnosed with prostate cancer at a younger age. African Americans also tend to be diagnosed with prostate cancer with a higher PSA.
You can also embed plots, for example:
ggplot(prostate_factors) +
aes(x = p_vol, y = preop_psa, col = aa) +
geom_point() +
geom_smooth(method = "lm") +
facet_grid(aa ~ fam_hx) +
labs(x = 'Prostate Volume', y = "Preoperative PSA",
title = 'Relationship Between Prostate Volume and Preop PSA,\nSubdivided by Family History and Race') +
theme(legend.position = "bottom")
## `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()`).
Overall, there seems to be a greater correlation between prostate volume and pre-op PSA for white men compared to African American men.
My hypothesis is that African American men have a higher pre-operative PSA at the time of diagnosis with prostate cancer.
prostate_factors %>%
t_test(formula = preop_psa ~ aa,
detailed = TRUE)
## # A tibble: 1 × 15
## estimate estimate1 estimate2 .y. group1 group2 n1 n2 statistic p
## * <dbl> <dbl> <dbl> <chr> <chr> <chr> <int> <int> <dbl> <dbl>
## 1 -1.89 7.86 9.75 preop… White Afric… 259 54 -1.96 0.0534
## # ℹ 5 more variables: df <dbl>, conf.low <dbl>, conf.high <dbl>, method <chr>,
## # alternative <chr>
Overall, based on the data, since the p-value is >0.05, we cannot definitively conclude that there is a significant difference in the pre-operative PSA at the time of diagnosis of prostate cancer between white men and African American men.That said, the sample size of African American men was much smaller than the sample size of white men, so it may be beneficial to sample more African American men.