2025-09-20

Head of Glass Dataset

head(Glass)
##        RI    Na   Mg   Al    Si    K   Ca Ba   Fe Type
## 1 1.52101 13.64 4.49 1.10 71.78 0.06 8.75  0 0.00    1
## 2 1.51761 13.89 3.60 1.36 72.73 0.48 7.83  0 0.00    1
## 3 1.51618 13.53 3.55 1.54 72.99 0.39 7.78  0 0.00    1
## 4 1.51766 13.21 3.69 1.29 72.61 0.57 8.22  0 0.00    1
## 5 1.51742 13.27 3.62 1.24 73.08 0.55 8.07  0 0.00    1
## 6 1.51596 12.79 3.61 1.62 72.97 0.64 8.07  0 0.26    1

Summary of Glass Dataset

summary(Glass)
##        RI              Na              Mg              Al       
##  Min.   :1.511   Min.   :10.73   Min.   :0.000   Min.   :0.290  
##  1st Qu.:1.517   1st Qu.:12.91   1st Qu.:2.115   1st Qu.:1.190  
##  Median :1.518   Median :13.30   Median :3.480   Median :1.360  
##  Mean   :1.518   Mean   :13.41   Mean   :2.685   Mean   :1.445  
##  3rd Qu.:1.519   3rd Qu.:13.82   3rd Qu.:3.600   3rd Qu.:1.630  
##  Max.   :1.534   Max.   :17.38   Max.   :4.490   Max.   :3.500  
##        Si              K                Ca               Ba       
##  Min.   :69.81   Min.   :0.0000   Min.   : 5.430   Min.   :0.000  
##  1st Qu.:72.28   1st Qu.:0.1225   1st Qu.: 8.240   1st Qu.:0.000  
##  Median :72.79   Median :0.5550   Median : 8.600   Median :0.000  
##  Mean   :72.65   Mean   :0.4971   Mean   : 8.957   Mean   :0.175  
##  3rd Qu.:73.09   3rd Qu.:0.6100   3rd Qu.: 9.172   3rd Qu.:0.000  
##  Max.   :75.41   Max.   :6.2100   Max.   :16.190   Max.   :3.150  
##        Fe          Type  
##  Min.   :0.00000   1:70  
##  1st Qu.:0.00000   2:76  
##  Median :0.00000   3:17  
##  Mean   :0.05701   5:13  
##  3rd Qu.:0.10000   6: 9  
##  Max.   :0.51000   7:29

Distribution of Glass Refractive Index

Distribution Comparison of RI for each Type

R code of Previous Graph

type_label <- factor(Glass$Type, levels = 1:7, 
                     labels = c("Building (float)",
                                "Building (non-float)",
                                "Vehicle (float)",
                                "Vehicle (non-float)",
                                "Containers", 
                                "Tableware",
                                "Headlamps"))
fig <- Glass %>% plot_ly(x = type_label, y = ~RI, split = type_label,
                         type = 'violin', box = list(visible = T), 
                         meanline = list(visible = T), x0 = 'Type') 
fig <- fig %>% layout(xaxis = list(title = "Type"), 
                      yaxis = list(title = "Refractive Index", 
                      zeroline = F))
fig

Refractive Index vs Si Amount

## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'

Distribtuion of Fe ranges in the Glass

Simple Linear Regression: Mg Amount vs Refractive Index Graph

Simple Linear Regression: Mg Amount vs Refractive Index Summary

## 
## Call:
## lm(formula = Glass$Mg ~ Glass$RI)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -3.1036 -0.4792  0.7150  0.8801  1.9590 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)  
## (Intercept)    90.87      49.16   1.848   0.0659 .
## Glass$RI      -58.08      32.38  -1.794   0.0743 .
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.435 on 212 degrees of freedom
## Multiple R-squared:  0.01495,    Adjusted R-squared:  0.0103 
## F-statistic: 3.218 on 1 and 212 DF,  p-value: 0.07427

Mg Amount vs Refractive Index Formula \[ Mg = 90.87 - 58.08*(RI) \]

Simple Linear Regression: Mg Amount vs Refractive Variance

\[ R^2 = 1.434957 ^ 2 = 2.059101 \]