transfer from old repo
This commit is contained in:
parent
cfa4a5f9cc
commit
277e2b8cf3
1111 changed files with 83736 additions and 0 deletions
33
2 Longterm/varsellcm-clustering.R
Normal file
33
2 Longterm/varsellcm-clustering.R
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
ds <- readr::read_csv("2 Longterm/assigndata.csv", na = c("", "NA"))
|
||||
|
||||
library(VarSelLCM)
|
||||
|
||||
# Please indicate the number of cores you wan to use for parallelization
|
||||
nb.CPU <- 4
|
||||
# clustering without variable selection (about than 10/20 sec on 4 CPU)
|
||||
clusters <- ds |> select(!mrs_1) |> na.omit() |>
|
||||
mutate(across(is.character, ~ factor(.x))) |> as.data.frame() |>
|
||||
VarSelCluster(
|
||||
gvals = 1:5,
|
||||
crit.varsel = "BIC",
|
||||
vbleSelec = FALSE,
|
||||
nbcores = nb.CPU
|
||||
)
|
||||
|
||||
summary(clusters)
|
||||
|
||||
plot(clusters)
|
||||
|
||||
plot(x=clusters, y="mdi_1")
|
||||
|
||||
plot(x=clusters, y="sex")
|
||||
|
||||
print(clusters)
|
||||
|
||||
coef(clusters)
|
||||
|
||||
VarSelShiny(clusters)
|
||||
|
||||
clusters@partitions@zMAP
|
||||
|
||||
gtsummary::tbl_summary(tibble(ds |> na.omit(), class=clusters@partitions@zMAP),by=class) |> gtsummary::add_p()
|
||||
Loading…
Reference in a new issue