Introduction

This project will use the SEER (2017) dataset by the National Cancer Institute, involving 4024 female patients with breast cancer. This report will examine the connections between progesterone and estrogen status and tumour grade status. A breast cancer cell with positive estrogen and/or progesterone status has receptors (proteins) that use the hormone to grow. Negative estrogen and/or progesterone status is when the cancer cell cannot use the hormone to grow, tumour grade indicates the rate of growth and likelihood that it will spread (American Cancer Society, 2021). The project will look at which progesterone/estrogen status has an impact on tumour grade in breast cancer.

Data Wrangling

# Rename variable Progesterone Status 
names(Breast_Cancer)[names(Breast_Cancer) == "Progesterone Status"] <- "PSTAT"

# Rename variable Estrogen Status 
names(Breast_Cancer)[names(Breast_Cancer) == "Estrogen Status"] <- "ESTAT"

# Convert Progesterone and Estrogen status to categorical independent variables (factors)
Breast_Cancer$PSTAT <- factor(Breast_Cancer$PSTAT)
Breast_Cancer$ESTAT <- factor(Breast_Cancer$ESTAT)
Check for non-numeric entries in Grade
# This will return TRUE for entries that are NOT purely numeric
non_numeric <- !grepl("^[0-9]+$", Breast_Cancer$Grade)

# Now get the unique non-numeric entries
unique_non_numeric_entries <- unique(Breast_Cancer$Grade[non_numeric])
unique_non_numeric_entries
## [1] "anaplastic; Grade IV"
Account for non-numeric entries and convert Grade to numeric
# Replace "anaplastic; Grade IV" with "4"
Breast_Cancer$Grade <- gsub("anaplastic; Grade IV", "4", Breast_Cancer$Grade)

# If there are other known mappings, add them here as well
# e.g., Breast_Cancer$Grade <- gsub("some other text", "numeric value", Breast_Cancer$Grade)

# Remove remaining non-numeric by replac anything that's not a digit with an empty string
Breast_Cancer$Grade <- gsub("[^0-9]", "", Breast_Cancer$Grade)

# Convert to numeric
Breast_Cancer$Grade <- as.numeric(Breast_Cancer$Grade)

# Check for NAs to ensure all entries are now either numeric or NA
sum(is.na(Breast_Cancer$Grade))
## [1] 0

Research Question 1: Is tumour grade dependent on estrogen receptor status?

ggplot(Breast_Cancer, aes(x= ESTAT, y = Grade)) +
  geom_jitter(alpha=0.3) +
  labs(caption = "Figure 2: Plot of Relation Between Estrogen Receptor Status and Tumour Grade", x= "Estrogen Receptor Status", y = "Tumour Grade") +
  theme(plot.caption = element_text(size = 12,
                                face = "bold",
                                hjust = 0))

Hypotheses for research question 1

  • H0 (Null hypothesis): There is no relationship between tumour grade and estrogen receptor status, the two are independent.

  • H1 (Alternative hypothesis): There is a relationship between tumour grade and estrogen receptor status, the two are dependent.

Chi-squared test 1

Estrogentable = table(Breast_Cancer$Grade, Breast_Cancer$ESTAT)
results = chisq.test(Estrogentable)
## Warning in chisq.test(Estrogentable): Chi-squared approximation may be
## incorrect
results
## 
##  Pearson's Chi-squared test
## 
## data:  Estrogentable
## X-squared = 217.42, df = 3, p-value < 2.2e-16
  • The p-value from the chi-squared test was <2.2e-16, which is less than 0.04. Thus, the null hypothesis is rejected and the alternative hypothesis is accepted that tumour grade is dependent on estrogen receptor status.

Assumption: Cochran’s Rule that all expected values are greater than 5

results$expected
##    
##       Negative   Positive
##   1  36.298956  506.70104
##   2 157.161779 2193.83822
##   3  74.269135 1036.73086
##   4   1.270129   17.72987
  • Cochran’s Rule is not satisfied that all expected values are greater than 5. All values except one are greater than five.

