Penelitian ini bertujuan untuk menganalisis pengaruh berbagai fitur terhadap klasifikasi data menggunakan metode multinomial logistic regression, yang sesuai untuk permasalahan dengan lebih dari dua kelas. Analisis dilakukan secara bertahap meliputi preprocessing data, eksplorasi data (EDA), normalisasi fitur, pembagian data, pembangunan model, serta evaluasi performa.
Data yang digunakan dalam penelitian ini berasal dari UCI Machine Learning Repository dan dapat diakses melalui URL berikut: https://archive.ics.uci.edu/dataset/602/dry+bean+dataset
Dataset awal terdiri dari 13.611 data, kemudian disederhanakan menjadi 910 data melalui teknik sampling dengan mempertimbangkan keseimbangan jumlah data pada setiap kelas (balanced data). Proses penyeimbangan data ini bertujuan untuk menghindari bias pada model klasifikasi. Selain itu, penggunaan sebagian data juga dilakukan untuk meningkatkan efisiensi komputasi tanpa mengurangi representativitas data secara keseluruhan. Evaluasi model dilakukan menggunakan confusion matrix dan nilai akurasi untuk mengukur kinerja model dalam melakukan klasifikasi.
install.packages(c(
"tidyverse",
"caret",
"nnet",
"broom",
"kableExtra",
"marginaleffects",
"corrplot"
))
## Installing packages into '/cloud/lib/x86_64-pc-linux-gnu-library/4.5'
## (as 'lib' is unspecified)
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.2.1 ✔ readr 2.2.0
## ✔ forcats 1.0.1 ✔ stringr 1.6.0
## ✔ ggplot2 4.0.3 ✔ tibble 3.3.1
## ✔ lubridate 1.9.5 ✔ tidyr 1.3.2
## ✔ purrr 1.2.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(caret)
## Loading required package: lattice
##
## Attaching package: 'caret'
##
## The following object is masked from 'package:purrr':
##
## lift
library(nnet)
library(broom)
library(kableExtra)
##
## Attaching package: 'kableExtra'
##
## The following object is masked from 'package:dplyr':
##
## group_rows
library(marginaleffects)
library(corrplot)
## corrplot 0.95 loaded
data <- read.csv("Dry_Bean_Dataset_kcl.csv")
str(data)
## 'data.frame': 910 obs. of 17 variables:
## $ Area : int 45890 31877 85998 41536 38273 51714 53607 68404 49101 41285 ...
## $ Perimeter : num 808 673 1175 734 746 ...
## $ MajorAxisLength: num 307 250 441 256 281 ...
## $ MinorAxisLength: num 191 162 252 207 174 ...
## $ AspectRation : num 1.6 1.54 1.75 1.23 1.62 ...
## $ Eccentricity : num 0.782 0.761 0.821 0.586 0.785 ...
## $ ConvexArea : int 46523 32271 88241 41861 38743 52246 54178 69150 49683 41729 ...
## $ EquivDiameter : num 242 201 331 230 221 ...
## $ Extent : num 0.779 0.72 0.745 0.793 0.731 ...
## $ Solidity : num 0.986 0.988 0.975 0.992 0.988 ...
## $ roundness : num 0.883 0.884 0.783 0.968 0.863 ...
## $ Compactness : num 0.787 0.805 0.75 0.9 0.786 ...
## $ ShapeFactor1 : num 0.00669 0.00785 0.00513 0.00615 0.00734 ...
## $ ShapeFactor2 : num 0.00158 0.00203 0.001 0.00249 0.00173 ...
## $ ShapeFactor3 : num 0.619 0.647 0.562 0.809 0.618 ...
## $ ShapeFactor4 : num 0.994 0.999 0.985 0.999 0.998 ...
## $ Class : chr "SIRA" "DERMASON" "CALI" "SEKER" ...
data$Class <- as.factor(data$Class)
Code tersebut digunakan untuk mengubah tipe data pada kolom Class menjadi factor agar model klasifikasi multinomial logistic regression dapat mengenali setiap nilai dalam Class sebagai kategori kelas
table(data$Class)
##
## BARBUNYA BOMBAY CALI DERMASON HOROZ SEKER SIRA
## 130 130 130 130 130 130 130
ggplot(data, aes(x = Class, y = Area, fill = Class)) +
geom_boxplot() +
theme_minimal() +
ggtitle("Boxplot Area terhadap Class") +
theme(
axis.text.x = element_text(angle = 45, hjust = 1)
)
Pada hasil boxplot nilai area terhadap untuk setiap kelas kacang terlihat bahwa setiap kelas memiliki rentang dan median yang berbeda. Kelas BOMBAY memiliki nilai area paling besar dibandingkan kelas lainnya, sedangkan DERMASON cenderung memiliki area paling kecil. Beberapa titik di luar box menunjukkan adanya outlier.
numeric_data <- data %>% select(where(is.numeric))
cor_matrix <- cor(numeric_data)
corrplot::corrplot(cor_matrix, tl.col = "black", type = "full", tl.srt = 40, tl.cex = 0.5)
Terlihat bahwa fitur seperti Area, Perimeter, MajorAxisLength, dan ConvexArea memiliki korelasi positif yang kuat. Sementara itu, beberapa fitur seperti Compactness, roundness, dan ShapeFactor menunjukkan korelasi negatif terhadap fitur ukuran.
colSums(is.na(data))
## Area Perimeter MajorAxisLength MinorAxisLength AspectRation
## 0 0 0 0 0
## Eccentricity ConvexArea EquivDiameter Extent Solidity
## 0 0 0 0 0
## roundness Compactness ShapeFactor1 ShapeFactor2 ShapeFactor3
## 0 0 0 0 0
## ShapeFactor4 Class
## 0 0
numeric_cols <- sapply(data, is.numeric)
data[numeric_cols] <- scale(data[numeric_cols])
set.seed(123)
trainIndex <- createDataPartition(data$Class, p = 0.8, list = FALSE)
trainData <- data[trainIndex, ]
testData <- data[-trainIndex, ]
Code tersebut membagi data menjadi 80% data latih dan 20% data uji secara proporsional per kelas, serta menggunakan set.seed agar hasil pembagian selalu konsisten.
fit_full <- multinom(Class ~ ., data = trainData)
## # weights: 126 (102 variable)
## initial value 1416.622589
## iter 10 value 252.802669
## iter 20 value 115.449005
## iter 30 value 105.385801
## iter 40 value 102.511380
## iter 50 value 100.987913
## iter 60 value 100.343565
## iter 70 value 99.571003
## iter 80 value 99.152343
## iter 90 value 98.868405
## iter 100 value 98.531609
## final value 98.531609
## stopped after 100 iterations
Code ini untuk melatih model multinomial logistic regression dengan Class sebagai target dan semua fitur sebagai prediktor. Output menunjukkan proses iterasi di mana nilai loss terus menurun hingga mencapai nilai akhir, menandakan model berhasil belajar dengan baik dan konvergen setelah 100 iterasi.
fit_null <- multinom(Class ~ 1, data = trainData)
## # weights: 14 (6 variable)
## initial value 1416.622589
## final value 1416.622589
## converged
LL_full <- logLik(fit_full)
LL_null <- logLik(fit_null)
G <- -2 * (LL_null - LL_full)
df <- attr(LL_full, "df") - attr(LL_null, "df")
p_value_LR <- pchisq(G, df, lower.tail = FALSE)
G
## 'log Lik.' 2636.182 (df=6)
df
## [1] 96
p_value_LR
## 'log Lik.' 0 (df=6)
Berdasarkan output uji independensi (Likelihood Ratio Test) pada model multinomial logistic regression, diperoleh nilai log likelihood model penuh sebesar 2636,182 dan log likelihood model tanpa prediktor sebesar 0, dengan selisih derajat bebas sebesar 96. Perbedaan nilai ini menghasilkan statistik uji yang sangat besar dengan p-value mendekati nol. Hal ini menunjukkan bahwa secara simultan seluruh variabel pengukuran bentuk dan ukuran biji kacang seperti Area, Perimeter, MajorAxisLength, dan variabel lainnya memiliki pengaruh yang signifikan terhadap klasifikasi kelas kacang (BARBUNYA, BOMBAY, CALI, DERMASON, HOROZ, SEKER, dan SIRA). Dengan demikian, variabel-variabel tersebut tidak bersifat independen terhadap kelas, melainkan secara bersama-sama mampu menjelaskan perbedaan antar kelas kacang.
z <- summary(fit_full)$coefficients / summary(fit_full)$standard.errors
p_value_wald <- (1 - pnorm(abs(z), 0, 1)) * 2
p_value_wald
## (Intercept) Area Perimeter MajorAxisLength MinorAxisLength
## BOMBAY 0.9850600 0.8712115 0.7944025 0.8329614 0.9795120
## CALI 0.7443691 0.9544550 0.7845601 0.9778936 0.9772253
## DERMASON 0.8264430 0.9092854 0.9766765 0.9937842 0.9868427
## HOROZ 0.6706138 0.9116665 0.9549015 0.9506926 0.9836990
## SEKER 0.8676446 0.9632608 0.9797685 0.9965548 0.9865039
## SIRA 0.8281760 0.9863091 0.9892249 0.9995873 0.9654756
## AspectRation Eccentricity ConvexArea EquivDiameter Extent
## BOMBAY 0.9575725 0.9753327 0.8875809 0.9270677 0.9261813
## CALI 0.9754151 0.9810537 0.9888964 0.9899711 0.3614771
## DERMASON 0.8215736 0.9064562 0.9045654 0.9472776 0.7059211
## HOROZ 0.9547635 0.9542528 0.9315858 0.9643577 0.8764332
## SEKER 0.9153180 0.9444280 0.9603400 0.9743016 0.6237358
## SIRA 0.9197979 0.8898028 0.9781760 0.9233539 0.9077193
## Solidity roundness Compactness ShapeFactor1 ShapeFactor2
## BOMBAY 0.93133877 0.9555620 0.9802272 0.8031193 0.8393473
## CALI 0.20254718 0.6095197 0.9994495 0.9867236 0.9885591
## DERMASON 0.45089612 0.5131358 0.8793019 0.6935874 0.9371629
## HOROZ 0.15145907 0.9055892 0.9918739 0.7709554 0.8601328
## SEKER 0.02611095 0.8071640 0.9853322 0.9327286 0.8012837
## SIRA 0.28715785 0.5880506 0.9791587 0.8781151 0.9495754
## ShapeFactor3 ShapeFactor4
## BOMBAY 0.9936069 0.9336279
## CALI 0.9880263 0.4401345
## DERMASON 0.8930959 0.7524359
## HOROZ 0.9654815 0.6077368
## SEKER 0.9886184 0.8370066
## SIRA 0.9541651 0.6242765
Hasil uji parsial (Wald test) menunjukkan bahwa tidak terdapat variabel yang berpengaruh signifikan secara individu terhadap klasifikasi jenis kacang (p-value > 0,05). Hal ini disebabkan oleh adanya hubungan yang kuat antar variabel (multikolinearitas), sehingga pengaruh variabel baru terlihat ketika diuji secara simultan. Hal ini dibuktikan pada uji serentak (Likelihood Ratio Test) yang menunjukkan bahwa model signifikan secara keseluruhan.
summary(fit_full)
## Call:
## multinom(formula = Class ~ ., data = trainData)
##
## Coefficients:
## (Intercept) Area Perimeter MajorAxisLength MinorAxisLength
## BOMBAY -3.771418 18.098438 9.327555 13.2787480 3.329248
## CALI -4.039492 -15.889660 28.687010 -6.5683595 6.719376
## DERMASON -10.355377 12.582015 -5.781055 -2.0410432 -5.347781
## HOROZ 9.661065 22.228501 4.747476 17.7453050 -5.028911
## SEKER -7.887765 6.374269 -5.478150 -0.8653203 -5.161402
## SIRA -8.466779 1.862205 -2.460132 -0.1270451 -12.178400
## AspectRation Eccentricity ConvexArea EquivDiameter Extent Solidity
## BOMBAY 10.069340 -8.030504 18.391444 7.741162 -2.7710752 2.850839
## CALI 3.260938 1.975511 -3.526355 -2.062791 0.5443060 3.219666
## DERMASON -23.642527 -9.952692 12.875069 -3.276164 -0.4094107 1.904882
## HOROZ -8.330088 12.327349 19.734160 7.609842 -0.1359260 3.069299
## SEKER 10.854157 5.955628 6.771905 -3.094337 0.6470415 7.842781
## SIRA 8.924687 10.162892 2.767951 -7.716734 0.1179685 2.516975
## roundness Compactness ShapeFactor1 ShapeFactor2 ShapeFactor3
## BOMBAY 10.046636 -1.9509300 27.038543 25.024808 0.6394824
## CALI 7.313039 -0.1881134 2.242464 -2.162460 -3.5164154
## DERMASON 11.571996 -11.6261557 32.868782 9.937028 -21.1220841
## HOROZ 1.509761 -2.2411137 40.537107 33.974062 -8.3741346
## SEKER 4.811833 -1.8052595 6.947026 33.362508 -1.7416148
## SIRA 10.330598 2.3836793 13.768612 9.670580 9.1619888
## ShapeFactor4
## BOMBAY -4.146662
## CALI -4.518708
## DERMASON 1.872320
## HOROZ -4.199221
## SEKER 1.399030
## SIRA -2.713007
##
## Std. Errors:
## (Intercept) Area Perimeter MajorAxisLength MinorAxisLength
## BOMBAY 201.40446 111.6362 35.79288 62.9608 129.6399
## CALI 12.38830 278.2133 104.93402 237.0405 235.3735
## DERMASON 47.22750 110.4268 197.73832 261.9917 324.2845
## HOROZ 22.71557 200.3710 83.94785 286.9689 246.1324
## SEKER 47.33102 138.3843 216.02229 200.3994 305.1263
## SIRA 39.00996 108.5210 182.16504 245.5911 281.3637
## AspectRation Eccentricity ConvexArea EquivDiameter Extent
## BOMBAY 189.27326 259.71248 130.0981 84.57073 29.9089350
## CALI 105.81439 83.18698 253.3890 164.10891 0.5964644
## DERMASON 104.83493 84.69680 107.3852 49.54432 1.0849923
## HOROZ 146.84781 214.88549 229.8684 170.29634 0.8741651
## SEKER 102.07688 85.43969 136.1818 96.05648 1.3189784
## SIRA 88.63673 73.34983 101.1837 80.20732 1.0177088
## Solidity roundness Compactness ShapeFactor1 ShapeFactor2 ShapeFactor3
## BOMBAY 33.087504 180.29430 78.71712 108.45257 123.4400 79.80917
## CALI 2.526559 14.31798 272.66177 134.76122 150.8040 234.31295
## DERMASON 2.526630 17.69519 76.56127 83.42514 126.0465 157.17266
## HOROZ 2.139784 12.72944 220.04602 139.24274 192.8098 193.50490
## SEKER 3.525547 19.71366 98.19549 82.29873 132.5560 122.08867
## SIRA 2.364740 19.07200 91.24615 89.78018 152.9189 159.40220
## ShapeFactor4
## BOMBAY 49.791017
## CALI 5.853505
## DERMASON 5.935788
## HOROZ 8.180726
## SEKER 6.800519
## SIRA 5.539027
##
## Residual Deviance: 197.0632
## AIC: 401.0632
tidy(fit_full, conf.int = TRUE) %>%
kable() %>%
kable_styling("basic", full_width = FALSE)
| y.level | term | estimate | std.error | statistic | p.value | conf.low | conf.high |
|---|---|---|---|---|---|---|---|
| BOMBAY | (Intercept) | -3.7714181 | 201.4044645 | -0.0187256 | 0.9850600 | -398.5169148 | 390.974079 |
| BOMBAY | Area | 18.0984381 | 111.6362264 | 0.1621198 | 0.8712115 | -200.7045450 | 236.901421 |
| BOMBAY | Perimeter | 9.3275552 | 35.7928834 | 0.2605980 | 0.7944025 | -60.8252071 | 79.480317 |
| BOMBAY | MajorAxisLength | 13.2787480 | 62.9607994 | 0.2109050 | 0.8329614 | -110.1221513 | 136.679647 |
| BOMBAY | MinorAxisLength | 3.3292482 | 129.6399125 | 0.0256807 | 0.9795120 | -250.7603112 | 257.418808 |
| BOMBAY | AspectRation | 10.0693404 | 189.2732648 | 0.0532000 | 0.9575725 | -360.8994418 | 381.038123 |
| BOMBAY | Eccentricity | -8.0305041 | 259.7124767 | -0.0309207 | 0.9753327 | -517.0576048 | 500.996597 |
| BOMBAY | ConvexArea | 18.3914441 | 130.0981447 | 0.1413659 | 0.8875809 | -236.5962340 | 273.379122 |
| BOMBAY | EquivDiameter | 7.7411619 | 84.5707289 | 0.0915348 | 0.9270677 | -158.0144208 | 173.496745 |
| BOMBAY | Extent | -2.7710752 | 29.9089350 | -0.0926504 | 0.9261813 | -61.3915107 | 55.849360 |
| BOMBAY | Solidity | 2.8508386 | 33.0875041 | 0.0861606 | 0.9313388 | -61.9994778 | 67.701155 |
| BOMBAY | roundness | 10.0466364 | 180.2942967 | 0.0557235 | 0.9555620 | -343.3236919 | 363.416965 |
| BOMBAY | Compactness | -1.9509300 | 78.7171191 | -0.0247841 | 0.9802272 | -156.2336484 | 152.331788 |
| BOMBAY | ShapeFactor1 | 27.0385432 | 108.4525683 | 0.2493122 | 0.8031193 | -185.5245846 | 239.601671 |
| BOMBAY | ShapeFactor2 | 25.0248084 | 123.4400233 | 0.2027285 | 0.8393473 | -216.9131915 | 266.962808 |
| BOMBAY | ShapeFactor3 | 0.6394824 | 79.8091723 | 0.0080126 | 0.9936069 | -155.7836209 | 157.062586 |
| BOMBAY | ShapeFactor4 | -4.1466617 | 49.7910172 | -0.0832813 | 0.9336279 | -101.7352622 | 93.441939 |
| CALI | (Intercept) | -4.0394924 | 12.3883031 | -0.3260731 | 0.7443691 | -28.3201203 | 20.241135 |
| CALI | Area | -15.8896597 | 278.2132912 | -0.0571132 | 0.9544550 | -561.1776905 | 529.398371 |
| CALI | Perimeter | 28.6870098 | 104.9340232 | 0.2733814 | 0.7845601 | -176.9798964 | 234.353916 |
| CALI | MajorAxisLength | -6.5683595 | 237.0405191 | -0.0277099 | 0.9778936 | -471.1592397 | 458.022521 |
| CALI | MinorAxisLength | 6.7193763 | 235.3735334 | 0.0285477 | 0.9772253 | -454.6042722 | 468.043025 |
| CALI | AspectRation | 3.2609381 | 105.8143875 | 0.0308175 | 0.9754151 | -204.1314505 | 210.653327 |
| CALI | Eccentricity | 1.9755109 | 83.1869779 | 0.0237478 | 0.9810537 | -161.0679698 | 165.018991 |
| CALI | ConvexArea | -3.5263548 | 253.3889609 | -0.0139168 | 0.9888964 | -500.1595922 | 493.106883 |
| CALI | EquivDiameter | -2.0627905 | 164.1089122 | -0.0125696 | 0.9899711 | -323.7103480 | 319.584767 |
| CALI | Extent | 0.5443060 | 0.5964644 | 0.9125541 | 0.3614771 | -0.6247427 | 1.713355 |
| CALI | Solidity | 3.2196655 | 2.5265594 | 1.2743281 | 0.2025472 | -1.7322999 | 8.171631 |
| CALI | roundness | 7.3130386 | 14.3179777 | 0.5107592 | 0.6095197 | -20.7496821 | 35.375759 |
| CALI | Compactness | -0.1881134 | 272.6617748 | -0.0006899 | 0.9994495 | -534.5953720 | 534.219145 |
| CALI | ShapeFactor1 | 2.2424643 | 134.7612185 | 0.0166403 | 0.9867236 | -261.8846705 | 266.369599 |
| CALI | ShapeFactor2 | -2.1624600 | 150.8039657 | -0.0143395 | 0.9885591 | -297.7328014 | 293.407881 |
| CALI | ShapeFactor3 | -3.5164154 | 234.3129457 | -0.0150073 | 0.9880263 | -462.7613501 | 455.728519 |
| CALI | ShapeFactor4 | -4.5187081 | 5.8535055 | -0.7719662 | 0.4401345 | -15.9913680 | 6.953952 |
| DERMASON | (Intercept) | -10.3553773 | 47.2274958 | -0.2192659 | 0.8264430 | -102.9195682 | 82.208814 |
| DERMASON | Area | 12.5820149 | 110.4267818 | 0.1139399 | 0.9092854 | -203.8505004 | 229.014530 |
| DERMASON | Perimeter | -5.7810551 | 197.7383223 | -0.0292359 | 0.9766765 | -393.3410451 | 381.778935 |
| DERMASON | MajorAxisLength | -2.0410432 | 261.9917440 | -0.0077905 | 0.9937842 | -515.5354257 | 511.453339 |
| DERMASON | MinorAxisLength | -5.3477810 | 324.2844503 | -0.0164910 | 0.9868427 | -640.9336243 | 630.238062 |
| DERMASON | AspectRation | -23.6425269 | 104.8349324 | -0.2255215 | 0.8215736 | -229.1152189 | 181.830165 |
| DERMASON | Eccentricity | -9.9526916 | 84.6967995 | -0.1175097 | 0.9064562 | -175.9553682 | 156.049985 |
| DERMASON | ConvexArea | 12.8750686 | 107.3851748 | 0.1198961 | 0.9045654 | -197.5960066 | 223.346144 |
| DERMASON | EquivDiameter | -3.2761644 | 49.5443247 | -0.0661259 | 0.9472776 | -100.3812564 | 93.828928 |
| DERMASON | Extent | -0.4094107 | 1.0849923 | -0.3773397 | 0.7059211 | -2.5359565 | 1.717135 |
| DERMASON | Solidity | 1.9048820 | 2.5266305 | 0.7539219 | 0.4508961 | -3.0472226 | 6.856987 |
| DERMASON | roundness | 11.5719965 | 17.6951928 | 0.6539627 | 0.5131358 | -23.1099440 | 46.253937 |
| DERMASON | Compactness | -11.6261557 | 76.5612668 | -0.1518543 | 0.8793019 | -161.6834812 | 138.431170 |
| DERMASON | ShapeFactor1 | 32.8687823 | 83.4251381 | 0.3939913 | 0.6935874 | -130.6414839 | 196.379049 |
| DERMASON | ShapeFactor2 | 9.9370278 | 126.0464884 | 0.0788362 | 0.9371629 | -237.1095500 | 256.983606 |
| DERMASON | ShapeFactor3 | -21.1220841 | 157.1726562 | -0.1343878 | 0.8930959 | -329.1748296 | 286.930661 |
| DERMASON | ShapeFactor4 | 1.8723203 | 5.9357876 | 0.3154291 | 0.7524359 | -9.7616097 | 13.506250 |
| HOROZ | (Intercept) | 9.6610647 | 22.7155730 | 0.4253058 | 0.6706138 | -34.8606403 | 54.182770 |
| HOROZ | Area | 22.2285014 | 200.3710110 | 0.1109367 | 0.9116665 | -370.4914637 | 414.948466 |
| HOROZ | Perimeter | 4.7474757 | 83.9478467 | 0.0565527 | 0.9549015 | -159.7872805 | 169.282232 |
| HOROZ | MajorAxisLength | 17.7453050 | 286.9688501 | 0.0618370 | 0.9506926 | -544.7033058 | 580.193916 |
| HOROZ | MinorAxisLength | -5.0289114 | 246.1323719 | -0.0204317 | 0.9836990 | -487.4394957 | 477.381673 |
| HOROZ | AspectRation | -8.3300881 | 146.8478083 | -0.0567260 | 0.9547635 | -296.1465036 | 279.486328 |
| HOROZ | Eccentricity | 12.3273490 | 214.8854858 | 0.0573671 | 0.9542528 | -408.8404639 | 433.495162 |
| HOROZ | ConvexArea | 19.7341600 | 229.8683754 | 0.0858498 | 0.9315858 | -430.7995769 | 470.267897 |
| HOROZ | EquivDiameter | 7.6098419 | 170.2963384 | 0.0446859 | 0.9643577 | -326.1648480 | 341.384532 |
| HOROZ | Extent | -0.1359260 | 0.8741651 | -0.1554924 | 0.8764332 | -1.8492581 | 1.577406 |
| HOROZ | Solidity | 3.0692994 | 2.1397841 | 1.4343968 | 0.1514591 | -1.1246004 | 7.263199 |
| HOROZ | roundness | 1.5097606 | 12.7294359 | 0.1186039 | 0.9055892 | -23.4394753 | 26.458997 |
| HOROZ | Compactness | -2.2411137 | 220.0460161 | -0.0101848 | 0.9918739 | -433.5233802 | 429.041153 |
| HOROZ | ShapeFactor1 | 40.5371074 | 139.2427448 | 0.2911255 | 0.7709554 | -232.3736575 | 313.447872 |
| HOROZ | ShapeFactor2 | 33.9740617 | 192.8097732 | 0.1762051 | 0.8601328 | -343.9261496 | 411.874273 |
| HOROZ | ShapeFactor3 | -8.3741346 | 193.5049042 | -0.0432761 | 0.9654815 | -387.6367778 | 370.888509 |
| HOROZ | ShapeFactor4 | -4.1992209 | 8.1807257 | -0.5133066 | 0.6077368 | -20.2331487 | 11.834707 |
| SEKER | (Intercept) | -7.8877652 | 47.3310220 | -0.1666511 | 0.8676446 | -100.6548637 | 84.879333 |
| SEKER | Area | 6.3742694 | 138.3843182 | 0.0460621 | 0.9632608 | -264.8540102 | 277.602549 |
| SEKER | Perimeter | -5.4781496 | 216.0222854 | -0.0253592 | 0.9797685 | -428.8740488 | 417.917750 |
| SEKER | MajorAxisLength | -0.8653203 | 200.3993814 | -0.0043180 | 0.9965548 | -393.6408903 | 391.910250 |
| SEKER | MinorAxisLength | -5.1614017 | 305.1262614 | -0.0169156 | 0.9865039 | -603.1978848 | 592.875081 |
| SEKER | AspectRation | 10.8541572 | 102.0768802 | 0.1063332 | 0.9153180 | -189.2128517 | 210.921166 |
| SEKER | Eccentricity | 5.9556281 | 85.4396859 | 0.0697056 | 0.9444280 | -161.5030790 | 173.414335 |
| SEKER | ConvexArea | 6.7719048 | 136.1817873 | 0.0497269 | 0.9603400 | -260.1394937 | 273.683303 |
| SEKER | EquivDiameter | -3.0943369 | 96.0564757 | -0.0322137 | 0.9743016 | -191.3615698 | 185.172896 |
| SEKER | Extent | 0.6470415 | 1.3189784 | 0.4905626 | 0.6237358 | -1.9381087 | 3.232192 |
| SEKER | Solidity | 7.8427812 | 3.5255465 | 2.2245576 | 0.0261110 | 0.9328370 | 14.752725 |
| SEKER | roundness | 4.8118331 | 19.7136601 | 0.2440862 | 0.8071640 | -33.8262307 | 43.449897 |
| SEKER | Compactness | -1.8052595 | 98.1954912 | -0.0183843 | 0.9853322 | -194.2648856 | 190.654367 |
| SEKER | ShapeFactor1 | 6.9470264 | 82.2987331 | 0.0844123 | 0.9327286 | -154.3555263 | 168.249579 |
| SEKER | ShapeFactor2 | 33.3625077 | 132.5560443 | 0.2516861 | 0.8012837 | -226.4425650 | 293.167580 |
| SEKER | ShapeFactor3 | -1.7416148 | 122.0886703 | -0.0142652 | 0.9886184 | -241.0310115 | 237.547782 |
| SEKER | ShapeFactor4 | 1.3990297 | 6.8005195 | 0.2057239 | 0.8370066 | -11.9297436 | 14.727803 |
| SIRA | (Intercept) | -8.4667795 | 39.0099578 | -0.2170415 | 0.8281760 | -84.9248917 | 67.991333 |
| SIRA | Area | 1.8622049 | 108.5209924 | 0.0171599 | 0.9863091 | -210.8350318 | 214.559441 |
| SIRA | Perimeter | -2.4601324 | 182.1650374 | -0.0135050 | 0.9892249 | -359.4970448 | 354.576780 |
| SIRA | MajorAxisLength | -0.1270451 | 245.5910959 | -0.0005173 | 0.9995873 | -481.4767481 | 481.222658 |
| SIRA | MinorAxisLength | -12.1784000 | 281.3636760 | -0.0432835 | 0.9654756 | -563.6410714 | 539.284271 |
| SIRA | AspectRation | 8.9246871 | 88.6367320 | 0.1006884 | 0.9197979 | -164.8001154 | 182.649489 |
| SIRA | Eccentricity | 10.1628921 | 73.3498298 | 0.1385537 | 0.8898028 | -133.6001325 | 153.925917 |
| SIRA | ConvexArea | 2.7679511 | 101.1836917 | 0.0273557 | 0.9781760 | -195.5484403 | 201.084343 |
| SIRA | EquivDiameter | -7.7167344 | 80.2073221 | -0.0962098 | 0.9233539 | -164.9201970 | 149.486728 |
| SIRA | Extent | 0.1179685 | 1.0177088 | 0.1159158 | 0.9077193 | -1.8767041 | 2.112641 |
| SIRA | Solidity | 2.5169753 | 2.3647400 | 1.0643772 | 0.2871579 | -2.1178298 | 7.151781 |
| SIRA | roundness | 10.3305977 | 19.0719956 | 0.5416632 | 0.5880506 | -27.0498267 | 47.711022 |
| SIRA | Compactness | 2.3836793 | 91.2461495 | 0.0261236 | 0.9791587 | -176.4554876 | 181.222846 |
| SIRA | ShapeFactor1 | 13.7686117 | 89.7801845 | 0.1533591 | 0.8781151 | -162.1973165 | 189.734540 |
| SIRA | ShapeFactor2 | 9.6705803 | 152.9188627 | 0.0632399 | 0.9495754 | -290.0448831 | 309.386044 |
| SIRA | ShapeFactor3 | 9.1619888 | 159.4022048 | 0.0574772 | 0.9541651 | -303.2605917 | 321.584569 |
| SIRA | ShapeFactor4 | -2.7130070 | 5.5390267 | -0.4897985 | 0.6242765 | -13.5692998 | 8.143286 |
Output ini menunjukkan pengaruh tiap variabel terhadap peluang masuk ke suatu kelas. Nilai estimate positif meningkatkan peluang, negatif menurunkan, sedangkan p-value menunjukkan apakah pengaruhnya signifikan.Contoh pada kelas BOMBAY, Area (18.09) meningkatkan peluang, dan Eccentricity (-8.03) menurunkan, tetapi keduanya tidak signifikan karena p-value besar. Jadi, sebagian besar variabel tidak berpengaruh signifikan, sehingga model belum kuat dalam menjelaskan perbedaan kelas.
exp(coef(fit_full))
## (Intercept) Area Perimeter MajorAxisLength MinorAxisLength
## BOMBAY 2.301940e-02 7.245224e+07 1.124361e+04 5.846379e+05 2.791734e+01
## CALI 1.760641e-02 1.256633e-07 2.874816e+12 1.404099e-03 8.283007e+02
## DERMASON 3.182122e-05 2.912726e+05 3.085458e-03 1.298931e-01 4.758699e-03
## HOROZ 1.569449e+04 4.505215e+09 1.152929e+02 5.089651e+07 6.545933e-03
## SEKER 3.753074e-04 5.865567e+02 4.177052e-03 4.209167e-01 5.733657e-03
## SIRA 2.103412e-04 6.437916e+00 8.542364e-02 8.806939e-01 5.140295e-06
## AspectRation Eccentricity ConvexArea EquivDiameter Extent
## BOMBAY 2.360799e+04 3.253841e-04 9.711866e+07 2.301145e+03 0.06259466
## CALI 2.607399e+01 7.210302e+00 2.941193e-02 1.270988e-01 1.72341194
## DERMASON 5.397355e-11 4.759934e-05 3.904552e+05 3.777286e-02 0.66404145
## HOROZ 2.411508e-04 2.257874e+05 3.719091e+08 2.017959e+03 0.87290724
## SEKER 5.174884e+04 3.859192e+02 8.729731e+02 4.530504e-02 1.90988205
## SIRA 7.515231e+03 2.592316e+04 1.592597e+01 4.453125e-04 1.12520869
## Solidity roundness Compactness ShapeFactor1 ShapeFactor2
## BOMBAY 17.302285 2.307803e+04 1.421418e-01 5.529554e+11 7.381356e+10
## CALI 25.019751 1.499727e+03 8.285208e-01 9.416508e+00 1.150418e-01
## DERMASON 6.718615 1.060851e+05 8.929450e-06 1.882482e+14 2.068218e+04
## HOROZ 21.526815 4.525647e+00 1.063400e-01 4.027560e+17 5.685223e+14
## SEKER 2547.279440 1.229568e+02 1.644318e-01 1.040052e+03 3.084274e+14
## SIRA 12.391061 3.065643e+04 1.084473e+01 9.541839e+05 1.584454e+04
## ShapeFactor3 ShapeFactor4
## BOMBAY 1.895500e+00 0.01581713
## CALI 2.970573e-02 0.01090310
## DERMASON 6.711127e-10 6.50336861
## HOROZ 2.307595e-04 0.01500726
## SEKER 1.752372e-01 4.05126710
## SIRA 9.527988e+03 0.06633703
tidy(fit_full, conf.int = TRUE, exponentiate = TRUE) %>%
kable() %>%
kable_styling("basic", full_width = FALSE)
| y.level | term | estimate | std.error | statistic | p.value | conf.low | conf.high |
|---|---|---|---|---|---|---|---|
| BOMBAY | (Intercept) | 2.301940e-02 | 201.4044645 | -0.0187256 | 0.9850600 | 0.0000000 | 6.278920e+169 |
| BOMBAY | Area | 7.245224e+07 | 111.6362264 | 0.1621198 | 0.8712115 | 0.0000000 | 7.673262e+102 |
| BOMBAY | Perimeter | 1.124361e+04 | 35.7928834 | 0.2605980 | 0.7944025 | 0.0000000 | 3.295060e+34 |
| BOMBAY | MajorAxisLength | 5.846379e+05 | 62.9607994 | 0.2109050 | 0.8329614 | 0.0000000 | 2.286739e+59 |
| BOMBAY | MinorAxisLength | 2.791734e+01 | 129.6399125 | 0.0256807 | 0.9795120 | 0.0000000 | 6.245507e+111 |
| BOMBAY | AspectRation | 2.360799e+04 | 189.2732648 | 0.0532000 | 0.9575725 | 0.0000000 | 3.039163e+165 |
| BOMBAY | Eccentricity | 3.254000e-04 | 259.7124767 | -0.0309207 | 0.9753327 | 0.0000000 | 3.802396e+217 |
| BOMBAY | ConvexArea | 9.711866e+07 | 130.0981447 | 0.1413659 | 0.8875809 | 0.0000000 | 5.333893e+118 |
| BOMBAY | EquivDiameter | 2.301145e+03 | 84.5707289 | 0.0915348 | 0.9270677 | 0.0000000 | 2.231921e+75 |
| BOMBAY | Extent | 6.259470e-02 | 29.9089350 | -0.0926504 | 0.9261813 | 0.0000000 | 1.799156e+24 |
| BOMBAY | Solidity | 1.730228e+01 | 33.0875041 | 0.0861606 | 0.9313388 | 0.0000000 | 2.524864e+29 |
| BOMBAY | roundness | 2.307803e+04 | 180.2942967 | 0.0557235 | 0.9555620 | 0.0000000 | 6.760555e+157 |
| BOMBAY | Compactness | 1.421418e-01 | 78.7171191 | -0.0247841 | 0.9802272 | 0.0000000 | 1.435011e+66 |
| BOMBAY | ShapeFactor1 | 5.529554e+11 | 108.4525683 | 0.2493122 | 0.8031193 | 0.0000000 | 1.142046e+104 |
| BOMBAY | ShapeFactor2 | 7.381356e+10 | 123.4400233 | 0.2027285 | 0.8393473 | 0.0000000 | 8.719157e+115 |
| BOMBAY | ShapeFactor3 | 1.895500e+00 | 79.8091723 | 0.0080126 | 0.9936069 | 0.0000000 | 1.627100e+68 |
| BOMBAY | ShapeFactor4 | 1.581710e-02 | 49.7910172 | -0.0832813 | 0.9336279 | 0.0000000 | 3.813453e+40 |
| CALI | (Intercept) | 1.760640e-02 | 12.3883031 | -0.3260731 | 0.7443691 | 0.0000000 | 6.174666e+08 |
| CALI | Area | 1.000000e-07 | 278.2132912 | -0.0571132 | 0.9544550 | 0.0000000 | 8.218476e+229 |
| CALI | Perimeter | 2.874816e+12 | 104.9340232 | 0.2733814 | 0.7845601 | 0.0000000 | 6.006376e+101 |
| CALI | MajorAxisLength | 1.404100e-03 | 237.0405191 | -0.0277099 | 0.9778936 | 0.0000000 | 8.253788e+198 |
| CALI | MinorAxisLength | 8.283007e+02 | 235.3735334 | 0.0285477 | 0.9772253 | 0.0000000 | 1.855679e+203 |
| CALI | AspectRation | 2.607399e+01 | 105.8143875 | 0.0308175 | 0.9754151 | 0.0000000 | 3.058985e+91 |
| CALI | Eccentricity | 7.210302e+00 | 83.1869779 | 0.0237478 | 0.9810537 | 0.0000000 | 4.643414e+71 |
| CALI | ConvexArea | 2.941190e-02 | 253.3889609 | -0.0139168 | 0.9888964 | 0.0000000 | 1.424289e+214 |
| CALI | EquivDiameter | 1.270988e-01 | 164.1089122 | -0.0125696 | 0.9899711 | 0.0000000 | 6.221581e+138 |
| CALI | Extent | 1.723412e+00 | 0.5964644 | 0.9125541 | 0.3614771 | 0.5353992 | 5.547541e+00 |
| CALI | Solidity | 2.501975e+01 | 2.5265594 | 1.2743281 | 0.2025472 | 0.1768771 | 3.539111e+03 |
| CALI | roundness | 1.499727e+03 | 14.3179777 | 0.5107592 | 0.6095197 | 0.0000000 | 2.309389e+15 |
| CALI | Compactness | 8.285208e-01 | 272.6617748 | -0.0006899 | 0.9994495 | 0.0000000 | 1.019593e+232 |
| CALI | ShapeFactor1 | 9.416508e+00 | 134.7612185 | 0.0166403 | 0.9867236 | 0.0000000 | 4.817781e+115 |
| CALI | ShapeFactor2 | 1.150418e-01 | 150.8039657 | -0.0143395 | 0.9885591 | 0.0000000 | 2.663323e+127 |
| CALI | ShapeFactor3 | 2.970570e-02 | 234.3129457 | -0.0150073 | 0.9880263 | 0.0000000 | 8.324941e+197 |
| CALI | ShapeFactor4 | 1.090310e-02 | 5.8535055 | -0.7719662 | 0.4401345 | 0.0000001 | 1.047280e+03 |
| DERMASON | (Intercept) | 3.180000e-05 | 47.2274958 | -0.2192659 | 0.8264430 | 0.0000000 | 5.044686e+35 |
| DERMASON | Area | 2.912726e+05 | 110.4267818 | 0.1139399 | 0.9092854 | 0.0000000 | 2.882350e+99 |
| DERMASON | Perimeter | 3.085500e-03 | 197.7383223 | -0.0292359 | 0.9766765 | 0.0000000 | 6.375067e+165 |
| DERMASON | MajorAxisLength | 1.298931e-01 | 261.9917440 | -0.0077905 | 0.9937842 | 0.0000000 | 1.322401e+222 |
| DERMASON | MinorAxisLength | 4.758700e-03 | 324.2844503 | -0.0164910 | 0.9868427 | 0.0000000 | 5.115791e+273 |
| DERMASON | AspectRation | 0.000000e+00 | 104.8349324 | -0.2255215 | 0.8215736 | 0.0000000 | 9.286184e+78 |
| DERMASON | Eccentricity | 4.760000e-05 | 84.6967995 | -0.1175097 | 0.9064562 | 0.0000000 | 5.910816e+67 |
| DERMASON | ConvexArea | 3.904552e+05 | 107.3851748 | 0.1198961 | 0.9045654 | 0.0000000 | 9.954003e+96 |
| DERMASON | EquivDiameter | 3.777290e-02 | 49.5443247 | -0.0661259 | 0.9472776 | 0.0000000 | 5.615462e+40 |
| DERMASON | Extent | 6.640415e-01 | 1.0849923 | -0.3773397 | 0.7059211 | 0.0791859 | 5.568552e+00 |
| DERMASON | Solidity | 6.718615e+00 | 2.5266305 | 0.7539219 | 0.4508961 | 0.0474906 | 9.504986e+02 |
| DERMASON | roundness | 1.060851e+05 | 17.6951928 | 0.6539627 | 0.5131358 | 0.0000000 | 1.224136e+20 |
| DERMASON | Compactness | 8.900000e-06 | 76.5612668 | -0.1518543 | 0.8793019 | 0.0000000 | 1.317932e+60 |
| DERMASON | ShapeFactor1 | 1.882482e+14 | 83.4251381 | 0.3939913 | 0.6935874 | 0.0000000 | 1.933469e+85 |
| DERMASON | ShapeFactor2 | 2.068218e+04 | 126.0464884 | 0.0788362 | 0.9371629 | 0.0000000 | 4.041679e+111 |
| DERMASON | ShapeFactor3 | 0.000000e+00 | 157.1726562 | -0.1343878 | 0.8930959 | 0.0000000 | 4.096406e+124 |
| DERMASON | ShapeFactor4 | 6.503369e+00 | 5.9357876 | 0.3154291 | 0.7524359 | 0.0000576 | 7.339897e+05 |
| HOROZ | (Intercept) | 1.569449e+04 | 22.7155730 | 0.4253058 | 0.6706138 | 0.0000000 | 3.398427e+23 |
| HOROZ | Area | 4.505215e+09 | 200.3710110 | 0.1109367 | 0.9116665 | 0.0000000 | 1.621173e+180 |
| HOROZ | Perimeter | 1.152929e+02 | 83.9478467 | 0.0565527 | 0.9549015 | 0.0000000 | 3.298672e+73 |
| HOROZ | MajorAxisLength | 5.089651e+07 | 286.9688501 | 0.0618370 | 0.9506926 | 0.0000000 | 9.440958e+251 |
| HOROZ | MinorAxisLength | 6.545900e-03 | 246.1323719 | -0.0204317 | 0.9836990 | 0.0000000 | 2.109727e+207 |
| HOROZ | AspectRation | 2.412000e-04 | 146.8478083 | -0.0567260 | 0.9547635 | 0.0000000 | 2.395354e+121 |
| HOROZ | Eccentricity | 2.257874e+05 | 214.8854858 | 0.0573671 | 0.9542528 | 0.0000000 | 1.838894e+188 |
| HOROZ | ConvexArea | 3.719091e+08 | 229.8683754 | 0.0858498 | 0.9315858 | 0.0000000 | 1.716930e+204 |
| HOROZ | EquivDiameter | 2.017959e+03 | 170.2963384 | 0.0446859 | 0.9643577 | 0.0000000 | 1.825654e+148 |
| HOROZ | Extent | 8.729072e-01 | 0.8741651 | -0.1554924 | 0.8764332 | 0.1573539 | 4.842379e+00 |
| HOROZ | Solidity | 2.152682e+01 | 2.1397841 | 1.4343968 | 0.1514591 | 0.3247822 | 1.426814e+03 |
| HOROZ | roundness | 4.525647e+00 | 12.7294359 | 0.1186039 | 0.9055892 | 0.0000000 | 3.097392e+11 |
| HOROZ | Compactness | 1.063400e-01 | 220.0460161 | -0.0101848 | 0.9918739 | 0.0000000 | 2.138972e+186 |
| HOROZ | ShapeFactor1 | 4.027560e+17 | 139.2427448 | 0.2911255 | 0.7709554 | 0.0000000 | 1.344873e+136 |
| HOROZ | ShapeFactor2 | 5.685223e+14 | 192.8097732 | 0.1762051 | 0.8601328 | 0.0000000 | 7.494178e+178 |
| HOROZ | ShapeFactor3 | 2.308000e-04 | 193.5049042 | -0.0432761 | 0.9654815 | 0.0000000 | 1.188044e+161 |
| HOROZ | ShapeFactor4 | 1.500730e-02 | 8.1807257 | -0.5133066 | 0.6077368 | 0.0000000 | 1.379583e+05 |
| SEKER | (Intercept) | 3.753000e-04 | 47.3310220 | -0.1666511 | 0.8676446 | 0.0000000 | 7.288298e+36 |
| SEKER | Area | 5.865567e+02 | 138.3843182 | 0.0460621 | 0.9632608 | 0.0000000 | 3.641289e+120 |
| SEKER | Perimeter | 4.177100e-03 | 216.0222854 | -0.0253592 | 0.9797685 | 0.0000000 | 3.157712e+181 |
| SEKER | MajorAxisLength | 4.209167e-01 | 200.3993814 | -0.0043180 | 0.9965548 | 0.0000000 | 1.601249e+170 |
| SEKER | MinorAxisLength | 5.733700e-03 | 305.1262614 | -0.0169156 | 0.9865039 | 0.0000000 | 3.036521e+257 |
| SEKER | AspectRation | 5.174884e+04 | 102.0768802 | 0.1063332 | 0.9153180 | 0.0000000 | 3.998514e+91 |
| SEKER | Eccentricity | 3.859192e+02 | 85.4396859 | 0.0697056 | 0.9444280 | 0.0000000 | 2.055365e+75 |
| SEKER | ConvexArea | 8.729731e+02 | 136.1817873 | 0.0497269 | 0.9603400 | 0.0000000 | 7.230168e+118 |
| SEKER | EquivDiameter | 4.530500e-02 | 96.0564757 | -0.0322137 | 0.9743016 | 0.0000000 | 2.627646e+80 |
| SEKER | Extent | 1.909882e+00 | 1.3189784 | 0.4905626 | 0.6237358 | 0.1439760 | 2.533512e+01 |
| SEKER | Solidity | 2.547279e+03 | 3.5255465 | 2.2245576 | 0.0261110 | 2.5417098 | 2.552861e+06 |
| SEKER | roundness | 1.229568e+02 | 19.7136601 | 0.2440862 | 0.8071640 | 0.0000000 | 7.413964e+18 |
| SEKER | Compactness | 1.644318e-01 | 98.1954912 | -0.0183843 | 0.9853322 | 0.0000000 | 6.311599e+82 |
| SEKER | ShapeFactor1 | 1.040052e+03 | 82.2987331 | 0.0844123 | 0.9327286 | 0.0000000 | 1.174529e+73 |
| SEKER | ShapeFactor2 | 3.084274e+14 | 132.5560443 | 0.2516861 | 0.8012837 | 0.0000000 | 2.094414e+127 |
| SEKER | ShapeFactor3 | 1.752372e-01 | 122.0886703 | -0.0142652 | 0.9886184 | 0.0000000 | 1.464505e+103 |
| SEKER | ShapeFactor4 | 4.051267e+00 | 6.8005195 | 0.2057239 | 0.8370066 | 0.0000066 | 2.490024e+06 |
| SIRA | (Intercept) | 2.103000e-04 | 39.0099578 | -0.2170415 | 0.8281760 | 0.0000000 | 3.374898e+29 |
| SIRA | Area | 6.437916e+00 | 108.5209924 | 0.0171599 | 0.9863091 | 0.0000000 | 1.520483e+93 |
| SIRA | Perimeter | 8.542360e-02 | 182.1650374 | -0.0135050 | 0.9892249 | 0.0000000 | 9.789015e+153 |
| SIRA | MajorAxisLength | 8.806939e-01 | 245.5910959 | -0.0005173 | 0.9995873 | 0.0000000 | 9.825278e+208 |
| SIRA | MinorAxisLength | 5.100000e-06 | 281.3636760 | -0.0432835 | 0.9654756 | 0.0000000 | 1.615040e+234 |
| SIRA | AspectRation | 7.515231e+03 | 88.6367320 | 0.1006884 | 0.9197979 | 0.0000000 | 2.107004e+79 |
| SIRA | Eccentricity | 2.592316e+04 | 73.3498298 | 0.1385537 | 0.8898028 | 0.0000000 | 7.066042e+66 |
| SIRA | ConvexArea | 1.592597e+01 | 101.1836917 | 0.0273557 | 0.9781760 | 0.0000000 | 2.137078e+87 |
| SIRA | EquivDiameter | 4.453000e-04 | 80.2073221 | -0.0962098 | 0.9233539 | 0.0000000 | 8.341827e+64 |
| SIRA | Extent | 1.125209e+00 | 1.0177088 | 0.1159158 | 0.9077193 | 0.1530939 | 8.270055e+00 |
| SIRA | Solidity | 1.239106e+01 | 2.3647400 | 1.0643772 | 0.2871579 | 0.1202924 | 1.276377e+03 |
| SIRA | roundness | 3.065643e+04 | 19.0719956 | 0.5416632 | 0.5880506 | 0.0000000 | 5.255737e+20 |
| SIRA | Compactness | 1.084473e+01 | 91.2461495 | 0.0261236 | 0.9791587 | 0.0000000 | 5.059202e+78 |
| SIRA | ShapeFactor1 | 9.541839e+05 | 89.7801845 | 0.1533591 | 0.8781151 | 0.0000000 | 2.515728e+82 |
| SIRA | ShapeFactor2 | 1.584454e+04 | 152.9188627 | 0.0632399 | 0.9495754 | 0.0000000 | 2.315536e+134 |
| SIRA | ShapeFactor3 | 9.527988e+03 | 159.4022048 | 0.0574772 | 0.9541651 | 0.0000000 | 4.596253e+139 |
| SIRA | ShapeFactor4 | 6.633700e-02 | 5.5390267 | -0.4897985 | 0.6242765 | 0.0000013 | 3.440203e+03 |
Output ini adalah odds ratio (exp(coef)), yang menunjukkan perubahan peluang tiap kelas. Nilai > 1 berarti meningkatkan peluang, < 1 menurunkan, dan p-value menentukan signifikansi. Contoh, pada BOMBAY, Area (7.24e+07) meningkatkan peluang dan Eccentricity (3.25e-04) menurunkan, tetapi tidak signifikan. Pada SEKER, Solidity (2547) signifikan (p < 0.05), sehingga benar-benar meningkatkan peluang. Jadi, sebagian besar variabel tidak signifikan, hanya sedikit yang benar-benar berpengaruh.
mfx_selected <- avg_comparisons(
fit_full,
variables = c("Area", "Perimeter", "MajorAxisLength"),
type = "probs"
)
mfx_selected
##
## Term Group Estimate Std. Error z Pr(>|z|) S
## Area BARBUNYA -0.085192 1.35258 -0.06299 0.950 0.1
## Area BOMBAY 0.004596 0.36184 0.01270 0.990 0.0
## Area CALI -0.142745 0.00383 -37.24983 <0.001 1006.5
## Area DERMASON 0.083311 4.95192 0.01682 0.987 0.0
## Area HOROZ 0.346089 4.64336 0.07453 0.941 0.1
## Area SEKER -0.063264 3.17938 -0.01990 0.984 0.0
## Area SIRA -0.142795 0.00726 -19.66228 <0.001 283.5
## MajorAxisLength BARBUNYA -0.054277 1.96395 -0.02764 0.978 0.0
## MajorAxisLength BOMBAY 0.006020 0.33197 0.01813 0.986 0.0
## MajorAxisLength CALI -0.142712 0.01145 -12.46878 <0.001 116.1
## MajorAxisLength DERMASON -0.120942 3.68719 -0.03280 0.974 0.0
## MajorAxisLength HOROZ 0.442883 5.98813 0.07396 0.941 0.1
## MajorAxisLength SEKER -0.007279 1.71083 -0.00425 0.997 0.0
## MajorAxisLength SIRA -0.123691 3.26825 -0.03785 0.970 0.0
## Perimeter BARBUNYA -0.142911 0.00522 -27.39630 <0.001 546.5
## Perimeter BOMBAY -0.000752 0.30525 -0.00246 0.998 0.0
## Perimeter CALI 0.424362 1.32340 0.32066 0.748 0.4
## Perimeter DERMASON -0.062407 3.78881 -0.01647 0.987 0.0
## Perimeter HOROZ -0.101781 1.48150 -0.06870 0.945 0.1
## Perimeter SEKER -0.035249 2.43800 -0.01446 0.988 0.0
## Perimeter SIRA -0.081262 4.76835 -0.01704 0.986 0.0
## 2.5 % 97.5 %
## -2.736 2.566
## -0.705 0.714
## -0.150 -0.135
## -9.622 9.789
## -8.755 9.447
## -6.295 6.168
## -0.157 -0.129
## -3.904 3.795
## -0.645 0.657
## -0.165 -0.120
## -7.348 7.106
## -11.294 12.179
## -3.360 3.346
## -6.529 6.282
## -0.153 -0.133
## -0.599 0.598
## -2.169 3.018
## -7.488 7.364
## -3.005 2.802
## -4.814 4.743
## -9.427 9.265
##
## Type: probs
## Comparison: +1
Output ini menunjukkan marginal effect, yaitu perubahan probabilitas kelas saat variabel naik 1 satuan. Nilai positif berarti peluang naik, negatif berarti turun. Contoh, Area meningkatkan peluang HOROZ (0.346) tapi menurunkan CALI (-0.142). MajorAxisLength juga menaikkan HOROZ (0.442), sedangkan Perimeter menaikkan CALI (0.424). Jadi, tiap variabel memberi pengaruh berbeda pada tiap kelas, dan marginal effect menunjukkan dampaknya secara langsung pada probabilitas.
# prediksi
pred <- predict(fit_full, newdata = testData)
# confusion matrix
conf_matrix <- confusionMatrix(pred, testData$Class)
print(conf_matrix)
## Confusion Matrix and Statistics
##
## Reference
## Prediction BARBUNYA BOMBAY CALI DERMASON HOROZ SEKER SIRA
## BARBUNYA 21 0 2 0 1 0 0
## BOMBAY 0 26 0 0 0 0 0
## CALI 4 0 24 0 1 0 0
## DERMASON 0 0 0 21 0 1 2
## HOROZ 0 0 0 0 24 0 1
## SEKER 0 0 0 0 0 24 1
## SIRA 1 0 0 5 0 1 22
##
## Overall Statistics
##
## Accuracy : 0.8901
## 95% CI : (0.8354, 0.9316)
## No Information Rate : 0.1429
## P-Value [Acc > NIR] : < 2.2e-16
##
## Kappa : 0.8718
##
## Mcnemar's Test P-Value : NA
##
## Statistics by Class:
##
## Class: BARBUNYA Class: BOMBAY Class: CALI Class: DERMASON
## Sensitivity 0.8077 1.0000 0.9231 0.8077
## Specificity 0.9808 1.0000 0.9679 0.9808
## Pos Pred Value 0.8750 1.0000 0.8276 0.8750
## Neg Pred Value 0.9684 1.0000 0.9869 0.9684
## Prevalence 0.1429 0.1429 0.1429 0.1429
## Detection Rate 0.1154 0.1429 0.1319 0.1154
## Detection Prevalence 0.1319 0.1429 0.1593 0.1319
## Balanced Accuracy 0.8942 1.0000 0.9455 0.8942
## Class: HOROZ Class: SEKER Class: SIRA
## Sensitivity 0.9231 0.9231 0.8462
## Specificity 0.9936 0.9936 0.9551
## Pos Pred Value 0.9600 0.9600 0.7586
## Neg Pred Value 0.9873 0.9873 0.9739
## Prevalence 0.1429 0.1429 0.1429
## Detection Rate 0.1319 0.1319 0.1209
## Detection Prevalence 0.1374 0.1374 0.1593
## Balanced Accuracy 0.9583 0.9583 0.9006
# akurasi
accuracy <- conf_matrix$overall["Accuracy"]
print(accuracy)
## Accuracy
## 0.8901099
Code ini digunakan untuk mengevaluasi performa model klasifikasi multinomial. Pertama, model digunakan untuk memprediksi kelas data uji (testData) menggunakan predict. Hasil prediksi kemudian dibandingkan dengan label asli menggunakan confusion matrix, yang menunjukkan jumlah prediksi benar dan salah untuk setiap kelas.
Dari confusion matrix terlihat bahwa sebagian besar data berhasil diklasifikasikan dengan benar (nilai diagonal tinggi), meskipun masih ada beberapa kesalahan, misalnya kelas CALI kadang diprediksi sebagai BARBUNYA, dan SIRA sering tertukar dengan DERMASON. Nilai akurasi sebesar 0.8901 (89%) menunjukkan bahwa model mampu mengklasifikasikan data dengan cukup baik. Selain itu, nilai Kappa = 0.8718 menandakan kesesuaian prediksi dengan data asli sangat kuat. Beberapa kelas seperti BOMBAY memiliki performa sempurna (sensitivity dan specificity = 1), sedangkan kelas seperti SIRA memiliki performa sedikit lebih rendah karena masih ada kesalahan prediksi.
Secara keseluruhan, model sudah bekerja dengan baik dan cukup akurat, meskipun masih ada sedikit kebingungan antar beberapa kelas yang memiliki karakteristik mirip.