Nama: Nurhayani
NIM: 2611018031
Mata Kuliah: Biostatistika Intermediete
Program Studi: Magister Kesehatan Masyarakat
Universitas Mulawarman
Data mencakup tiga kelompok dan empat pengukuran GDS per peserta. Analisis meliputi repeated-measures ANOVA satu arah pada kelompok DASH+AF, mixed ANOVA kelompok x waktu, koreksi Greenhouse-Geisser, pendekatan multivariat, post hoc, kontras interaksi, alternatif nonparametrik, dan linear mixed model (LMM). Baseline, minggu ke-4, minggu ke-8 dan minggu ke-12 berjarak sama. Sumber: data_gds_wide.xls, sheet Sheet1. Satuan pengukuran dan status asal data tidak dicantumkan dalam workbook.
analisis_gds <- function() {
paket <- c("dplyr", "tidyr", "ggplot2", "afex", "emmeans", "rstatix",
"car", "effectsize", "lme4", "lmerTest", "pbkrtest",
"performance", "ggpubr", "WRS2", "htmltools", "base64enc")
belum <- paket[!vapply(paket, requireNamespace, logical(1), quietly = TRUE)]
if (length(belum)) install.packages(belum, repos = "https://cloud.r-project.org")
gagal <- paket[!vapply(paket, requireNamespace, logical(1), quietly = TRUE)]
if (length(gagal)) stop("Paket belum tersedia: ", paste(gagal, collapse = ", "))
suppressPackageStartupMessages({
library(dplyr); library(tidyr); library(ggplot2)
})
opsi_lama <- options(contrasts = c("contr.sum", "contr.poly"), width = 120)
on.exit(options(opsi_lama), add = TRUE)
afex::afex_options(emmeans_model = "multivariate")
theme_set(theme_bw(base_size = 12))
set.seed(2026)
folder <- file.path(getwd(), "Hasil_Analisis_GDS")
dir.create(folder, recursive = TRUE, showWarnings = FALSE)
hasil <- list(); isi <- list(); grafik <- list()
teks <- function(judul, x) {
cat("\n", judul, "\n", sep = "")
cat(x, "\n")
isi[[length(isi) + 1L]] <<- htmltools::tagList(
htmltools::tags$h2(judul), htmltools::tags$p(x))
}
tampil <- function(nama, x) {
hasil[[nama]] <<- x
cat("\n", gsub("_", " ", nama), "\n", sep = "")
print(x)
cetak <- capture.output(print(x))
writeLines(cetak, file.path(folder, paste0(nama, ".txt")))
if (is.data.frame(x)) write.csv(x, file.path(folder, paste0(nama, ".csv")), row.names = FALSE)
isi[[length(isi) + 1L]] <<- htmltools::tagList(
htmltools::tags$h2(gsub("_", " ", nama)),
htmltools::tags$pre(paste(cetak, collapse = "\n")))
invisible(x)
}
gambar <- function(nama, p, lebar = 11, tinggi = 6) {
print(p)
berkas <- file.path(folder, paste0(nama, ".png"))
ggsave(berkas, plot = p, width = lebar, height = tinggi, dpi = 300, bg = "white")
grafik[[nama]] <<- p
isi[[length(isi) + 1L]] <<- htmltools::tagList(
htmltools::tags$h2(gsub("_", " ", nama)),
htmltools::tags$img(src = base64enc::dataURI(file = berkas, mime = "image/png"),
style = "max-width:100%;height:auto;"))
invisible(p)
}
opsional <- function(nama, ekspresi) {
tryCatch(tampil(nama, ekspresi), error = function(e) {
teks(nama, paste("Analisis tidak dapat diestimasi:", conditionMessage(e)))
invisible(NULL)
})
}
fp <- function(p) ifelse(is.na(p), "NA", ifelse(p < .001, "< 0,001",
paste0("= ", formatC(p, digits = 3, format = "f", decimal.mark = ","))))
csv_asli <- 'id,kelompok,usia,jk,GDS_M0,GDS_M4,GDS_M8,GDS_M12
P001,Kontrol,42,L,116.8134081878267,120.6770117955918,114.3475395270213,104.3869485043626
P002,Kontrol,43,L,130.417114523364,124.8470856449673,124.0566713336107,118.557292439741
P003,Kontrol,62,P,111.8225256489383,113.4227979050136,103.5271675444492,103.3344684568106
P004,Kontrol,40,P,120.1799199085867,126.2833191931731,138.5042200291583,139.4026217723035
P005,Kontrol,53,P,140.6494543928233,137.4254889423478,148.6202133088628,148.9661548973951
P006,Kontrol,42,L,109.2976447827747,103.8399390354786,101.7172348091054,107.1649452636906
P007,Kontrol,60,P,125.6415457111744,124.2180008355158,120.5713326471428,114.936489300885
P008,Kontrol,63,L,154.8985618049935,149.6060018619247,155.0187811756389,168.177329175378
P009,Kontrol,53,P,150.3899410780406,152.5253075700168,158.7130657673385,156.6788064750549
P010,Kontrol,62,P,103.9967201636055,112.4606476059833,117.8705384312165,116.8735126248932
P011,Kontrol,57,P,116.5299271446949,110.1752792731056,103.0814199550852,97.75210667155733
P012,Kontrol,52,P,133.061932646156,128.9356184011962,119.6535894080937,117.8192315141424
P013,Kontrol,63,L,115.2316833290337,118.3013565731548,121.1940455300492,117.6006089051037
P014,Kontrol,50,P,124.9090419825016,116.7851599924242,114.0170429914713,102.4895401751393
P015,Kontrol,57,P,126.593420636996,120.9861597795734,115.8006591893826,113.9999519984818
P016,Kontrol,39,P,118.1214651374746,118.2730304139195,110.9666384863548,120.4821516904631
P017,Kontrol,54,P,157.1237117587109,168.9704435588648,170.57707086475,175.291736395624
P018,Kontrol,38,P,123.4183728094717,112.6766584263541,113.4209695725658,106.1961694987619
P019,Kontrol,42,P,143.4435660614528,150.0447024781461,138.9340288638326,140.8403710530017
P020,Kontrol,41,L,137.3028048459837,138.1170926883711,139.3386390344589,136.3308644462141
P021,Kontrol,57,L,150.7803487882344,151.2163798342258,152.736246478212,151.7656041385474
P022,Kontrol,62,P,112.9439838342258,104.3746641567311,100.8534700834178,95.67049796657287
P023,Kontrol,45,P,122.2345754007725,121.8013125075366,130.7046869519431,129.6485312658778
P024,Kontrol,51,L,122.4913055840828,126.4356252393465,123.2376995189237,105.6207798031042
P025,Kontrol,65,P,145.1346346831075,136.9735797962316,138.5110936028028,137.3841749848948
P026,Kontrol,56,P,107.5145696935812,106.7054067233987,99.78646599212398,91.49997011366256
P027,Kontrol,54,P,96.61379404913178,94.63301402563258,86.47188202019552,81.67951370764095
P028,Kontrol,42,P,124.3204369891846,116.7208910920963,119.0699394180357,119.7738064525421
P029,Kontrol,41,L,120.0136236725187,123.6857014129385,125.516788516882,129.4535189432237
P030,Kontrol,50,P,143.4987623346964,150.5515839078855,152.6888184612075,152.6378748623444
P031,DASH,36,P,134.6082179789782,128.1152482117948,121.9754317617026,113.2148101614655
P032,DASH,61,L,130.4519391864688,127.1966061159886,111.6316895304706,94.97662401068844
P033,DASH,64,L,165.3768796927343,161.3267603232412,143.1756925177444,127.1151963668571
P034,DASH,36,L,122.6767951179997,125.5761097420865,120.9935680898861,114.7627753263595
P035,DASH,35,L,153.3094302366305,146.115010073058,132.1441665694328,118.3482230029059
P036,DASH,60,L,105.9805745374686,97.31184352956605,96.51365910891482,84.4336622945605
P037,DASH,54,L,130.4290408126386,131.5643332799834,128.4593644656461,111.9001370657754
P038,DASH,44,P,109.2675225171893,122.1219950723087,123.7467355210801,122.4129165000348
P039,DASH,47,P,139.9680170483117,135.5916830835295,133.5542475334265,129.4007282397939
P040,DASH,48,L,102.383285525177,98.24648124363546,79.32189697085354,75.0
P041,DASH,39,L,129.0659811395256,128.7450657492956,123.4873968539296,112.2043066309529
P042,DASH,39,P,140.7068091374472,129.8664877464734,110.5864661529639,106.3191377919725
P043,DASH,54,P,161.5605251252346,154.7827889344593,154.9881771475874,146.6880244937015
P044,DASH,39,P,121.4094789481641,103.3179108253177,107.0730941328314,87.91615547632237
P045,DASH,45,L,141.8092656041449,122.1552896874515,112.2975492010642,111.5585039863983
P046,DASH,57,L,114.4854752609223,93.97132703714969,86.81535480813602,77.78676295683633
P047,DASH,63,L,117.8466998127836,109.1755348786398,114.4367616745411,94.35547072763092
P048,DASH,53,P,96.13980127368552,80.35790018301998,75.11594683934895,81.16287247207786
P049,DASH,39,L,144.3086689599353,151.7698393787761,151.5304293299904,140.9949331407691
P050,DASH,45,P,138.7072824129675,131.4981025724363,123.9311183747691,124.7202795681053
P051,DASH,62,P,134.8383887688983,129.0498822277892,127.5273081324424,121.5510819751876
P052,DASH,45,P,88.0,92.46048538876249,75.0,75.0
P053,DASH,56,L,101.3623348522186,98.84952670404992,101.9018994303828,80.2400835087122
P054,DASH,59,L,134.0400027439437,120.9571996264355,105.0152150073265,103.715665226182
P055,DASH,39,L,138.1816628543022,142.5667222888501,136.6785552613057,124.5673548866127
P056,DASH,63,L,127.027209033678,116.3732003271415,108.7120406070442,100.4258385596272
P057,DASH,48,L,94.78520426856754,93.18602856287932,96.1124611279717,81.5057853227765
P058,DASH,62,L,103.3231751585069,103.3927949031897,93.99114180550595,79.45415101976322
P059,DASH,40,P,112.8219338674499,111.8489348964552,112.5996599465272,111.3501969999871
P060,DASH,59,L,122.8537236151945,129.1971711746607,118.5152591965399,107.9500431449854
P061,DASH+AF,60,P,145.3393622477846,144.9746266973245,127.9441713885665,118.629225907996
P062,DASH+AF,44,L,141.8927707684019,139.9611104532125,132.2122024330491,125.9591057996121
P063,DASH+AF,48,P,134.7791667473243,130.1739376402181,126.4905734860802,112.026448741199
P064,DASH+AF,39,L,124.6717774475387,113.7692758219015,97.83608063645478,75.0
P065,DASH+AF,50,P,128.9257706242365,121.378492832485,120.2481931449434,102.3024997933057
P066,DASH+AF,59,P,135.8460459388631,133.9318048568054,136.734540723486,119.9951974187578
P067,DASH+AF,56,L,113.8484380321302,91.60402715482662,86.84929957599844,75.0
P068,DASH+AF,57,L,125.7309663643471,127.1121132149531,113.7185029105115,115.7119136679259
P069,DASH+AF,45,L,133.0262533474726,116.9209639856042,113.4987853592957,95.48543009495265
P070,DASH+AF,42,P,106.1545630816984,90.95575053545559,87.68021846083286,77.9663851024979
P071,DASH+AF,47,L,106.8389913756421,89.82420974193641,75.0,75.0
P072,DASH+AF,53,L,142.7128144347437,141.911599239108,139.0619926116354,115.6400331001998
P073,DASH+AF,44,P,97.52046935294463,91.13090520067065,89.90465599662522,85.78419262598979
P074,DASH+AF,47,P,115.3127423673114,122.0107935539707,121.6684071154494,107.1785884236736
P075,DASH+AF,46,P,117.8515568915962,112.6041354976668,108.8685759802147,90.69319968741092
P076,DASH+AF,36,P,105.0230302858787,104.383252684548,91.00925393407888,75.0
P077,DASH+AF,39,L,110.4062642570385,103.8538849778193,106.0556731432653,96.73512027217095
P078,DASH+AF,63,P,120.0439125058167,114.1380485861854,101.5728940318885,81.22512376369068
P079,DASH+AF,59,L,123.5468029541974,122.320533715501,111.516019383639,102.319572703908
P080,DASH+AF,43,P,109.3086790858511,111.9949972851631,114.7711720593815,95.8528875495435
P081,DASH+AF,57,L,138.9837606414526,138.5665428356574,122.6358695515043,116.0507964129733
P082,DASH+AF,44,P,132.3750849158145,125.4445219864977,107.9988559922864,104.2287181357751
P083,DASH+AF,41,P,124.3728618939932,128.7491596183657,131.1929200234028,119.0677503062504
P084,DASH+AF,41,L,110.9393186738205,104.1314958179213,97.96822423383816,94.71183372720016
P085,DASH+AF,64,L,161.6628937085558,166.5815131922321,152.0587051458057,142.7621556678364
P086,DASH+AF,44,P,107.6310430192891,112.581477701068,105.3965169553548,98.84496172603924
P087,DASH+AF,47,L,109.4275099157446,88.29581504076947,75.0,75.0
P088,DASH+AF,64,P,129.5210056790696,133.5152838532935,126.4260996415179,123.8807846173074
P089,DASH+AF,46,P,137.1979143617,131.3648567029695,120.1223877269325,97.91415264417898
P090,DASH+AF,48,L,109.8954023110451,111.924042358788,108.82151217589,102.6771852457852'
dat_wide <- read.csv(text = csv_asli, stringsAsFactors = FALSE)
kolom <- c("id", "kelompok", "usia", "jk", "GDS_M0", "GDS_M4", "GDS_M8", "GDS_M12")
stopifnot(all(kolom %in% names(dat_wide)), !anyDuplicated(dat_wide$id))
minggu <- c(0, 4, 8, 12)
kolom_gds <- c("GDS_M0", "GDS_M4", "GDS_M8", "GDS_M12")
kelompok <- c("Kontrol", "DASH", "DASH+AF")
stopifnot(setequal(unique(dat_wide$kelompok), kelompok),
all(vapply(dat_wide[kolom_gds], is.numeric, logical(1))),
all(is.finite(as.matrix(dat_wide[kolom_gds]))))
dat_wide <- dat_wide |> mutate(id = factor(id), kelompok = factor(kelompok, levels = c("Kontrol", "DASH", "DASH+AF")))
dat_long <- dat_wide |>
pivot_longer(all_of(kolom_gds), names_to = "waktu", values_to = "gds") |>
mutate(waktu = factor(waktu, levels = kolom_gds, labels = c("M0", "M4", "M8", "M12")),
minggu = minggu[as.integer(waktu)]) |> arrange(id, waktu)
teks("Identitas", paste("Nama: Nurhayani| NIM: 2611018008 | |",
"Mata Kuliah: Biostatistika Intermediete | Magister Kesehatan Masyarakat Universitas Mulawarman"))
teks("Desain", paste(nrow(dat_wide), "peserta; tiga kelompok; empat pengukuran berulang.",
"Tanpa nilai hilang. Satuan GDS tidak dicantumkan dalam workbook."))
tampil("01_Jumlah_Peserta", dat_wide |> count(kelompok, name = "n"))
tampil("01a_Usia", dat_wide |> group_by(kelompok) |> summarise(n = n(), mean = mean(usia), sd = sd(usia), min = min(usia), max = max(usia), .groups = "drop"))
tampil("01b_Jenis_Kelamin", dat_wide |> count(kelompok, jk))
teks("Sumber data", "Analisis dihitung dari sheet Sheet1 pada data_gds_wide.xls. Satuan pengukuran dan status data asli/simulasi tidak dicantumkan; interpretasi menggunakan skala numerik dalam workbook.")
tampil("02_Data_Wide", head(dat_wide))
tampil("03_Data_Long", head(dat_long, 12))
desk <- dat_long |> group_by(kelompok, waktu, minggu) |>
summarise(n = n(), mean = mean(gds), sd = sd(gds), median = median(gds),
min = min(gds), max = max(gds), se = sd / sqrt(n),
lower = mean - qt(.975, n - 1) * se,
upper = mean + qt(.975, n - 1) * se, .groups = "drop")
tampil("04_Deskriptif", desk)
tampil("05_Kovarians", cov(dat_wide[kolom_gds]))
tampil("06_Korelasi", cor(dat_wide[kolom_gds]))
pasangan <- combn(kolom_gds, 2)
tampil("07_Varians_Selisih", data.frame(
pasangan = apply(pasangan, 2, paste, collapse = " - "),
varians = apply(pasangan, 2, function(p) var(dat_wide[[p[1]]] - dat_wide[[p[2]]]))))
gambar("G01_Profil_Rerata_CI95", ggplot(desk, aes(minggu, mean, color = kelompok, group = kelompok)) +
geom_line(linewidth = 1) + geom_point(size = 3) +
geom_errorbar(aes(ymin = lower, ymax = upper), width = .5) +
scale_x_continuous(breaks = minggu) +
labs(title = "Profil rerata GDS dan interval kepercayaan 95%", x = "Minggu", y = "GDS", color = "Kelompok") +
theme(legend.position = "bottom"))
gambar("G02_Lintasan_Individu", ggplot(dat_long, aes(minggu, gds, group = id)) +
geom_line(alpha = .25) + stat_summary(aes(group = kelompok), fun = mean,
geom = "line", color = "firebrick", linewidth = 1.2) +
facet_wrap(~ kelompok) + scale_x_continuous(breaks = minggu) +
labs(title = "Lintasan individu dan rerata kelompok", x = "Minggu", y = "GDS"))
gambar("G03_Boxplot", ggplot(dat_long, aes(waktu, gds, fill = kelompok)) +
geom_boxplot() + labs(title = "Distribusi GDS berdasarkan kelompok dan waktu", x = "Waktu", y = "GDS", fill = "Kelompok") +
theme(legend.position = "bottom"))
d1 <- droplevels(filter(dat_long, kelompok == "DASH+AF"))
tampil("08_Outlier_Satu_Kelompok", d1 |> group_by(waktu) |> rstatix::identify_outliers(gds))
tampil("09_Shapiro_Satu_Kelompok", d1 |> group_by(waktu) |> rstatix::shapiro_test(gds))
gambar("G04_QQ_Satu_Kelompok", ggpubr::ggqqplot(d1, "gds", facet.by = "waktu"))
aov1_rs <- rstatix::anova_test(data = d1, dv = gds, wid = id, within = waktu, effect.size = "pes")
tampil("10_ANOVA_Rstatix_Satu_Kelompok", aov1_rs)
aov1 <- afex::aov_ez(id = "id", dv = "gds", data = d1, within = "waktu",
anova_table = list(es = c("ges", "pes"), correction = "GG"))
tampil("11_RM_ANOVA", aov1)
tampil("12_Sferisitas_dan_Koreksi_RM", summary(aov1))
tampil("13_Multivariat_RM", aov1$Anova)
tampil("14_Eta_Kuadrat_RM", effectsize::eta_squared(aov1, partial = TRUE))
em1 <- emmeans::emmeans(aov1, ~ waktu)
tampil("15_EMM_RM", as.data.frame(em1))
tampil("16_Posthoc_RM_Bonferroni", as.data.frame(pairs(em1, adjust = "bonferroni")))
tampil("17_RM_vs_Baseline_Holm", as.data.frame(emmeans::contrast(em1, "trt.vs.ctrl", ref = 1, adjust = "holm")))
tampil("18_Tren_Polinomial_RM", as.data.frame(emmeans::contrast(em1, "poly")))
tampil("19_Friedman", rstatix::friedman_test(d1, gds ~ waktu | id))
tampil("20_Kendall_W", rstatix::friedman_effsize(d1, gds ~ waktu | id))
tampil("21_Wilcoxon_Berpasangan", d1 |> arrange(waktu, id) |>
rstatix::wilcox_test(gds ~ waktu, paired = TRUE, p.adjust.method = "bonferroni"))
opsional("22_Robust_RM_Trim20", WRS2::rmanova(d1$gds, d1$waktu, d1$id, tr = .2))
tampil("23_Outlier_Mixed", dat_long |> group_by(kelompok, waktu) |> rstatix::identify_outliers(gds))
tampil("24_Shapiro_Mixed", dat_long |> group_by(kelompok, waktu) |> rstatix::shapiro_test(gds))
gambar("G05_QQ_Mixed", ggpubr::ggqqplot(dat_long, "gds", ggtheme = theme_bw()) +
facet_grid(waktu ~ kelompok), tinggi = 9)
tampil("25_Levene", dat_long |> group_by(waktu) |> rstatix::levene_test(gds ~ kelompok))
tampil("26_Box_M", rstatix::box_m(dat_wide[kolom_gds], dat_wide$kelompok))
aov2 <- afex::aov_ez(id = "id", dv = "gds", data = dat_long, between = "kelompok", within = "waktu",
anova_table = list(es = c("ges", "pes"), correction = "GG"))
tampil("27_Mixed_ANOVA", aov2)
tampil("28_Sferisitas_dan_Koreksi_Mixed", summary(aov2))
tampil("29_Multivariat_Mixed", aov2$Anova)
tampil("30_Eta_Kuadrat_Mixed", effectsize::eta_squared(aov2, partial = TRUE))
gambar("G06_Profil_Mixed_ANOVA", afex::afex_plot(aov2, x = "waktu", trace = "kelompok",
error = "within", mapping = c("colour", "shape", "linetype")) +
labs(title = "Profil mixed ANOVA", x = "Waktu", y = "GDS"))
teks("Interval grafik mixed ANOVA", "Interval within-subject pada grafik afex berbeda dari interval kepercayaan rerata biasa pada grafik profil deskriptif.")
tampil("31_Efek_Waktu_per_Kelompok", as.data.frame(emmeans::joint_tests(aov2, by = "kelompok")))
tampil("32_Efek_Kelompok_per_Waktu", as.data.frame(emmeans::joint_tests(aov2, by = "waktu")))
em2 <- emmeans::emmeans(aov2, ~ waktu | kelompok)
em2b <- emmeans::emmeans(aov2, ~ kelompok | waktu)
tampil("33_EMM_Waktu_per_Kelompok", as.data.frame(em2))
tampil("34_Waktu_vs_Baseline_Holm", as.data.frame(emmeans::contrast(em2, "trt.vs.ctrl", ref = 1, adjust = "holm")))
tampil("35_Antarkelompok_Tukey", as.data.frame(pairs(em2b, adjust = "tukey")))
em_full <- emmeans::emmeans(aov2, ~ waktu * kelompok)
ki <- emmeans::contrast(em_full, interaction = list(
waktu = list("M12-M0" = c(-1, 0, 0, 1)), kelompok = "pairwise"), adjust = "holm")
tampil("36_Kontras_Perbedaan_Perubahan", as.data.frame(ki))
tren <- as.data.frame(emmeans::contrast(em_full,
interaction = c(waktu = "poly", kelompok = "pairwise"), adjust = "none"))
tren_lin <- subset(tren, waktu_poly == "linear")
tren_lin$p.holm <- p.adjust(tren_lin$p.value, "holm")
tampil("37_Kontras_Tren_Linear", tren_lin)
teks("Koreksi perbandingan", "Holm untuk waktu versus baseline berlaku dalam tiap kelompok; Tukey berlaku dalam tiap waktu. Kontras perbedaan perubahan dan tren linear memakai Holm pada masing-masing keluarga kontras.")
tabel_gg <- as.data.frame(afex::nice(aov2, correction = "GG", es = "pes"))
tampil("38_Tabel_ANOVA_GG", tabel_gg)
tab_num <- as.data.frame(aov2$anova_table)
if ("kelompok:waktu" %in% rownames(tab_num)) {
r <- tab_num["kelompok:waktu", , drop = FALSE]
teks("Interpretasi interaksi", paste0("Mixed ANOVA dengan koreksi Greenhouse-Geisser menghasilkan interaksi kelompok x waktu: F(",
round(r[["num Df"]], 2), ", ", round(r[["den Df"]], 2), ") = ", round(r[["F"]], 3),
"; p ", fp(r[["Pr(>F)"]]), ". ",
if (r[["Pr(>F)"]] < .05) "Pola perubahan GDS berbeda secara statistik antar kelompok."
else "Belum ditemukan bukti statistik perbedaan pola perubahan GDS antar kelompok.",
" Arah dan besarnya perbedaan dinilai dari rerata serta kontras perubahan M12-M0."))
}
kontrol <- lme4::lmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 200000))
lmm1 <- lmerTest::lmer(gds ~ kelompok * waktu + (1 | id), data = dat_long, REML = TRUE, control = kontrol)
lmm2 <- lmerTest::lmer(gds ~ kelompok * waktu + (1 + minggu | id), data = dat_long, REML = TRUE, control = kontrol)
tampil("39_LMM_Intersep", summary(lmm1))
tampil("40_LMM_Intersep_Slope", summary(lmm2))
tampil("41_Perbandingan_LMM_REML", anova(lmm1, lmm2, refit = FALSE))
teks("Perbandingan model", "Kedua model mempunyai fixed effects yang sama. Perbandingan REML mengikuti materi; nilai p likelihood-ratio bersifat pendekatan karena varians acak diuji pada batas ruang parameter.")
tampil("42_Singularitas_LMM", data.frame(model = c("Intersep", "Intersep dan slope"),
singular = c(lme4::isSingular(lmm1), lme4::isSingular(lmm2))))
opsional("43_LMM_Kenward_Roger", anova(lmm2, ddf = "Kenward-Roger"))
opsional("44_ICC", performance::icc(lmm1))
rd <- data.frame(prediksi = fitted(lmm2), residual = resid(lmm2))
gambar("G07_QQ_Residual_LMM", ggplot(rd, aes(sample = residual)) + stat_qq() + stat_qq_line() +
labs(title = "Q-Q residual LMM", x = "Kuantil teoretis", y = "Kuantil residual"))
ra <- data.frame(intersep = lme4::ranef(lmm2)$id[, 1])
gambar("G08_QQ_Intersep_Acak", ggplot(ra, aes(sample = intersep)) + stat_qq() + stat_qq_line() +
labs(title = "Q-Q intersep acak LMM", x = "Kuantil teoretis", y = "Kuantil intersep acak"))
gambar("G09_Residual_vs_Prediksi", ggplot(rd, aes(prediksi, residual)) + geom_point(alpha = .5) +
geom_hline(yintercept = 0, linetype = 2) + labs(title = "Residual versus nilai prediksi LMM", x = "Prediksi GDS", y = "Residual"))
em_lmm <- emmeans::emmeans(lmm2, ~ waktu | kelompok, lmer.df = "kenward-roger")
tampil("45_EMM_LMM", as.data.frame(em_lmm))
set.seed(1)
dat_miss <- dat_long
indeks_hilang <- sample(which(dat_miss$waktu != "M0"), 30)
dat_miss$gds[indeks_hilang] <- NA_real_
teks("Demonstrasi data hilang", "Sebanyak 30 pengukuran pascabaseline dihapus secara acak hanya pada salinan demonstrasi. Analisis utama tetap menggunakan seluruh data yang dilampirkan; demonstrasi ini mengikuti bagian LMM data hilang dalam materi.")
lmm_miss <- lmerTest::lmer(gds ~ kelompok * waktu + (1 + minggu | id), data = dat_miss,
REML = TRUE, control = kontrol, na.action = na.omit)
opsional("46_LMM_Data_Hilang_KR", anova(lmm_miss, ddf = "Kenward-Roger"))
tampil("47_Ringkasan_Data_Hilang", data.frame(pengukuran_hilang = sum(is.na(dat_miss$gds)),
peserta_terdampak = n_distinct(dat_miss$id[is.na(dat_miss$gds)]),
peserta_lengkap = n_distinct(dat_miss$id) - n_distinct(dat_miss$id[is.na(dat_miss$gds)]),
pengukuran_dianalisis_LMM = nobs(lmm_miss)))
tampil("48_Informasi_Sesi", sessionInfo())
write.csv(dat_wide, file.path(folder, "Data_GDS_Wide.csv"), row.names = FALSE)
write.csv(dat_long, file.path(folder, "Data_GDS_Long.csv"), row.names = FALSE)
write.csv(dat_miss, file.path(folder, "Data_Demonstrasi_Missing.csv"), row.names = FALSE)
saveRDS(list(hasil = hasil, data_wide = dat_wide, data_long = dat_long,
aov1 = aov1, aov2 = aov2, lmm1 = lmm1, lmm2 = lmm2, lmm_miss = lmm_miss),
file.path(folder, "Objek_Analisis_GDS.rds"))
laporan <- htmltools::tags$html(lang = "id",
htmltools::tags$head(htmltools::tags$meta(charset = "UTF-8"),
htmltools::tags$title("Analisis GDS: 3 x 4"),
htmltools::tags$style("body{font-family:Arial,sans-serif;max-width:1100px;margin:40px auto;padding:20px;line-height:1.6;color:#17342e}h1,h2{color:#0b6b4f}h2{border-bottom:1px solid #d9e4e0;padding-top:24px}pre{background:#f3f7f5;padding:16px;overflow:auto;font-size:13px}img{display:block;margin:15px auto}")),
htmltools::tags$body(htmltools::tags$h1("Analisis Pengukuran Berulang GDS: 3 x 4"), isi))
htmltools::save_html(laporan, file.path(folder, "Laporan_Analisis_GDS.html"))
cat("\nHasil analisis: ", normalizePath(folder), "\n", sep = "")
invisible(list(hasil = hasil, grafik = grafik, data_wide = dat_wide,
data_long = dat_long, aov1 = aov1, aov2 = aov2,
lmm1 = lmm1, lmm2 = lmm2, lmm_miss = lmm_miss))
}
hasil_gds <- analisis_gds()
## Registered S3 method overwritten by 'lme4':
## method from
## na.action.merMod car
##
## Identitas
## Nama: Nurhayani| NIM: 2611018008 | | Mata Kuliah: Biostatistika Intermediete | Magister Kesehatan Masyarakat Universitas Mulawarman
##
## Desain
## 90 peserta; tiga kelompok; empat pengukuran berulang. Tanpa nilai hilang. Satuan GDS tidak dicantumkan dalam workbook.
##
## 01 Jumlah Peserta
## kelompok n
## 1 Kontrol 30
## 2 DASH 30
## 3 DASH+AF 30
##
## 01a Usia
## # A tibble: 3 × 6
## kelompok n mean sd min max
## <fct> <int> <dbl> <dbl> <int> <int>
## 1 Kontrol 30 51.2 8.60 38 65
## 2 DASH 30 49.7 9.79 35 64
## 3 DASH+AF 30 49.1 8.07 36 64
##
## 01b Jenis Kelamin
## kelompok jk n
## 1 Kontrol L 9
## 2 Kontrol P 21
## 3 DASH L 19
## 4 DASH P 11
## 5 DASH+AF L 14
## 6 DASH+AF P 16
##
## Sumber data
## Analisis dihitung dari sheet Sheet1 pada data_gds_wide.xls. Satuan pengukuran dan status data asli/simulasi tidak dicantumkan; interpretasi menggunakan skala numerik dalam workbook.
##
## 02 Data Wide
## id kelompok usia jk GDS_M0 GDS_M4 GDS_M8 GDS_M12
## 1 P001 Kontrol 42 L 116.8134 120.6770 114.3475 104.3869
## 2 P002 Kontrol 43 L 130.4171 124.8471 124.0567 118.5573
## 3 P003 Kontrol 62 P 111.8225 113.4228 103.5272 103.3345
## 4 P004 Kontrol 40 P 120.1799 126.2833 138.5042 139.4026
## 5 P005 Kontrol 53 P 140.6495 137.4255 148.6202 148.9662
## 6 P006 Kontrol 42 L 109.2976 103.8399 101.7172 107.1649
##
## 03 Data Long
## # A tibble: 12 × 7
## id kelompok usia jk waktu gds minggu
## <fct> <fct> <int> <chr> <fct> <dbl> <dbl>
## 1 P001 Kontrol 42 L M0 117. 0
## 2 P001 Kontrol 42 L M4 121. 4
## 3 P001 Kontrol 42 L M8 114. 8
## 4 P001 Kontrol 42 L M12 104. 12
## 5 P002 Kontrol 43 L M0 130. 0
## 6 P002 Kontrol 43 L M4 125. 4
## 7 P002 Kontrol 43 L M8 124. 8
## 8 P002 Kontrol 43 L M12 119. 12
## 9 P003 Kontrol 62 P M0 112. 0
## 10 P003 Kontrol 62 P M4 113. 4
## 11 P003 Kontrol 62 P M8 104. 8
## 12 P003 Kontrol 62 P M12 103. 12
##
## 04 Deskriptif
## # A tibble: 12 × 12
## kelompok waktu minggu n mean sd median min max se lower upper
## <fct> <fct> <dbl> <int> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 Kontrol M0 0 30 127. 15.7 124. 96.6 157. 2.87 121. 133.
## 2 Kontrol M4 4 30 126. 17.4 123. 94.6 169. 3.18 120. 133.
## 3 Kontrol M8 8 30 125. 20.3 121. 86.5 171. 3.71 118. 133.
## 4 Kontrol M12 12 30 123. 23.3 118. 81.7 175. 4.25 115. 132.
## 5 DASH M0 0 30 125. 19.7 128. 88 165. 3.59 118. 133.
## 6 DASH M4 4 30 121. 20.4 124. 80.4 161. 3.72 113. 128.
## 7 DASH M8 8 30 114. 20.6 114. 75 155. 3.76 107. 122.
## 8 DASH M12 12 30 105. 20.2 110. 75 147. 3.69 97.8 113.
## 9 DASH+AF M0 0 30 123. 15.0 124. 97.5 162. 2.74 118. 129.
## 10 DASH+AF M4 4 30 119. 18.8 119. 88.3 167. 3.43 112. 126.
## 11 DASH+AF M8 8 30 112. 18.8 113. 75 152. 3.43 105. 119.
## 12 DASH+AF M12 12 30 101. 18.1 101. 75 143. 3.30 93.9 107.
##
## 05 Kovarians
## GDS_M0 GDS_M4 GDS_M8 GDS_M12
## GDS_M0 282.2210 292.9354 288.8445 292.4662
## GDS_M4 292.9354 358.3830 364.9420 374.5291
## GDS_M8 288.8445 364.9420 423.6107 438.4540
## GDS_M12 292.4662 374.5291 438.4540 513.8113
##
## 06 Korelasi
## GDS_M0 GDS_M4 GDS_M8 GDS_M12
## GDS_M0 1.0000000 0.9210930 0.8353835 0.7680318
## GDS_M4 0.9210930 1.0000000 0.9366269 0.8727905
## GDS_M8 0.8353835 0.9366269 1.0000000 0.9398071
## GDS_M12 0.7680318 0.8727905 0.9398071 1.0000000
##
## 07 Varians Selisih
## pasangan varians
## 1 GDS_M0 - GDS_M4 54.73322
## 2 GDS_M0 - GDS_M8 128.14279
## 3 GDS_M0 - GDS_M12 211.09986
## 4 GDS_M4 - GDS_M8 52.10981
## 5 GDS_M4 - GDS_M12 123.13616
## 6 GDS_M8 - GDS_M12 60.51407
##
## 08 Outlier Satu Kelompok
## [1] waktu id kelompok usia jk gds minggu is.outlier is.extreme
## <0 rows> (or 0-length row.names)
##
## 09 Shapiro Satu Kelompok
## # A tibble: 4 × 4
## waktu variable statistic p
## <fct> <chr> <dbl> <dbl>
## 1 M0 gds 0.962 0.346
## 2 M4 gds 0.967 0.454
## 3 M8 gds 0.986 0.948
## 4 M12 gds 0.950 0.167
##
## 10 ANOVA Rstatix Satu Kelompok
## ANOVA Table (type III tests)
##
## $ANOVA
## Effect DFn DFd F p p<.05 pes
## 1 waktu 3 87 74.133 6.87e-24 * 0.719
##
## $`Mauchly's Test for Sphericity`
## Effect W p p<.05
## 1 waktu 0.487 0.001 *
##
## $`Sphericity Corrections`
## Effect GGe DF[GG] p[GG] p[GG]<.05 HFe DF[HF] p[HF] p[HF]<.05
## 1 waktu 0.683 2.05, 59.43 4.63e-17 * 0.736 2.21, 64.01 3.4e-18 *
##
##
## 11 RM ANOVA
## Anova Table (Type 3 tests)
##
## Response: gds
## Effect df MSE F ges pes p.value
## 1 waktu 2.05, 59.43 58.28 74.13 *** .195 .719 <.001
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
##
## Sphericity correction method: GG
##
## 12 Sferisitas dan Koreksi RM
##
## Univariate Type III Repeated-Measures ANOVA Assuming Sphericity
##
## Sum Sq num Df Error SS den Df F value Pr(>F)
## (Intercept) 1549459 1 33070 29 1358.767 < 2.2e-16 ***
## waktu 8855 3 3464 87 74.133 < 2.2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
##
## Mauchly Tests for Sphericity
##
## Test statistic p-value
## waktu 0.48653 0.0012749
##
##
## Greenhouse-Geisser and Huynh-Feldt Corrections
## for Departure from Sphericity
##
## GG eps Pr(>F[GG])
## waktu 0.68313 < 2.2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## HF eps Pr(>F[HF])
## waktu 0.7356904 3.397421e-18
##
## 13 Multivariat RM
##
## Type III Repeated Measures MANOVA Tests: Pillai test statistic
## Df test stat approx F num Df den Df Pr(>F)
## (Intercept) 1 0.97910 1358.77 1 29 < 2.2e-16 ***
## waktu 1 0.83953 47.08 3 27 7.365e-11 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## 14 Eta Kuadrat RM
## # Effect Size for ANOVA (Type III)
##
## Parameter | Eta2 (partial) | 95% CI
## -----------------------------------------
## waktu | 0.72 | [0.64, 1.00]
##
## - One-sided CIs: upper bound fixed at [1.00].
## 15 EMM RM
## waktu emmean SE df lower.CL upper.CL
## M0 123.3596 2.744675 29 117.74608 128.9731
## M4 118.8703 3.429627 29 111.85593 125.8847
## M8 111.6754 3.434197 29 104.65169 118.6991
## M12 100.6214 3.302070 29 93.86795 107.3749
##
## Confidence level used: 0.95
##
## 16 Posthoc RM Bonferroni
## contrast estimate SE df t.ratio p.value
## M0 - M4 4.489267 1.414386 29 3.174 0.0213
## M0 - M8 11.684162 1.965143 29 5.946 <0.0001
## M0 - M12 22.738130 2.140611 29 10.622 <0.0001
## M4 - M8 7.194896 1.191573 29 6.038 <0.0001
## M4 - M12 18.248864 1.512424 29 12.066 <0.0001
## M8 - M12 11.053968 1.332124 29 8.298 <0.0001
##
## P value adjustment: bonferroni method for 6 tests
##
## 17 RM vs Baseline Holm
## contrast estimate SE df t.ratio p.value
## M4 - M0 -4.489267 1.414386 29 -3.174 0.0035
## M8 - M0 -11.684162 1.965143 29 -5.946 <0.0001
## M12 - M0 -22.738130 2.140611 29 -10.622 <0.0001
##
## P value adjustment: holm method for 3 tests
##
## 18 Tren Polinomial RM
## contrast estimate SE df t.ratio p.value
## linear -75.40929 7.055658 29 -10.688 <0.0001
## quadratic -6.56470 1.980453 29 -3.315 0.0025
## cubic -1.15344 3.199737 29 -0.360 0.7211
##
##
## 19 Friedman
## # A tibble: 1 × 6
## .y. n statistic df p method
## * <chr> <int> <dbl> <dbl> <dbl> <chr>
## 1 gds 30 68.1 3 1.11e-14 Friedman test
##
## 20 Kendall W
## # A tibble: 1 × 5
## .y. n effsize method magnitude
## * <chr> <int> <dbl> <chr> <ord>
## 1 gds 30 0.756 Kendall W large
##
## 21 Wilcoxon Berpasangan
## # A tibble: 6 × 9
## .y. group1 group2 n1 n2 statistic p p.adj p.adj.signif
## * <chr> <chr> <chr> <int> <int> <dbl> <dbl> <dbl> <chr>
## 1 gds M0 M4 30 30 367 0.00466 0.0280 *
## 2 gds M0 M8 30 30 440 0.00000168 0.0000101 ****
## 3 gds M0 M12 30 30 465 0.00000000186 0.0000000112 ****
## 4 gds M4 M8 30 30 443 0.000000998 0.00000599 ****
## 5 gds M4 M12 30 30 465 0.00000000186 0.0000000112 ****
## 6 gds M8 M12 30 30 459 0.0000000149 0.0000000894 ****
##
## 22 Robust RM Trim20
## Call:
## WRS2::rmanova(y = d1$gds, groups = d1$waktu, blocks = d1$id,
## tr = 0.2)
##
## Test statistic: F = 42.3221
## Degrees of freedom 1: 1.79
## Degrees of freedom 2: 30.35
## p-value: 0
##
##
## 23 Outlier Mixed
## [1] kelompok waktu id usia jk gds minggu is.outlier is.extreme
## <0 rows> (or 0-length row.names)
##
## 24 Shapiro Mixed
## # A tibble: 12 × 5
## kelompok waktu variable statistic p
## <fct> <fct> <chr> <dbl> <dbl>
## 1 Kontrol M0 gds 0.965 0.422
## 2 Kontrol M4 gds 0.952 0.193
## 3 Kontrol M8 gds 0.968 0.474
## 4 Kontrol M12 gds 0.968 0.482
## 5 DASH M0 gds 0.979 0.810
## 6 DASH M4 gds 0.970 0.547
## 7 DASH M8 gds 0.980 0.819
## 8 DASH M12 gds 0.950 0.168
## 9 DASH+AF M0 gds 0.962 0.346
## 10 DASH+AF M4 gds 0.967 0.454
## 11 DASH+AF M8 gds 0.986 0.948
## 12 DASH+AF M12 gds 0.950 0.167
##
## 25 Levene
## # A tibble: 4 × 5
## waktu df1 df2 statistic p
## <fct> <int> <int> <dbl> <dbl>
## 1 M0 2 87 1.23 0.297
## 2 M4 2 87 0.519 0.597
## 3 M8 2 87 0.0792 0.924
## 4 M12 2 87 0.648 0.525
##
## 26 Box M
## # A tibble: 1 × 4
## statistic p.value parameter method
## <dbl> <dbl> <dbl> <chr>
## 1 27.8 0.114 20 Box's M-test for Homogeneity of Covariance Matrices
##
## 27 Mixed ANOVA
## Anova Table (Type 3 tests)
##
## Response: gds
## Effect df MSE F ges pes p.value
## 1 kelompok 2, 87 1348.43 3.38 * .067 .072 .039
## 2 waktu 1.93, 168.17 61.09 101.38 *** .086 .538 <.001
## 3 kelompok:waktu 3.87, 168.17 61.09 15.82 *** .028 .267 <.001
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
##
## Sphericity correction method: GG
##
## 28 Sferisitas dan Koreksi Mixed
##
## Univariate Type III Repeated-Measures ANOVA Assuming Sphericity
##
## Sum Sq num Df Error SS den Df F value Pr(>F)
## (Intercept) 5052381 1 117313 87 3746.8731 < 2.2e-16 ***
## kelompok 9120 2 117313 87 3.3816 0.03852 *
## waktu 11972 3 10274 261 101.3774 < 2.2e-16 ***
## kelompok:waktu 3737 6 10274 261 15.8230 1.689e-15 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
##
## Mauchly Tests for Sphericity
##
## Test statistic p-value
## waktu 0.43267 4.3341e-14
## kelompok:waktu 0.43267 4.3341e-14
##
##
## Greenhouse-Geisser and Huynh-Feldt Corrections
## for Departure from Sphericity
##
## GG eps Pr(>F[GG])
## waktu 0.64433 < 2.2e-16 ***
## kelompok:waktu 0.64433 9.127e-11 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## HF eps Pr(>F[HF])
## waktu 0.6587096 1.367890e-29
## kelompok:waktu 0.6587096 5.865321e-11
##
## 29 Multivariat Mixed
##
## Type III Repeated Measures MANOVA Tests: Pillai test statistic
## Df test stat approx F num Df den Df Pr(>F)
## (Intercept) 1 0.97731 3746.9 1 87 < 2.2e-16 ***
## kelompok 2 0.07213 3.4 2 87 0.03852 *
## waktu 1 0.67787 59.6 3 85 < 2.2e-16 ***
## kelompok:waktu 2 0.39671 7.1 6 172 9.133e-07 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## 30 Eta Kuadrat Mixed
## # Effect Size for ANOVA (Type III)
##
## Parameter | Eta2 (partial) | 95% CI
## ----------------------------------------------
## kelompok | 0.07 | [0.00, 1.00]
## waktu | 0.54 | [0.47, 1.00]
## kelompok:waktu | 0.27 | [0.18, 1.00]
##
## - One-sided CIs: upper bound fixed at [1.00].
## Warning: Panel(s) show a mixed within-between-design.
## Error bars do not allow comparisons across all means.
## Suppress error bars with: error = "none"
##
## Interval grafik mixed ANOVA
## Interval within-subject pada grafik afex berbeda dari interval kepercayaan rerata biasa pada grafik profil deskriptif.
##
## 31 Efek Waktu per Kelompok
## kelompok = Kontrol:
## model term df1 df2 F.ratio p.value
## waktu 3 87 1.103 0.3525
##
## kelompok = DASH:
## model term df1 df2 F.ratio p.value
## waktu 3 87 32.785 <0.0001
##
## kelompok = DASH+AF:
## model term df1 df2 F.ratio p.value
## waktu 3 87 46.003 <0.0001
##
##
## 32 Efek Kelompok per Waktu
## waktu = M0:
## model term df1 df2 F.ratio p.value
## kelompok 2 87 0.319 0.7277
##
## waktu = M4:
## model term df1 df2 F.ratio p.value
## kelompok 2 87 1.187 0.3101
##
## waktu = M8:
## model term df1 df2 F.ratio p.value
## kelompok 2 87 3.966 0.0225
##
## waktu = M12:
## model term df1 df2 F.ratio p.value
## kelompok 2 87 10.187 0.0001
##
##
## 33 EMM Waktu per Kelompok
## kelompok = Kontrol:
## waktu emmean SE df lower.CL upper.CL
## M0 126.8463 3.090886 87 120.70282 132.9898
## M4 126.0556 3.449079 87 119.20022 132.9111
## M8 125.3169 3.638411 87 118.08520 132.5487
## M12 123.4138 3.767799 87 115.92494 130.9028
##
## kelompok = DASH:
## waktu emmean SE df lower.CL upper.CL
## M0 125.2575 3.090886 87 119.11404 131.4010
## M4 120.5563 3.449079 87 113.70086 127.4117
## M8 114.2611 3.638411 87 107.02934 121.4928
## M12 105.3677 3.767799 87 97.87882 112.8566
##
## kelompok = DASH+AF:
## waktu emmean SE df lower.CL upper.CL
## M0 123.3596 3.090886 87 117.21610 129.5030
## M4 118.8703 3.449079 87 112.01489 125.7257
## M8 111.6754 3.638411 87 104.44367 118.9072
## M12 100.6214 3.767799 87 93.13253 108.1103
##
## Confidence level used: 0.95
##
## 34 Waktu vs Baseline Holm
## kelompok = Kontrol:
## contrast estimate SE df t.ratio p.value
## M4 - M0 -0.790651 1.324841 87 -0.597 0.8486
## M8 - M0 -1.529361 1.905077 87 -0.803 0.8486
## M12 - M0 -3.432441 2.168321 87 -1.583 0.3512
##
## kelompok = DASH:
## contrast estimate SE df t.ratio p.value
## M4 - M0 -4.701235 1.324841 87 -3.549 0.0006
## M8 - M0 -10.996435 1.905077 87 -5.772 <0.0001
## M12 - M0 -19.889787 2.168321 87 -9.173 <0.0001
##
## kelompok = DASH+AF:
## contrast estimate SE df t.ratio p.value
## M4 - M0 -4.489267 1.324841 87 -3.389 0.0011
## M8 - M0 -11.684162 1.905077 87 -6.133 <0.0001
## M12 - M0 -22.738130 2.168321 87 -10.487 <0.0001
##
## P value adjustment: holm method for 3 tests
##
## 35 Antarkelompok Tukey
## waktu = M0:
## contrast estimate SE df t.ratio p.value
## Kontrol - DASH 1.588782 4.371173 87 0.363 0.9298
## Kontrol - (DASH+AF) 3.486721 4.371173 87 0.798 0.7055
## DASH - (DASH+AF) 1.897938 4.371173 87 0.434 0.9014
##
## waktu = M4:
## contrast estimate SE df t.ratio p.value
## Kontrol - DASH 5.499367 4.877735 87 1.127 0.4999
## Kontrol - (DASH+AF) 7.185336 4.877735 87 1.473 0.3088
## DASH - (DASH+AF) 1.685970 4.877735 87 0.346 0.9363
##
## waktu = M8:
## contrast estimate SE df t.ratio p.value
## Kontrol - DASH 11.055856 5.145490 87 2.149 0.0861
## Kontrol - (DASH+AF) 13.641522 5.145490 87 2.651 0.0256
## DASH - (DASH+AF) 2.585666 5.145490 87 0.503 0.8703
##
## waktu = M12:
## contrast estimate SE df t.ratio p.value
## Kontrol - DASH 18.046128 5.328473 87 3.387 0.0030
## Kontrol - (DASH+AF) 22.792410 5.328473 87 4.277 0.0001
## DASH - (DASH+AF) 4.746282 5.328473 87 0.891 0.6476
##
## P value adjustment: tukey method for comparing a family of 3 estimates
##
## 36 Kontras Perbedaan Perubahan
## waktu_custom kelompok_pairwise estimate SE df t.ratio p.value
## M12-M0 Kontrol - DASH 16.457346 3.066469 87 5.367 <0.0001
## M12-M0 Kontrol - (DASH+AF) 19.305690 3.066469 87 6.296 <0.0001
## M12-M0 DASH - (DASH+AF) 2.848344 3.066469 87 0.929 0.3555
##
## P value adjustment: holm method for 3 tests
##
## 37 Kontras Tren Linear
## waktu_poly kelompok_pairwise estimate SE df t.ratio p.value p.holm
## 1 linear Kontrol - DASH 54.928527 10.26644 87 5.3503019 7.023254e-07 1.404651e-06
## 4 linear Kontrol - (DASH+AF) 64.373254 10.26644 87 6.2702636 1.348292e-08 4.044875e-08
## 7 linear DASH - (DASH+AF) 9.444727 10.26644 87 0.9199617 3.601366e-01 3.601366e-01
##
## Koreksi perbandingan
## Holm untuk waktu versus baseline berlaku dalam tiap kelompok; Tukey berlaku dalam tiap waktu. Kontras perbedaan perubahan dan tren linear memakai Holm pada masing-masing keluarga kontras.
##
## 38 Tabel ANOVA GG
## Effect df MSE F pes p.value
## 1 kelompok 2, 87 1348.43 3.38 * .072 .039
## 2 waktu 1.93, 168.17 61.09 101.38 *** .538 <.001
## 3 kelompok:waktu 3.87, 168.17 61.09 15.82 *** .267 <.001
##
## Interpretasi interaksi
## Mixed ANOVA dengan koreksi Greenhouse-Geisser menghasilkan interaksi kelompok x waktu: F(3.87, 168.17) = 15.823; p < 0,001. Pola perubahan GDS berbeda secara statistik antar kelompok. Arah dan besarnya perbedaan dinilai dari rerata serta kontras perubahan M12-M0.
##
## 39 LMM Intersep
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: gds ~ kelompok * waktu + (1 | id)
## Data: dat_long
## Control: kontrol
##
## REML criterion at convergence: 2631.1
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.01685 -0.60125 0.00543 0.63505 2.25792
##
## Random effects:
## Groups Name Variance Std.Dev.
## id (Intercept) 327.27 18.090
## Residual 39.37 6.274
## Number of obs: 360, groups: id, 90
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 118.4668 1.9354 87.0000 61.212 < 2e-16 ***
## kelompok1 6.9413 2.7370 87.0000 2.536 0.012995 *
## kelompok2 -2.1062 2.7370 87.0000 -0.770 0.443669
## waktu1 6.6876 0.5728 261.0000 11.676 < 2e-16 ***
## waktu2 3.3606 0.5728 261.0000 5.867 1.34e-08 ***
## waktu3 -1.3824 0.5728 261.0000 -2.414 0.016487 *
## kelompok1:waktu1 -5.2495 0.8100 261.0000 -6.481 4.52e-10 ***
## kelompok2:waktu1 2.2092 0.8100 261.0000 2.727 0.006815 **
## kelompok1:waktu2 -2.7131 0.8100 261.0000 -3.350 0.000929 ***
## kelompok2:waktu2 0.8351 0.8100 261.0000 1.031 0.303522
## kelompok1:waktu3 1.2911 0.8100 261.0000 1.594 0.112150
## kelompok2:waktu3 -0.7172 0.8100 261.0000 -0.885 0.376730
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) klmpk1 klmpk2 waktu1 waktu2 waktu3 klm1:1 klm2:1 klm1:2 klm2:2 klm1:3
## kelompok1 0.000
## kelompok2 0.000 -0.500
## waktu1 0.000 0.000 0.000
## waktu2 0.000 0.000 0.000 -0.333
## waktu3 0.000 0.000 0.000 -0.333 -0.333
## klmpk1:wkt1 0.000 0.000 0.000 0.000 0.000 0.000
## klmpk2:wkt1 0.000 0.000 0.000 0.000 0.000 0.000 -0.500
## klmpk1:wkt2 0.000 0.000 0.000 0.000 0.000 0.000 -0.333 0.167
## klmpk2:wkt2 0.000 0.000 0.000 0.000 0.000 0.000 0.167 -0.333 -0.500
## klmpk1:wkt3 0.000 0.000 0.000 0.000 0.000 0.000 -0.333 0.167 -0.333 0.167
## klmpk2:wkt3 0.000 0.000 0.000 0.000 0.000 0.000 0.167 -0.333 0.167 -0.333 -0.500
##
## 40 LMM Intersep Slope
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: gds ~ kelompok * waktu + (1 + minggu | id)
## Data: dat_long
## Control: kontrol
##
## REML criterion at convergence: 2559.8
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.93618 -0.51140 0.01355 0.50268 1.82466
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## id (Intercept) 287.0618 16.9429
## minggu 0.7441 0.8626 0.10
## Residual 19.5231 4.4185
## Number of obs: 360, groups: id, 90
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 118.4668 1.9354 87.0000 61.212 < 2e-16 ***
## kelompok1 6.9413 2.7370 87.0000 2.536 0.01299 *
## kelompok2 -2.1062 2.7370 87.0000 -0.770 0.44367
## waktu1 6.6876 0.6785 116.4291 9.857 < 2e-16 ***
## waktu2 3.3606 0.4425 247.7544 7.595 6.27e-13 ***
## waktu3 -1.3824 0.4425 247.7544 -3.124 0.00199 **
## kelompok1:waktu1 -5.2495 0.9595 116.4291 -5.471 2.60e-07 ***
## kelompok2:waktu1 2.2092 0.9595 116.4291 2.302 0.02308 *
## kelompok1:waktu2 -2.7131 0.6257 247.7544 -4.336 2.11e-05 ***
## kelompok2:waktu2 0.8351 0.6257 247.7544 1.335 0.18325
## kelompok1:waktu3 1.2911 0.6257 247.7544 2.063 0.04012 *
## kelompok2:waktu3 -0.7172 0.6257 247.7544 -1.146 0.25281
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) klmpk1 klmpk2 waktu1 waktu2 waktu3 klm1:1 klm2:1 klm1:2 klm2:2 klm1:3
## kelompok1 0.000
## kelompok2 0.000 -0.500
## waktu1 -0.304 0.000 0.000
## waktu2 -0.156 0.000 0.000 0.150
## waktu3 0.156 0.000 0.000 -0.511 -0.446
## klmpk1:wkt1 0.000 -0.304 0.152 0.000 0.000 0.000
## klmpk2:wkt1 0.000 0.152 -0.304 0.000 0.000 0.000 -0.500
## klmpk1:wkt2 0.000 -0.156 0.078 0.000 0.000 0.000 0.150 -0.075
## klmpk2:wkt2 0.000 0.078 -0.156 0.000 0.000 0.000 -0.075 0.150 -0.500
## klmpk1:wkt3 0.000 0.156 -0.078 0.000 0.000 0.000 -0.511 0.256 -0.446 0.223
## klmpk2:wkt3 0.000 -0.078 0.156 0.000 0.000 0.000 0.256 -0.511 0.223 -0.446 -0.500
##
## 41 Perbandingan LMM REML
## Data: dat_long
## Models:
## lmm1: gds ~ kelompok * waktu + (1 | id)
## lmm2: gds ~ kelompok * waktu + (1 + minggu | id)
## npar AIC BIC logLik -2*log(L) Chisq Df Pr(>Chisq)
## lmm1 14 2659.1 2713.5 -1315.5 2631.1
## lmm2 16 2591.8 2654.0 -1279.9 2559.8 71.304 2 3.285e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Perbandingan model
## Kedua model mempunyai fixed effects yang sama. Perbandingan REML mengikuti materi; nilai p likelihood-ratio bersifat pendekatan karena varians acak diuji pada batas ruang parameter.
##
## 42 Singularitas LMM
## model singular
## 1 Intersep FALSE
## 2 Intersep dan slope FALSE
##
## 43 LMM Kenward Roger
## Type III Analysis of Variance Table with Kenward-Roger's method
## Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
## kelompok 132.0 66.02 2 87.00 3.3816 0.03852 *
## waktu 3226.3 1075.44 3 185.37 54.8329 < 2.2e-16 ***
## kelompok:waktu 1007.4 167.91 6 206.40 8.5515 2.63e-08 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## 44 ICC
## # Intraclass Correlation Coefficient
##
## Adjusted ICC: 0.893
## Unadjusted ICC: 0.751
##
## 45 EMM LMM
## kelompok = Kontrol:
## waktu emmean SE df lower.CL upper.CL
## M0 126.8463 3.196795 90.40 120.49569 133.1969
## M4 126.0556 3.320349 94.57 119.46353 132.6478
## M8 125.3169 3.552975 93.57 118.26200 132.3719
## M12 123.4138 3.875078 89.30 115.71451 131.1132
##
## kelompok = DASH:
## waktu emmean SE df lower.CL upper.CL
## M0 125.2575 3.196795 90.40 118.90691 131.6081
## M4 120.5563 3.320349 94.57 113.96417 127.1484
## M8 114.2611 3.552975 93.57 107.20614 121.3160
## M12 105.3677 3.875078 89.30 97.66838 113.0671
##
## kelompok = DASH+AF:
## waktu emmean SE df lower.CL upper.CL
## M0 123.3596 3.196795 90.40 117.00897 129.7102
## M4 118.8703 3.320349 94.57 112.27820 125.4624
## M8 111.6754 3.552975 93.57 104.62047 118.7304
## M12 100.6214 3.875078 89.30 92.92210 108.3208
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## Demonstrasi data hilang
## Sebanyak 30 pengukuran pascabaseline dihapus secara acak hanya pada salinan demonstrasi. Analisis utama tetap menggunakan seluruh data yang dilampirkan; demonstrasi ini mengikuti bagian LMM data hilang dalam materi.
##
## 46 LMM Data Hilang KR
## Type III Analysis of Variance Table with Kenward-Roger's method
## Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
## kelompok 132.07 66.03 2 86.999 3.2473 0.04364 *
## waktu 2923.95 974.65 3 167.534 47.7009 < 2.2e-16 ***
## kelompok:waktu 1023.82 170.64 6 185.125 8.3416 5.206e-08 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## 47 Ringkasan Data Hilang
## pengukuran_hilang peserta_terdampak peserta_lengkap pengukuran_dianalisis_LMM
## 1 30 25 65 330
##
## 48 Informasi Sesi
## R version 4.6.1 (2026-06-24 ucrt)
## Platform: x86_64-w64-mingw32/x64
## Running under: Windows 11 x64 (build 26200)
##
## Matrix products: default
## LAPACK version 3.12.1
##
## locale:
## [1] LC_COLLATE=English_Indonesia.utf8 LC_CTYPE=English_Indonesia.utf8 LC_MONETARY=English_Indonesia.utf8
## [4] LC_NUMERIC=C LC_TIME=English_Indonesia.utf8
##
## time zone: Asia/Makassar
## tzcode source: internal
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] ggplot2_4.0.3 tidyr_1.3.2 dplyr_1.2.1
##
## loaded via a namespace (and not attached):
## [1] tidyselect_1.2.1 farver_2.1.2 S7_0.2.2 fastmap_1.2.0 reshape_0.8.10
## [6] bayestestR_0.19.0 digest_0.6.39 estimability_2.0.0 lifecycle_1.0.5 magrittr_2.0.5
## [11] compiler_4.6.1 rlang_1.3.0 sass_0.4.10 tools_4.6.1 utf8_1.2.6
## [16] yaml_2.3.12 knitr_1.51 ggsignif_0.6.4 labeling_0.4.3 plyr_1.8.9
## [21] RColorBrewer_1.1-3 abind_1.4-8 withr_3.0.3 purrr_1.2.2 numDeriv_2016.8-1.1
## [26] grid_4.6.1 afex_1.5-1 datawizard_1.4.0 ggpubr_1.0.0 emmeans_2.0.4
## [31] scales_1.4.0 MASS_7.3-65 insight_1.5.4 cli_3.6.6 mvtnorm_1.4-2
## [36] rmarkdown_2.31 ragg_1.5.2 reformulas_0.4.4 generics_0.1.4 otel_0.2.0
## [41] rstudioapi_0.19.0 performance_0.18.2 reshape2_1.4.5 parameters_0.29.3 minqa_1.2.8
## [46] cachem_1.1.0 stringr_1.6.0 splines_4.6.1 parallel_4.6.1 effectsize_1.0.3
## [51] WRS2_1.1-7 base64enc_0.1-6 vctrs_0.7.3 boot_1.3-32 Matrix_1.7-5
## [56] jsonlite_2.0.0 carData_3.0-6 car_3.1-5 pbkrtest_0.5.5 rstatix_1.1.0
## [61] Formula_1.2-6 systemfonts_1.3.2 jquerylib_0.1.4 glue_1.8.1 nloptr_2.2.1
## [66] stringi_1.8.9 gtable_0.3.6 lme4_2.0-6 lmerTest_3.2-1 tibble_3.3.1
## [71] pillar_1.11.1 htmltools_0.5.9 R6_2.6.1 textshaping_1.0.5 Rdpack_2.6.6
## [76] evaluate_1.0.5 lattice_0.22-9 rbibutils_2.4.1 backports_1.5.1 broom_1.0.13
## [81] bslib_0.12.0 Rcpp_1.1.2 nlme_3.1-169 xfun_0.60 pkgconfig_2.0.3
##
## Hasil analisis: D:\2026\S2\latihan bios\Hasil_Analisis_GDS