Research Question 2: Is tumour grade dependent on progesterone receptor status?

ggplot(Breast_Cancer, aes(x= PSTAT, y = Grade)) +
  geom_jitter(alpha=0.3) +
  labs(caption = "Figure 2: Plot of Relation Between Progesterone Receptor Status and Tumour Grade", x= "Progesterone Receptor Status", y = "Tumour Grade") +
  theme(plot.caption = element_text(size = 12,
                                face = "bold",
                                hjust = 0))

Hypotheses for research question 2

  • H0 (Null hypothesis) There is no relationship between tumour grade and progesterone receptor status, they are independent.

  • H1 (Alternative hypothesis): There is a relationship between tumour grade and progesterone receptor status, they are dependent.

Chi-squared test 2

Progesteronetable = table(Breast_Cancer$Grade, Breast_Cancer$PSTAT)
results2 = chisq.test(Progesteronetable)
## Warning in chisq.test(Progesteronetable): Chi-squared approximation may be
## incorrect
results2
## 
##  Pearson's Chi-squared test
## 
## data:  Progesteronetable
## X-squared = 147.8, df = 3, p-value < 2.2e-16
  • The p-value from the Chi-squared test is <2.2e-16 and less than 0.04, indicating the null hypothesis is rejected. The alternative hypothesis is accepted that tumour grade is dependent on progesterone receptor status.

Assumption: Cochran’s Rule that all expected values are greater than 5

results2$expected
##    
##       Negative   Positive
##   1  94.188370  448.81163
##   2 407.802684 1943.19732
##   3 192.713221  918.28678
##   4   3.295726   15.70427
  • Cochran’s Rule is not satisfied that all expected values are greater than 5. All values except one are greater than five.

Note on Chi-squared tests

  • Cochran’s rule is not satisfied for the Chi Squared tests because each output gives 1 value less than 5. This is because few data-points are in grade 4. Thus, the p-value may not be the best approximation to test the dependency of receptor status for that tumour grade.

  • Since 7 out of 8 of the values from each Cochrans test are greater than 5 we will assume the p-value to be a good representation of the relationships.

Research question 3: Is there evidence of association or interaction between tumor grade, estrogen receptor status, and progesterone receptor status in breast cancer patients?

Hypotheses for research question 3

  • H0 (Null Hypothesis): There is no association between tumor grade (Grade), estrogen receptor status (ESTAT), and progesterone receptor status (PSTAT) in breast cancer paHtients. Any observed association is due to random variation.

  • H1 (Alternative Hypothesis): There is an association between at least two of the variables: tumor grade (Grade), estrogen receptor status (ESTAT), and progesterone receptor status (PSTAT) in breast cancer patients.

Visualisation of Progesterone Status, Estrogen Status, and Grade

# Combined dataset with a new factor to distinguish the two statuses
Breast_Cancer$Status_Type <- rep("PSTAT", nrow(Breast_Cancer))
Breast_Cancer_PSTAT <- Breast_Cancer
Breast_Cancer_PSTAT$Status <- Breast_Cancer$PSTAT

Breast_Cancer$Status_Type <- rep("ESTAT", nrow(Breast_Cancer))
Breast_Cancer_ESTAT <- Breast_Cancer
Breast_Cancer_ESTAT$Status <- Breast_Cancer$ESTAT

# Combine the datasets
Breast_Cancer_combined <- rbind(Breast_Cancer_PSTAT, Breast_Cancer_ESTAT)

# Violin Plot
# The width of the 'violin' area shows how many data points there are
  # So, if its thin = less data points, thick = more data points
ggplot(Breast_Cancer_combined, aes(x = Status, y = Grade, fill = Status_Type)) +
  geom_violin() +
  facet_wrap(~Status_Type, scales = "free_x", labeller = as_labeller(custom_labels <- c(ESTAT="Estrogen", PSTAT="Progesterone"))) +
   scale_y_continuous(breaks = 1:3) +
  theme(legend.position = "none") +
  labs(caption = "Figure 1: Violin Plot of Estrogen and Progesterone Status vs Tumour Grade", y = "Tumour Grade") +
  theme(plot.caption = element_text(size = 12,
                                face = "bold",
                                hjust = 0))

