class: center, middle, inverse, title-slide .title[ # Synthetic Breast Cancer Data ] .subtitle[ ## STA 553 - Week 2 ] .author[ ### Tim Kelleman ] .date[ ### 2024-02-07 ] --- #Table of Contents .pull-left[ * ####[Desciption of Data Set](#description) * ####[Description of Data - PDF](#PDF) * ####[Basic Details of Dataset in r (Summary)](#summary) * ####[Summary of lm() Model](#lmmodel) * ####[Correlation Matrix](#correlation) * ####[Basic Scatter Plot](#scatterplot) * ####[Density Chart](#density) * ####[Interactive Data Set](#interactive) * ####[Conclusion](#conclusion) ] .pull-right[ <center><img src="/Users/timothykelleman/Desktop/STA553/Week2HW/metastatic-breast-cancer.jpg" alt="Bone marrow infected with metastatic breast cancer tumor cells. - NIH" height="400px" /></center> ] --- name: description ##Description of Data Set **Data Set Name:** Synthetic Breast Cancer Data (SBCD) **Number of Variables for SBCD:** 11 (10 numerical and 1 categorical) **Source of Data Set:** Applied Analytics through Case Studies Using SAS and R - _Implementing Predictive Models and Machine Learning Techniques_ **Author:** Deepti Gupta --- name:PDF ###Description of SBCD - PDF <center><div class='wrap'> <object data="/Users/timothykelleman/Downloads/syntheticBreastCancerData-Description.pdf" type="application/pdf" width="80%" height="500px"> <p>Unable to display PDF file. <a href="/Users/timothykelleman/Downloads/syntheticBreastCancerData-Description.pdf">Download</a> instead.</p> </object> </div></center> --- name: summary ## Basic Details of Synthetic Breast Cancer Dataset ```r SBCD <- read.csv('/Users/timothykelleman/Downloads/syntheticBreastCancerData.csv') summary(SBCD) ``` ``` ## Sample_No Thickness_of_Clump Cell_Size_Uniformity Cell_Shape_Uniformity ## Min. : 1.0 Min. : 1.00 Min. : 1.000 Min. : 1.000 ## 1st Qu.:150.8 1st Qu.: 3.00 1st Qu.: 2.000 1st Qu.: 2.000 ## Median :300.5 Median : 5.00 Median : 3.000 Median : 3.000 ## Mean :300.5 Mean : 5.41 Mean : 4.122 Mean : 4.195 ## 3rd Qu.:450.2 3rd Qu.: 7.25 3rd Qu.: 6.000 3rd Qu.: 6.000 ## Max. :600.0 Max. :10.00 Max. :10.000 Max. :10.000 ## Marginal_Adhesion Single_Epithelial_Cell_Size Bare_Nuclei Bland_Chromatin ## Min. : 1.000 Min. : 1.000 Min. : 1.0 Min. : 1.000 ## 1st Qu.: 2.000 1st Qu.: 3.000 1st Qu.: 2.0 1st Qu.: 3.000 ## Median : 3.000 Median : 4.000 Median : 3.0 Median : 4.000 ## Mean : 3.763 Mean : 4.293 Mean : 4.5 Mean : 4.495 ## 3rd Qu.: 5.000 3rd Qu.: 5.000 3rd Qu.: 9.0 3rd Qu.: 6.000 ## Max. :10.000 Max. :10.000 Max. :10.0 Max. :10.000 ## Normal_Nucleoli Mitoses Outcome ## Min. : 1.000 Min. : 1.000 Length:600 ## 1st Qu.: 2.000 1st Qu.: 1.000 Class :character ## Median : 3.000 Median : 2.000 Mode :character ## Mean : 3.812 Mean : 2.093 ## 3rd Qu.: 5.000 3rd Qu.: 2.000 ## Max. :10.000 Max. :10.000 ``` --- name: correlation ###Correlation Matrix ```r library(GGally) ggpairs(SBCD, columns = 2:10, aes(color=Outcome), upper = list(continuous = wrap("cor", size = 2))) ``` <img src="Week2HW_files/figure-html/unnamed-chunk-2-1.png" width="100%" style="display: block; margin: auto;" /> --- name: lmmodel ###Summary of lm() Model ```r summary(lm(SBCD$Cell_Size_Uniformity~SBCD$Bland_Chromatin, data = SBCD)) ``` ``` ## ## Call: ## lm(formula = SBCD$Cell_Size_Uniformity ~ SBCD$Bland_Chromatin, ## data = SBCD) ## ## Residuals: ## Min 1Q Median 3Q Max ## -5.7399 -1.5273 -0.1178 1.0672 7.8822 ## ## Coefficients: ## Estimate Std. Error t value Pr(>|t|) ## (Intercept) 0.51144 0.18756 2.727 0.00658 ** ## SBCD$Bland_Chromatin 0.80317 0.03668 21.895 < 2e-16 *** ## --- ## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 ## ## Residual standard error: 2.189 on 598 degrees of freedom ## Multiple R-squared: 0.4449, Adjusted R-squared: 0.444 ## F-statistic: 479.4 on 1 and 598 DF, p-value: < 2.2e-16 ``` --- name: scatterplot ##Basic Scatter Plot .pull-left[ ```r library(ggplot2) plot(SBCD$Cell_Size_Uniformity, SBCD$Bland_Chromatin , main = "Regression Model of Cell Size Uniformity and Bland Chromatin", xlab = "Cell Size Uniformity", ylab = "Bland Chromatin", pch = 1, frame = FALSE) abline(lm(SBCD$Cell_Size_Uniformity~SBCD$Bland_Chromatin, data = SBCD), col = "blue") ``` <img src="Week2HW_files/figure-html/unnamed-chunk-4-1.png" width="100%" style="display: block; margin: auto;" /> ] .pull-right[ ```r lm(SBCD$Cell_Size_Uniformity~SBCD$Bland_Chromatin, data = SBCD) ``` ``` ## ## Call: ## lm(formula = SBCD$Cell_Size_Uniformity ~ SBCD$Bland_Chromatin, ## data = SBCD) ## ## Coefficients: ## (Intercept) SBCD$Bland_Chromatin ## 0.5114 0.8032 ``` ] --- name: density ##Desnsity Chart ```r library(ggplot2) library(geomtextpath) library(hrbrthemes) data(SBCD) p<-ggplot(SBCD, aes(x = Cell_Size_Uniformity, colour = Outcome, label = Outcome)) + geom_textdensity() + theme_bw() + guides(color = 'none') p<- p+ labs(title = "Cell Size Uniformity Density Plot", x = "Cell Size Uniformity") print(p) ``` <img src="Week2HW_files/figure-html/unnamed-chunk-6-1.png" width="75%" style="display: block; margin: auto;" /> --- name: interactive ##Interactive Data Table ```r DT::datatable(head(SBCD,8), fillContainer = FALSE, options = list(pageLength = 8)) ```
--- name: conclusion ##Conclusion The `Bland_Chromatin` variable was chosen as the dependent variable since it was the most normally distributed of the continuous variable options. `Cell_Size_Uniformity` had the highest correlation with the `Bland_Chromatin` variable and was then assigned as the independent variable for the logistic regression model. There is a correlation coeffient of .667 between the `Bland_Chromatin` and `Cell_Size_Uniformity` variables, signifying a strong correlation. With a p-value very close to 0 (2e-16), there is statistical significance to the observed difference.