library(tidyverse)
library(clustMixType)my_theme <- function(base_size = 10, base_family = "sans"){
theme_minimal(base_size = base_size, base_family = base_family) +
theme(
axis.text = element_text(size = 10),
axis.text.x = element_text(angle = 0, vjust = 0.5, hjust = 0.5),
axis.title = element_text(size = 10),
panel.grid.major = element_line(color = "gray"),
panel.grid.minor = element_blank(),
panel.background = element_rect(fill = "#f7fdff"),
strip.background = element_rect(fill = "#001d60", color = "#00113a", size =0.5),
strip.text = element_text(face = "bold", size = 10, color = "white"),
legend.position = "bottom",
legend.justification = "center",
legend.background = element_blank(),
panel.border = element_rect(color = "grey5", fill = NA, size = 0.5)
)
}
theme_set(my_theme())
clust_colmap = c("#f7286d","#1faae0","#ffbf1f")ckd=read.csv("chronic_kidney_disease.arff",
header=F,
comment.char="@",
na.strings=c("?","","\t?"),)
names(ckd)=c("Age","BP","SPG","Albumin",
"Sugar","RBC","PC",
"PCC","Bact","BGlu",
"BUrea","SerCreat",
"Sodium","K","Hb",
"PCV","WBC","RBCCount",
"HTA","DIA","CAD",
"APP","PedEdema",
"Anemia","CKD")
ckd$DIA=recode_factor(ckd$DIA,
`yes`="TRUE",
`no`="FALSE",
`\tno`="FALSE",
`\tyes`="TRUE",
` yes`="TRUE")%>%as.logical()
ckd$CKD=recode_factor(ckd$CKD,
`ckd`="TRUE",
`no`="FALSE",
`ckd\t`="TRUE",
`notckd`="FALSE")%>%as.logical()
ckd$HTA=recode_factor(ckd$HTA,
`yes`="TRUE",
`no`="FALSE")%>%as.logical()
ckd$Age=recode_factor(ckd$Age,
`notckd`="NA")%>%as.numeric()
df=select(ckd,c(Age,BP,RBCCount,SPG,Albumin,Sugar,PC,PCC,Bact,BGlu,BUrea,
SerCreat,Sodium,K,Hb,PCV,WBC,Anemia,PedEdema,DIA,
HTA,CKD))
df=subset(df,DIA!="NA" & HTA!="NA" & CKD!="NA")%>%as_tibble()
df$BP=as.numeric(df$BP)
df$BGlu=as.numeric(df$BGlu)
df$PCV=as.numeric(df$PCV)
df$WBC=as.numeric(df$WBC)
df$Albumin = as.factor(df$Albumin)
df$Sugar= as.factor(df$Sugar)
rm(ckd)
head(df)## # A tibble: 6 × 22
## Age BP RBCCount SPG Albumin Sugar PC PCC Bact BGlu BUrea
## <dbl> <dbl> <dbl> <dbl> <fct> <fct> <chr> <chr> <chr> <dbl> <dbl>
## 1 2 80 5.2 1.02 1 0 normal notpresent notp… 121 36
## 2 3 50 NA 1.02 4 0 normal notpresent notp… NA 18
## 3 4 80 NA 1.01 2 3 normal notpresent notp… 423 53
## 4 2 70 3.9 1.00 4 0 abnormal present notp… 117 56
## 5 5 80 4.6 1.01 2 0 normal notpresent notp… 106 26
## 6 6 90 4.4 1.01 3 0 <NA> notpresent notp… 74 25
## # … with 11 more variables: SerCreat <dbl>, Sodium <dbl>, K <dbl>, Hb <dbl>,
## # PCV <dbl>, WBC <dbl>, Anemia <chr>, PedEdema <chr>, DIA <lgl>, HTA <lgl>,
## # CKD <lgl>
bar_missing <- function(x){
require(reshape2)
x %>%
is.na %>%
melt %>%
ggplot(data = .,
aes(x = Var2)) +
geom_bar(aes(y=(..count..),fill=value),alpha=0.7)+
scale_fill_manual(values=c("skyblue","red"),
name = "",
labels = c("Available","Missing"))+
theme_minimal()+
theme(axis.text.x = element_text(angle=45, vjust=0.5)) +
labs(x = "Variables in Dataset",
y = "Observations")+coord_flip()
}
bar_missing(df)df %>% select(CKD,HTA,DIA,
Age,BP,
Bact,PCC,Anemia,PedEdema,
SPG,Albumin,Sugar,BUrea,SerCreat,BGlu) %>%na.omit() -> df
str(df)## tibble [288 × 15] (S3: tbl_df/tbl/data.frame)
## $ CKD : logi [1:288] TRUE TRUE TRUE TRUE TRUE TRUE ...
## $ HTA : logi [1:288] TRUE FALSE TRUE FALSE TRUE FALSE ...
## $ DIA : logi [1:288] TRUE TRUE FALSE FALSE TRUE FALSE ...
## $ Age : num [1:288] 2 4 2 5 6 7 9 10 11 12 ...
## $ BP : num [1:288] 80 80 70 80 90 70 100 90 60 70 ...
## $ Bact : chr [1:288] "notpresent" "notpresent" "notpresent" "notpresent" ...
## $ PCC : chr [1:288] "notpresent" "notpresent" "present" "notpresent" ...
## $ Anemia : chr [1:288] "no" "yes" "yes" "no" ...
## $ PedEdema: chr [1:288] "no" "no" "yes" "no" ...
## $ SPG : num [1:288] 1.02 1.01 1 1.01 1.01 ...
## $ Albumin : Factor w/ 6 levels "0","1","2","3",..: 2 3 5 3 4 1 4 3 3 4 ...
## $ Sugar : Factor w/ 6 levels "0","1","2","3",..: 1 4 1 1 1 1 1 1 5 1 ...
## $ BUrea : num [1:288] 36 53 56 26 25 54 60 107 55 60 ...
## $ SerCreat: num [1:288] 1.2 1.8 3.8 1.4 1.1 24 1.9 7.2 4 2.7 ...
## $ BGlu : num [1:288] 121 423 117 106 74 100 138 70 490 380 ...
## - attr(*, "na.action")= 'omit' Named int [1:109] 2 8 14 18 22 24 25 29 30 31 ...
## ..- attr(*, "names")= chr [1:109] "2" "8" "14" "18" ...
df %>% gather(c(Age,BP,SPG, BUrea:BGlu),
key="Parameter",
value="Value")%>%
ggplot(aes(x=Value,fill=HTA))+
geom_density(alpha=0.5)+
ggtitle("Hypertension")+
facet_wrap(~Parameter,ncol=2,scales="free")+
scale_fill_manual(values = c("blue","red"))+
my_theme()df %>% gather(c(Age,BP,SPG, BUrea:BGlu),
key="Parameter",
value="Value")%>%
ggplot(aes(x=Value,fill=CKD))+
geom_density(alpha=0.5)+
ggtitle("Chronic kidney disease")+
facet_wrap(~Parameter,ncol=2,scales="free")+
scale_fill_manual(values = c("blue","red"))+
my_theme()df %>% gather(c(Age,BP,SPG, BUrea:BGlu),
key="Parameter",
value="Value")%>%
ggplot(aes(x=Value,fill=DIA))+
geom_density(alpha=0.5)+
ggtitle("Diabetes")+
facet_wrap(~Parameter,ncol=2,scales="free")+
scale_fill_manual(values = c("blue","red"))+
my_theme()scaled_df = df %>%as.data.frame()
scaled_df[,c(4,5,10,13:15)] <- scale(df[,c(4,5,10,13:15)])
head(scaled_df)## CKD HTA DIA Age BP Bact PCC Anemia PedEdema
## 1 TRUE TRUE TRUE -1.412776 0.3142428 notpresent notpresent no no
## 2 TRUE FALSE TRUE -1.312806 0.3142428 notpresent notpresent yes no
## 3 TRUE TRUE FALSE -1.412776 -0.5085020 notpresent present yes yes
## 4 TRUE FALSE FALSE -1.262821 0.3142428 notpresent notpresent no no
## 5 TRUE TRUE TRUE -1.212836 1.1369876 notpresent notpresent no yes
## 6 TRUE FALSE FALSE -1.162850 -0.5085020 notpresent notpresent no no
## SPG Albumin Sugar BUrea SerCreat BGlu
## 1 0.3887572 1 0 -0.381912780 -0.3721040 -0.3335830
## 2 -1.3606503 2 3 -0.028251043 -0.2089071 3.5514882
## 3 -2.2353540 4 0 0.034159852 0.3350825 -0.3850409
## 4 -1.3606503 2 0 -0.589949095 -0.3177050 -0.5265501
## 5 -0.4859465 3 0 -0.610752727 -0.3993034 -0.9382132
## 6 -1.3606503 0 0 -0.007447411 5.8293770 -0.6037369
library(clustMixType)
X_mat = scaled_df %>% select(-c(1:3))
head(X_mat)## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 1 -1.412776 0.3142428 notpresent notpresent no no 0.3887572 1
## 2 -1.312806 0.3142428 notpresent notpresent yes no -1.3606503 2
## 3 -1.412776 -0.5085020 notpresent present yes yes -2.2353540 4
## 4 -1.262821 0.3142428 notpresent notpresent no no -1.3606503 2
## 5 -1.212836 1.1369876 notpresent notpresent no yes -0.4859465 3
## 6 -1.162850 -0.5085020 notpresent notpresent no no -1.3606503 0
## Sugar BUrea SerCreat BGlu
## 1 0 -0.381912780 -0.3721040 -0.3335830
## 2 3 -0.028251043 -0.2089071 3.5514882
## 3 0 0.034159852 0.3350825 -0.3850409
## 4 0 -0.589949095 -0.3177050 -0.5265501
## 5 0 -0.610752727 -0.3993034 -0.9382132
## 6 0 -0.007447411 5.8293770 -0.6037369
dim(X_mat)## [1] 288 12
Es <- numeric(10)
for(i in 1:10){
kpres <- kproto(X_mat,
k = i, nstart = 5,
lambda = lambdaest(X_mat),
verbose = FALSE)
Es[i] <- kpres$tot.withinss}## Numeric variances:
## Age BP SPG BUrea SerCreat BGlu
## 1 1 1 1 1 1
## Average numeric variance: 1
##
## Heuristic for categorical variables: (method = 1)
## Albumin Sugar
## 0.6178144 0.3156346
## Average categorical variation: 0.4667245
##
## Estimated lambda: 2.142591
##
## Numeric variances:
## Age BP SPG BUrea SerCreat BGlu
## 1 1 1 1 1 1
## Average numeric variance: 1
##
## Heuristic for categorical variables: (method = 1)
## Albumin Sugar
## 0.6178144 0.3156346
## Average categorical variation: 0.4667245
##
## Estimated lambda: 2.142591
##
## Numeric variances:
## Age BP SPG BUrea SerCreat BGlu
## 1 1 1 1 1 1
## Average numeric variance: 1
##
## Heuristic for categorical variables: (method = 1)
## Albumin Sugar
## 0.6178144 0.3156346
## Average categorical variation: 0.4667245
##
## Estimated lambda: 2.142591
##
## Numeric variances:
## Age BP SPG BUrea SerCreat BGlu
## 1 1 1 1 1 1
## Average numeric variance: 1
##
## Heuristic for categorical variables: (method = 1)
## Albumin Sugar
## 0.6178144 0.3156346
## Average categorical variation: 0.4667245
##
## Estimated lambda: 2.142591
##
## Numeric variances:
## Age BP SPG BUrea SerCreat BGlu
## 1 1 1 1 1 1
## Average numeric variance: 1
##
## Heuristic for categorical variables: (method = 1)
## Albumin Sugar
## 0.6178144 0.3156346
## Average categorical variation: 0.4667245
##
## Estimated lambda: 2.142591
##
## Numeric variances:
## Age BP SPG BUrea SerCreat BGlu
## 1 1 1 1 1 1
## Average numeric variance: 1
##
## Heuristic for categorical variables: (method = 1)
## Albumin Sugar
## 0.6178144 0.3156346
## Average categorical variation: 0.4667245
##
## Estimated lambda: 2.142591
##
## Numeric variances:
## Age BP SPG BUrea SerCreat BGlu
## 1 1 1 1 1 1
## Average numeric variance: 1
##
## Heuristic for categorical variables: (method = 1)
## Albumin Sugar
## 0.6178144 0.3156346
## Average categorical variation: 0.4667245
##
## Estimated lambda: 2.142591
##
## Numeric variances:
## Age BP SPG BUrea SerCreat BGlu
## 1 1 1 1 1 1
## Average numeric variance: 1
##
## Heuristic for categorical variables: (method = 1)
## Albumin Sugar
## 0.6178144 0.3156346
## Average categorical variation: 0.4667245
##
## Estimated lambda: 2.142591
##
## Numeric variances:
## Age BP SPG BUrea SerCreat BGlu
## 1 1 1 1 1 1
## Average numeric variance: 1
##
## Heuristic for categorical variables: (method = 1)
## Albumin Sugar
## 0.6178144 0.3156346
## Average categorical variation: 0.4667245
##
## Estimated lambda: 2.142591
##
## Numeric variances:
## Age BP SPG BUrea SerCreat BGlu
## 1 1 1 1 1 1
## Average numeric variance: 1
##
## Heuristic for categorical variables: (method = 1)
## Albumin Sugar
## 0.6178144 0.3156346
## Average categorical variation: 0.4667245
##
## Estimated lambda: 2.142591
tibble(Cluster = c(1:10), Es = Es) %>%
ggplot(aes(x = Cluster, y = Es)) +
geom_point(size = 3,
col ="red3") +
geom_path() +
geom_vline(xintercept = 3,
linetype = 2)+
scale_x_continuous(breaks = c(1:10))# k_opt
k_opt <- validation_kproto(method = "ptbiserial", data = X_mat, k = 2:10, nstart = 5)## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
k_opt## $k_opt
## [1] 3
##
## $index_opt
## 3
## 0.4456294
##
## $indices
## 2 3 4 5 6 7 8 9
## 0.3890314 0.4456294 0.3205435 0.3422204 0.3351555 0.2766551 0.2708899 0.2777540
## 10
## 0.3151667
##
## $kp_obj
## Numeric predictors: 6
## Categorical predictors: 2
## Lambda: 2.142591
##
## Number of Clusters: 3
## Cluster sizes: 20 101 167
## Within cluster error: 202.8344 689.9603 443.0507
##
## Cluster prototypes:
## Age BP Bact PCC Anemia PedEdema SPG
## 1 -0.3181003 0.5610662 notpresent notpresent yes yes -1.0107688
## 2 -0.4897822 0.5178925 notpresent notpresent no no -0.8323638
## 3 0.3343114 -0.3804100 notpresent notpresent no no 0.6244558
## Albumin Sugar BUrea SerCreat BGlu
## 1 4 0 2.6731005 2.9965513 0.2813389
## 2 2 0 0.1549857 0.0663193 0.7098405
## 3 0 0 -0.4138657 -0.3989777 -0.4629980
tibble(Cluster = c(2:10),
Metric = as.vector(k_opt$indices)) %>%
ggplot(aes(x = Cluster,
y = Metric)) +
geom_point(size = 3,
col ="red3") +
geom_path() +
geom_vline(xintercept = 3,
linetype = 2)+
scale_x_continuous(breaks = c(2:10))set.seed(7)
total_withinss <- c()
for (i in 1:8) {
kproto <- clustMixType::kproto(X_mat,
k = i,
nstart = 25)
total_withinss[i] <- kproto$tot.withinss
}## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## Estimated lambda: 2.142591
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## Estimated lambda: 2.142591
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## Estimated lambda: 2.142591
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## Estimated lambda: 2.142591
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## Estimated lambda: 2.142591
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## Estimated lambda: 2.142591
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## Estimated lambda: 2.142591
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## Estimated lambda: 2.142591
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
total_withinss## [1] 2090.5257 1586.2041 1335.8454 1184.5184 1047.9581 966.6813 927.5449
## [8] 887.4013
tibble(k = 1:length(total_withinss),
total_error = total_withinss
) %>%
ggplot(aes(x = k,
y = total_error)
) +
geom_point(size = 2) +
geom_line() +
theme_bw() +
labs(x = "Number of Clusters",
y = "tot.withinss") +
geom_text(x = 3,
y = total_withinss[3],
label = "ELBOW",
alpha = 0.5,
color = "blue",
size = 5)kpres_3 = kproto(x = X_mat,
k = 3,
lambda = lambdaest(X_mat))## Numeric variances:
## Age BP SPG BUrea SerCreat BGlu
## 1 1 1 1 1 1
## Average numeric variance: 1
##
## Heuristic for categorical variables: (method = 1)
## Albumin Sugar
## 0.6178144 0.3156346
## Average categorical variation: 0.4667245
##
## Estimated lambda: 2.142591
##
## # NAs in variables:
## Age BP Bact PCC Anemia PedEdema SPG Albumin
## 0 0 0 0 0 0 0 0
## Sugar BUrea SerCreat BGlu
## 0 0 0 0
## 0 observation(s) with NAs.
valid_df = df %>% mutate(Cluster = as.factor( kpres_3$cluster))
valid_df %>%gather(Age,BP,SPG,BGlu,BUrea,SerCreat,
key = "Para",value="Value")%>%
ggplot(aes(x=Value, fill = Cluster))+
geom_density(alpha=0.5,col="black")+
facet_wrap(~Para,ncol=2,scales = "free")+
scale_fill_manual(values=clust_colmap )valid_df %>%gather(Age,BP,SPG,BGlu,BUrea,SerCreat,
key = "Para",value="Value")%>%
ggplot(aes(x = Cluster, y=Value, fill = Cluster))+
geom_violin(alpha=0.5,col="black")+
facet_wrap(~Para,ncol=2,scales = "free")+
coord_flip()+
scale_fill_manual(values=clust_colmap )valid_df %>%gather(Age,BP,SPG,BGlu,BUrea,SerCreat,
key = "Para",value="Value")%>%
ggplot(aes(x = Cluster, y=Value, fill = Cluster))+
geom_boxplot(alpha=0.5,col="black")+
facet_wrap(~Para,ncol=2,scales = "free")+
coord_flip()+
scale_fill_manual(values=clust_colmap )## KDE
valid_df %>% ggplot(aes(x=Age,y=BP))+
stat_density2d(geom="polygon",
aes(fill=Cluster,
col = Cluster,
alpha = ..level..))+
geom_jitter(color="black",size=2, alpha = 0.3)+
scale_fill_manual(values=clust_colmap)+
scale_color_manual(values=clust_colmap) ### References 1 https://dpmartin42.github.io/posts/r/cluster-mixed-types 2 https://nbviewer.org/github/kinokoberuji/R-Tutorials/blob/master/R-notebooks/Phan%20tich%20cum%20du%20lieu%20hon%20hop.ipynb?fbclid=IwAR2N2UzgQyo5KZzeuIpa_z2ina6_pHXGVGzOuh2Q9Ceilvp7OUpnAE6QtQA# 3 Two-step clustering SPSS: https://www.youtube.com/watch?v=BrmfYtT98W0 4 https://www.rdocumentation.org/packages/clustMixType/versions/0.2-15/topics/validation_kproto