Three-Way Contingency Table

table3 <- xtabs(~ Grade + ESTAT + PSTAT, data = Breast_Cancer)

table3
## , , PSTAT = Negative
## 
##      ESTAT
## Grade Negative Positive
##     1        6       41
##     2       73      255
##     3      160      159
##     4        3        1
## 
## , , PSTAT = Positive
## 
##      ESTAT
## Grade Negative Positive
##     1        2      494
##     2        9     2014
##     3       14      778
##     4        2       13

ANOVA to assess full vs reduced Log Linear Model

Hypotheses for ANOVA

  • H0: Additional complexity of the three-way interaction is not justified.
  • H1: Additional complexity of the three-way interaction is justified.
# Fit a full linear model 
model_full <- loglm(~ Grade + ESTAT + PSTAT + Grade:ESTAT + Grade:PSTAT + ESTAT:PSTAT + Grade:ESTAT:PSTAT, data = table3)

# Fit a reduced model without the three-way interaction for comparison
model_reduced <- loglm(~ Grade + ESTAT + PSTAT + Grade:ESTAT + Grade:PSTAT + ESTAT:PSTAT, data = table3)

# Compare the full and reduced models using anova
anova(model_full, model_reduced)
## LR tests for hierarchical log-linear models
## 
## Model 1:
##  ~Grade + ESTAT + PSTAT + Grade:ESTAT + Grade:PSTAT + ESTAT:PSTAT 
## Model 2:
##  ~Grade + ESTAT + PSTAT + Grade:ESTAT + Grade:PSTAT + ESTAT:PSTAT + Grade:ESTAT:PSTAT 
## 
##            Deviance df Delta(Dev) Delta(df) P(> Delta(Dev)
## Model 1   0.9204462  3                                    
## Model 2   0.0000000  0  0.9204462         3        0.82049
## Saturated 0.0000000  0  0.0000000         0        1.00000
# p-value > 0.04, accept null hypotheses that there is no significant difference in the fit of the two models
  • Reduced log linear model will be used.

Reduced Log Linear Model

model_reduced <- loglm(~ Grade + ESTAT + PSTAT + Grade:ESTAT + Grade:PSTAT + ESTAT:PSTAT, data = table3)
summary(model_reduced)
## Formula:
## ~Grade + ESTAT + PSTAT + Grade:ESTAT + Grade:PSTAT + ESTAT:PSTAT
## attr(,"variables")
## list(Grade, ESTAT, PSTAT)
## attr(,"factors")
##       Grade ESTAT PSTAT Grade:ESTAT Grade:PSTAT ESTAT:PSTAT
## Grade     1     0     0           1           1           0
## ESTAT     0     1     0           1           0           1
## PSTAT     0     0     1           0           1           1
## attr(,"term.labels")
## [1] "Grade"       "ESTAT"       "PSTAT"       "Grade:ESTAT" "Grade:PSTAT"
## [6] "ESTAT:PSTAT"
## attr(,"order")
## [1] 1 1 1 2 2 2
## attr(,"intercept")
## [1] 1
## attr(,"response")
## [1] 0
## attr(,".Environment")
## <environment: R_GlobalEnv>
## 
## Statistics:
##                        X^2 df  P(> X^2)
## Likelihood Ratio 0.9204462  3 0.8204911
## Pearson          1.0243187  3 0.7953678
  • Likelihood Ratio and Pearson chi-square test suggests the model has successfully accounted for the relationships in the data.

  • The p-values from the Likelihood Ratio and Pearson chi-square test are above the assumed significance level (a = 0.04), indicating that there is no significant association between the variables from this model.

  • The null hypothesis is accepted that there is no association between tumor grade (Grade), estrogen receptor status (ESTAT), and progesterone receptor status (PSTAT) in breast cancer patients. Any observed association is due to random variation.

Conclusion