Laporan ini memuat pemeriksaan data, pembentukan model Linear Mixed Effect, pengujian asumsi, statistik deskriptif, visualisasi, estimasi parameter, random effect, dan pengujian fixed effect.
# Analisis Linear Mixed Effect
# Psychological Flexibility dan Emotional Well-Being
# Memanggil package
library(readr)
library(dplyr)
library(ggplot2)
library(lme4)
library(lmerTest)
library(broom.mixed)
library(performance)
library(DHARMa)
library(lmtest)
# Membaca data
Dataset_longitudinal_GLS <- read_csv2(
"C:/Users/Hype G12/Downloads/Dataset_longitudinal_GLS.csv"
)
# View(Dataset_longitudinal_GLS) # Aktifkan jika dijalankan interaktif di RStudio
# Memeriksa data
str(Dataset_longitudinal_GLS)
## spc_tbl_ [546 × 9] (S3: spec_tbl_df/tbl_df/tbl/data.frame)
## $ id : num [1:546] 1 1 1 2 2 2 3 3 3 4 ...
## $ IDUser : num [1:546] 230642 230642 230642 274870 274870 ...
## $ Time_Point : num [1:546] 1 2 3 1 2 3 1 2 3 1 ...
## $ RespondPrePost: num [1:546] 1 1 1 1 1 1 1 1 1 1 ...
## $ Completers : num [1:546] 1 1 1 1 1 1 1 1 1 1 ...
## $ Groups : num [1:546] 0 0 0 0 0 0 0 0 0 0 ...
## $ Sex_at_birth : num [1:546] 1 1 1 1 1 1 1 1 1 1 ...
## $ Emot_Well_T : num [1:546] 5.58e+14 5.63e+14 4.58e+14 5.82e+14 5.61e+14 ...
## $ Psych_Infle_T : num [1:546] 5.75e+13 5.06e+14 5.86e+14 4.53e+14 4.80e+14 ...
## - attr(*, "spec")=
## .. cols(
## .. id = col_double(),
## .. IDUser = col_double(),
## .. Time_Point = col_double(),
## .. RespondPrePost = col_double(),
## .. Completers = col_double(),
## .. Groups = col_double(),
## .. Sex_at_birth = col_double(),
## .. Emot_Well_T = col_number(),
## .. Psych_Infle_T = col_number()
## .. )
## - attr(*, "problems")=<externalptr>
dim(Dataset_longitudinal_GLS)
## [1] 546 9
names(Dataset_longitudinal_GLS)
## [1] "id" "IDUser" "Time_Point" "RespondPrePost"
## [5] "Completers" "Groups" "Sex_at_birth" "Emot_Well_T"
## [9] "Psych_Infle_T"
head(Dataset_longitudinal_GLS)
colSums(is.na(Dataset_longitudinal_GLS))
## id IDUser Time_Point RespondPrePost Completers
## 0 0 0 0 0
## Groups Sex_at_birth Emot_Well_T Psych_Infle_T
## 0 0 74 51
# Menyiapkan variabel
Dataset_longitudinal_GLS <- Dataset_longitudinal_GLS %>%
mutate(
id = factor(id),
Time_Point = factor(
Time_Point,
levels = c(1, 2, 3),
labels = c("Pre", "Post", "Follow-up")
),
Groups = factor(
Groups,
levels = c(0, 1),
labels = c("Wait-list Control", "Experimental")
)
)
levels(Dataset_longitudinal_GLS$id)
## [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12"
## [13] "13" "14" "15" "16" "17" "18" "19" "20" "21" "22" "23" "24"
## [25] "25" "26" "27" "28" "29" "30" "31" "32" "33" "34" "35" "36"
## [37] "37" "38" "39" "40" "41" "42" "43" "44" "45" "46" "47" "48"
## [49] "49" "50" "51" "52" "53" "54" "55" "56" "57" "58" "59" "60"
## [61] "61" "62" "63" "64" "65" "66" "67" "68" "69" "70" "71" "72"
## [73] "73" "74" "75" "76" "77" "78" "79" "80" "81" "82" "83" "84"
## [85] "85" "86" "87" "88" "89" "90" "91" "92" "93" "94" "95" "96"
## [97] "97" "98" "99" "100" "101" "102" "103" "104" "105" "106" "107" "108"
## [109] "109" "110" "111" "112" "113" "114" "115" "116" "117" "118" "119" "120"
## [121] "121" "122" "123" "124" "125" "126" "127" "128" "129" "130" "131" "132"
## [133] "133" "134" "135" "136" "137" "138" "139" "140" "141" "142" "143" "144"
## [145] "145" "146" "147" "148" "149" "150" "151" "152" "153" "154" "155" "156"
## [157] "157" "158" "159" "160" "161" "162" "163" "164" "165" "166" "167" "168"
## [169] "169" "170" "171" "172" "173" "174" "175" "176" "177" "178" "179" "180"
## [181] "181" "182"
levels(Dataset_longitudinal_GLS$Time_Point)
## [1] "Pre" "Post" "Follow-up"
levels(Dataset_longitudinal_GLS$Groups)
## [1] "Wait-list Control" "Experimental"
unique(Dataset_longitudinal_GLS$Time_Point)
## [1] Pre Post Follow-up
## Levels: Pre Post Follow-up
unique(Dataset_longitudinal_GLS$Groups)
## [1] Wait-list Control Experimental
## Levels: Wait-list Control Experimental
# Membentuk model Linear Mixed Effect
model_pf <- lmer(
Psych_Infle_T ~ Time_Point * Groups + (1 | id),
data = Dataset_longitudinal_GLS,
REML = FALSE
)
model_ewb <- lmer(
Emot_Well_T ~ Time_Point * Groups + (1 | id),
data = Dataset_longitudinal_GLS,
REML = FALSE
)
# Memeriksa ringkasan model
summary(model_pf)
## Linear mixed model fit by maximum likelihood . t-tests use Satterthwaite's
## method [lmerModLmerTest]
## Formula: Psych_Infle_T ~ Time_Point * Groups + (1 | id)
## Data: Dataset_longitudinal_GLS
##
## AIC BIC logLik -2*log(L) df.resid
## 33741.3 33774.9 -16862.6 33725.3 487
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.0368 -0.2782 0.1353 0.5509 1.9129
##
## Random effects:
## Groups Name Variance Std.Dev.
## id (Intercept) 4.097e+27 6.401e+13
## Residual 1.925e+28 1.387e+14
## Number of obs: 495, groups: id, 182
##
## Fixed effects:
## Estimate Std. Error df t value
## (Intercept) 4.521e+14 1.657e+13 7.949e+02 27.281
## Time_PointPost 1.085e+13 2.151e+13 3.646e+06 0.504
## Time_PointFollow-up -1.180e+13 2.309e+13 1.196e+05 -0.511
## GroupsExperimental 7.453e+12 2.270e+13 7.949e+02 0.328
## Time_PointPost:GroupsExperimental -6.715e+13 2.967e+13 1.328e+06 -2.263
## Time_PointFollow-up:GroupsExperimental -5.546e+13 3.146e+13 1.271e+05 -1.763
## Pr(>|t|)
## (Intercept) <2e-16 ***
## Time_PointPost 0.6140
## Time_PointFollow-up 0.6092
## GroupsExperimental 0.7428
## Time_PointPost:GroupsExperimental 0.0236 *
## Time_PointFollow-up:GroupsExperimental 0.0779 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) Tm_PnP Tm_PF- GrpsEx T_PP:G
## Time_PntPst -0.635
## Tm_PntFllw- -0.592 0.459
## GrpsExprmnt -0.730 0.464 0.432
## Tm_PntPs:GE 0.460 -0.725 -0.333 -0.631
## Tm_PntF-:GE 0.434 -0.337 -0.734 -0.595 0.460
summary(model_ewb)
## Linear mixed model fit by maximum likelihood . t-tests use Satterthwaite's
## method [lmerModLmerTest]
## Formula: Emot_Well_T ~ Time_Point * Groups + (1 | id)
## Data: Dataset_longitudinal_GLS
##
## AIC BIC logLik -2*log(L) df.resid
## 32220.9 32254.2 -16102.5 32204.9 464
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.1293 -0.2635 0.2475 0.5645 1.6445
##
## Random effects:
## Groups Name Variance Std.Dev.
## id (Intercept) 4.902e+27 7.001e+13
## Residual 2.095e+28 1.448e+14
## Number of obs: 472, groups: id, 181
##
## Fixed effects:
## Estimate Std. Error df t value
## (Intercept) 4.642e+14 1.764e+13 6.791e+02 26.316
## Time_PointPost 6.242e+12 2.268e+13 9.225e+05 0.275
## Time_PointFollow-up 5.170e+13 2.448e+13 8.447e+04 2.111
## GroupsExperimental -3.534e+13 2.421e+13 6.784e+02 -1.460
## Time_PointPost:GroupsExperimental 4.523e+13 3.164e+13 3.048e+05 1.430
## Time_PointFollow-up:GroupsExperimental 6.033e+13 3.378e+13 7.074e+04 1.786
## Pr(>|t|)
## (Intercept) <2e-16 ***
## Time_PointPost 0.7832
## Time_PointFollow-up 0.0347 *
## GroupsExperimental 0.1447
## Time_PointPost:GroupsExperimental 0.1528
## Time_PointFollow-up:GroupsExperimental 0.0741 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) Tm_PnP Tm_PF- GrpsEx T_PP:G
## Time_PntPst -0.634
## Tm_PntFllw- -0.586 0.459
## GrpsExprmnt -0.729 0.462 0.427
## Tm_PntPs:GE 0.454 -0.717 -0.329 -0.623
## Tm_PntF-:GE 0.425 -0.332 -0.725 -0.583 0.452
# Uji asumsi 1: Normalitas residual
residual_pf <- residuals(model_pf)
residual_ewb <- residuals(model_ewb)
shapiro.test(residual_pf)
##
## Shapiro-Wilk normality test
##
## data: residual_pf
## W = 0.86268, p-value < 2.2e-16
shapiro.test(residual_ewb)
##
## Shapiro-Wilk normality test
##
## data: residual_ewb
## W = 0.82693, p-value < 2.2e-16
qqnorm(
residual_pf,
main = "Q-Q Plot Residual Psychological Flexibility"
)
qqline(residual_pf, col = "red")
qqnorm(
residual_ewb,
main = "Q-Q Plot Residual Emotional Well-Being"
)
qqline(residual_ewb, col = "red")
# Uji asumsi 2: Normalitas random effect
random_intercept_pf <- ranef(model_pf)$id[, "(Intercept)"]
random_intercept_ewb <- ranef(model_ewb)$id[, "(Intercept)"]
shapiro.test(random_intercept_pf)
##
## Shapiro-Wilk normality test
##
## data: random_intercept_pf
## W = 0.99627, p-value = 0.9369
shapiro.test(random_intercept_ewb)
##
## Shapiro-Wilk normality test
##
## data: random_intercept_ewb
## W = 0.953, p-value = 1.022e-05
qqnorm(
random_intercept_pf,
main = "Q-Q Plot Random Effect Psychological Flexibility"
)
qqline(random_intercept_pf, col = "red")
qqnorm(
random_intercept_ewb,
main = "Q-Q Plot Random Effect Emotional Well-Being"
)
qqline(random_intercept_ewb, col = "red")
# Uji asumsi 3: Homoskedastisitas
diagnostik_pf <- data.frame(
fitted = fitted(model_pf),
residual = residuals(model_pf)
)
diagnostik_ewb <- data.frame(
fitted = fitted(model_ewb),
residual = residuals(model_ewb)
)
# Plot residual terhadap nilai prediksi
ggplot(diagnostik_pf, aes(x = fitted, y = residual)) +
geom_point(alpha = 0.5) +
geom_hline(
yintercept = 0,
linetype = "dashed",
color = "red"
) +
labs(
title = "Residual vs Fitted Psychological Flexibility",
x = "Nilai Prediksi",
y = "Residual"
) +
theme_minimal()
ggplot(diagnostik_ewb, aes(x = fitted, y = residual)) +
geom_point(alpha = 0.5) +
geom_hline(
yintercept = 0,
linetype = "dashed",
color = "red"
) +
labs(
title = "Residual vs Fitted Emotional Well-Being",
x = "Nilai Prediksi",
y = "Residual"
) +
theme_minimal()
# Pemeriksaan tambahan menggunakan Breusch-Pagan
# Interpretasikan sebagai diagnostik tambahan untuk model campuran
diagnostik_pf$residual_kuadrat <- diagnostik_pf$residual^2
diagnostik_ewb$residual_kuadrat <- diagnostik_ewb$residual^2
bptest(
residual_kuadrat ~ fitted,
data = diagnostik_pf
)
##
## studentized Breusch-Pagan test
##
## data: residual_kuadrat ~ fitted
## BP = 29.862, df = 1, p-value = 4.638e-08
bptest(
residual_kuadrat ~ fitted,
data = diagnostik_ewb
)
##
## studentized Breusch-Pagan test
##
## data: residual_kuadrat ~ fitted
## BP = 22.265, df = 1, p-value = 2.375e-06
# Uji asumsi 4: Multikolinearitas
performance::check_collinearity(model_pf)
performance::check_collinearity(model_ewb)
# Uji asumsi 5: Autokorelasi residual
# Mengambil data yang benar-benar digunakan dalam model
data_pf_model <- model.frame(model_pf)
data_ewb_model <- model.frame(model_ewb)
# Simulasi residual model Psychological Flexibility
set.seed(123)
sim_pf <- DHARMa::simulateResiduals(
fittedModel = model_pf,
n = 1000,
refit = FALSE
)
plot(sim_pf)
# Simulasi residual model Emotional Well-Being
# Mempertahankan struktur efek acak model
set.seed(123)
simulasi_ewb <- simulate(
model_ewb,
nsim = 1000,
re.form = NULL,
allow.new.levels = TRUE
)
sim_ewb <- DHARMa::createDHARMa(
simulatedResponse = as.matrix(simulasi_ewb),
observedResponse = model.response(model.frame(model_ewb)),
fittedPredictedResponse = predict(
model_ewb,
re.form = NULL
),
integerResponse = FALSE
)
plot(sim_ewb)
# Pemeriksaan korelasi residual antarwaktu dalam individu
# testTemporalAutocorrelation() dari DHARMa mensyaratkan nilai waktu unik.
# Karena setiap waktu memiliki banyak individu, residual disusun per individu
# lalu korelasi residual antarwaktu diperiksa secara terpisah.
# Dengan hanya tiga waktu pengukuran, hasil ini diperlakukan sebagai diagnostik.
uji_korelasi_residual_waktu <- function(model, nama_variabel) {
data_model <- model.frame(model)
data_residual <- data.frame(
id = data_model$id,
Time_Point = data_model$Time_Point,
residual = residuals(model)
)
residual_lebar <- reshape(
data_residual,
idvar = "id",
timevar = "Time_Point",
direction = "wide"
)
pasangan_waktu <- list(
c("residual.Pre", "residual.Post"),
c("residual.Post", "residual.Follow-up"),
c("residual.Pre", "residual.Follow-up")
)
hasil <- lapply(pasangan_waktu, function(pasangan) {
kolom_x <- pasangan[1]
kolom_y <- pasangan[2]
if (!all(c(kolom_x, kolom_y) %in% names(residual_lebar))) {
return(data.frame(
Variabel = nama_variabel,
Pasangan_Waktu = paste(kolom_x, kolom_y, sep = " - "),
Korelasi = NA_real_,
Nilai_p = NA_real_
))
}
data_pasangan <- residual_lebar[
complete.cases(residual_lebar[, c(kolom_x, kolom_y)]),
c(kolom_x, kolom_y),
drop = FALSE
]
if (nrow(data_pasangan) < 3) {
return(data.frame(
Variabel = nama_variabel,
Pasangan_Waktu = paste(kolom_x, kolom_y, sep = " - "),
Korelasi = NA_real_,
Nilai_p = NA_real_
))
}
hasil_korelasi <- cor.test(
data_pasangan[[kolom_x]],
data_pasangan[[kolom_y]],
method = "pearson"
)
data.frame(
Variabel = nama_variabel,
Pasangan_Waktu = paste(kolom_x, kolom_y, sep = " - "),
Korelasi = unname(hasil_korelasi$estimate),
Nilai_p = hasil_korelasi$p.value
)
})
do.call(rbind, hasil)
}
# Psychological Flexibility
hasil_autokorelasi_pf <- uji_korelasi_residual_waktu(
model_pf,
"Psychological Flexibility"
)
hasil_autokorelasi_pf
# Emotional Well-Being
hasil_autokorelasi_ewb <- uji_korelasi_residual_waktu(
model_ewb,
"Emotional Well-Being"
)
hasil_autokorelasi_ewb
# Menyimpan hasil pemeriksaan korelasi residual antarwaktu
write.csv(
hasil_autokorelasi_pf,
"Uji_Korelasi_Residual_Waktu_Psychological_Flexibility.csv",
row.names = FALSE
)
write.csv(
hasil_autokorelasi_ewb,
"Uji_Korelasi_Residual_Waktu_Emotional_Well_Being.csv",
row.names = FALSE
)
# Menyimpan hasil uji normalitas residual
hasil_normalitas_residual <- data.frame(
Variabel = c(
"Psychological Flexibility",
"Emotional Well-Being"
),
Statistik_W = c(
unname(shapiro.test(residual_pf)$statistic),
unname(shapiro.test(residual_ewb)$statistic)
),
Nilai_p = c(
shapiro.test(residual_pf)$p.value,
shapiro.test(residual_ewb)$p.value
)
)
write.csv(
hasil_normalitas_residual,
"Uji_Normalitas_Residual.csv",
row.names = FALSE
)
# Menyimpan hasil uji normalitas random effect
hasil_normalitas_random <- data.frame(
Variabel = c(
"Psychological Flexibility",
"Emotional Well-Being"
),
Statistik_W = c(
unname(shapiro.test(random_intercept_pf)$statistic),
unname(shapiro.test(random_intercept_ewb)$statistic)
),
Nilai_p = c(
shapiro.test(random_intercept_pf)$p.value,
shapiro.test(random_intercept_ewb)$p.value
)
)
write.csv(
hasil_normalitas_random,
"Uji_Normalitas_Random_Effect.csv",
row.names = FALSE
)
# Menyimpan hasil diagnostik homoskedastisitas
write.csv(
diagnostik_pf,
"Diagnostik_Homoskedastisitas_Psychological_Flexibility.csv",
row.names = FALSE
)
write.csv(
diagnostik_ewb,
"Diagnostik_Homoskedastisitas_Emotional_Well_Being.csv",
row.names = FALSE
)
# 4.1 Statistik deskriptif
# Deskriptif Psychological Flexibility
deskriptif_pf <- Dataset_longitudinal_GLS %>%
group_by(Groups, Time_Point) %>%
summarise(
n = sum(!is.na(Psych_Infle_T)),
mean = mean(Psych_Infle_T, na.rm = TRUE),
sd = sd(Psych_Infle_T, na.rm = TRUE),
min = min(Psych_Infle_T, na.rm = TRUE),
max = max(Psych_Infle_T, na.rm = TRUE),
.groups = "drop"
)
deskriptif_pf
# Deskriptif Emotional Well-Being
deskriptif_ewb <- Dataset_longitudinal_GLS %>%
group_by(Groups, Time_Point) %>%
summarise(
n = sum(!is.na(Emot_Well_T)),
mean = mean(Emot_Well_T, na.rm = TRUE),
sd = sd(Emot_Well_T, na.rm = TRUE),
min = min(Emot_Well_T, na.rm = TRUE),
max = max(Emot_Well_T, na.rm = TRUE),
.groups = "drop"
)
deskriptif_ewb
# Menyimpan hasil statistik deskriptif
write.csv(
deskriptif_pf,
"Tabel_4_1_Deskriptif_Psychological_Flexibility.csv",
row.names = FALSE
)
write.csv(
deskriptif_ewb,
"Tabel_4_2_Deskriptif_Emotional_Well_Being.csv",
row.names = FALSE
)
# 4.2 Visualisasi data
# Rata-rata Psychological Flexibility
ggplot(
Dataset_longitudinal_GLS,
aes(
x = Time_Point,
y = Psych_Infle_T,
group = Groups,
linetype = Groups
)
) +
stat_summary(
fun = mean,
geom = "line",
linewidth = 1,
na.rm = TRUE
) +
stat_summary(
fun = mean,
geom = "point",
size = 3,
na.rm = TRUE
) +
labs(
title = "Rata-rata Psychological Flexibility Berdasarkan Waktu dan Kelompok",
x = "Waktu Pengukuran",
y = "Psychological Flexibility",
linetype = "Kelompok"
) +
theme_minimal()
# Perubahan Psychological Flexibility setiap individu
ggplot(
Dataset_longitudinal_GLS,
aes(
x = Time_Point,
y = Psych_Infle_T,
group = id
)
) +
geom_line(alpha = 0.2, na.rm = TRUE) +
geom_point(alpha = 0.3, na.rm = TRUE) +
facet_wrap(~ Groups) +
labs(
title = "Perubahan Psychological Flexibility Individu",
x = "Waktu Pengukuran",
y = "Psychological Flexibility"
) +
theme_minimal()
# Rata-rata Emotional Well-Being
ggplot(
Dataset_longitudinal_GLS,
aes(
x = Time_Point,
y = Emot_Well_T,
group = Groups,
linetype = Groups
)
) +
stat_summary(
fun = mean,
geom = "line",
linewidth = 1,
na.rm = TRUE
) +
stat_summary(
fun = mean,
geom = "point",
size = 3,
na.rm = TRUE
) +
labs(
title = "Rata-rata Emotional Well-Being Berdasarkan Waktu dan Kelompok",
x = "Waktu Pengukuran",
y = "Emotional Well-Being",
linetype = "Kelompok"
) +
theme_minimal()
# Perubahan Emotional Well-Being setiap individu
ggplot(
Dataset_longitudinal_GLS,
aes(
x = Time_Point,
y = Emot_Well_T,
group = id
)
) +
geom_line(alpha = 0.2, na.rm = TRUE) +
geom_point(alpha = 0.3, na.rm = TRUE) +
facet_wrap(~ Groups) +
labs(
title = "Perubahan Emotional Well-Being Individu",
x = "Waktu Pengukuran",
y = "Emotional Well-Being"
) +
theme_minimal()
# 4.3 Pembentukan dan ringkasan model
summary(model_pf)
## Linear mixed model fit by maximum likelihood . t-tests use Satterthwaite's
## method [lmerModLmerTest]
## Formula: Psych_Infle_T ~ Time_Point * Groups + (1 | id)
## Data: Dataset_longitudinal_GLS
##
## AIC BIC logLik -2*log(L) df.resid
## 33741.3 33774.9 -16862.6 33725.3 487
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.0368 -0.2782 0.1353 0.5509 1.9129
##
## Random effects:
## Groups Name Variance Std.Dev.
## id (Intercept) 4.097e+27 6.401e+13
## Residual 1.925e+28 1.387e+14
## Number of obs: 495, groups: id, 182
##
## Fixed effects:
## Estimate Std. Error df t value
## (Intercept) 4.521e+14 1.657e+13 7.949e+02 27.281
## Time_PointPost 1.085e+13 2.151e+13 3.646e+06 0.504
## Time_PointFollow-up -1.180e+13 2.309e+13 1.196e+05 -0.511
## GroupsExperimental 7.453e+12 2.270e+13 7.949e+02 0.328
## Time_PointPost:GroupsExperimental -6.715e+13 2.967e+13 1.328e+06 -2.263
## Time_PointFollow-up:GroupsExperimental -5.546e+13 3.146e+13 1.271e+05 -1.763
## Pr(>|t|)
## (Intercept) <2e-16 ***
## Time_PointPost 0.6140
## Time_PointFollow-up 0.6092
## GroupsExperimental 0.7428
## Time_PointPost:GroupsExperimental 0.0236 *
## Time_PointFollow-up:GroupsExperimental 0.0779 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) Tm_PnP Tm_PF- GrpsEx T_PP:G
## Time_PntPst -0.635
## Tm_PntFllw- -0.592 0.459
## GrpsExprmnt -0.730 0.464 0.432
## Tm_PntPs:GE 0.460 -0.725 -0.333 -0.631
## Tm_PntF-:GE 0.434 -0.337 -0.734 -0.595 0.460
coef_pf <- summary(model_pf)$coefficients
coef_pf
## Estimate Std. Error df
## (Intercept) 4.521252e+14 1.657276e+13 794.8791
## Time_PointPost 1.084779e+13 2.150929e+13 3646199.0649
## Time_PointFollow-up -1.180353e+13 2.309132e+13 119628.8680
## GroupsExperimental 7.453108e+12 2.270099e+13 794.8791
## Time_PointPost:GroupsExperimental -6.714805e+13 2.967318e+13 1328465.9353
## Time_PointFollow-up:GroupsExperimental -5.546196e+13 3.146100e+13 127074.5428
## t value Pr(>|t|)
## (Intercept) 27.2812215 3.567441e-116
## Time_PointPost 0.5043304 6.140293e-01
## Time_PointFollow-up -0.5111676 6.092346e-01
## GroupsExperimental 0.3283165 7.427588e-01
## Time_PointPost:GroupsExperimental -2.2629207 2.364074e-02
## Time_PointFollow-up:GroupsExperimental -1.7628797 7.792318e-02
summary(model_ewb)
## Linear mixed model fit by maximum likelihood . t-tests use Satterthwaite's
## method [lmerModLmerTest]
## Formula: Emot_Well_T ~ Time_Point * Groups + (1 | id)
## Data: Dataset_longitudinal_GLS
##
## AIC BIC logLik -2*log(L) df.resid
## 32220.9 32254.2 -16102.5 32204.9 464
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.1293 -0.2635 0.2475 0.5645 1.6445
##
## Random effects:
## Groups Name Variance Std.Dev.
## id (Intercept) 4.902e+27 7.001e+13
## Residual 2.095e+28 1.448e+14
## Number of obs: 472, groups: id, 181
##
## Fixed effects:
## Estimate Std. Error df t value
## (Intercept) 4.642e+14 1.764e+13 6.791e+02 26.316
## Time_PointPost 6.242e+12 2.268e+13 9.225e+05 0.275
## Time_PointFollow-up 5.170e+13 2.448e+13 8.447e+04 2.111
## GroupsExperimental -3.534e+13 2.421e+13 6.784e+02 -1.460
## Time_PointPost:GroupsExperimental 4.523e+13 3.164e+13 3.048e+05 1.430
## Time_PointFollow-up:GroupsExperimental 6.033e+13 3.378e+13 7.074e+04 1.786
## Pr(>|t|)
## (Intercept) <2e-16 ***
## Time_PointPost 0.7832
## Time_PointFollow-up 0.0347 *
## GroupsExperimental 0.1447
## Time_PointPost:GroupsExperimental 0.1528
## Time_PointFollow-up:GroupsExperimental 0.0741 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) Tm_PnP Tm_PF- GrpsEx T_PP:G
## Time_PntPst -0.634
## Tm_PntFllw- -0.586 0.459
## GrpsExprmnt -0.729 0.462 0.427
## Tm_PntPs:GE 0.454 -0.717 -0.329 -0.623
## Tm_PntF-:GE 0.425 -0.332 -0.725 -0.583 0.452
coef_ewb <- summary(model_ewb)$coefficients
coef_ewb
## Estimate Std. Error df
## (Intercept) 4.641987e+14 1.763972e+13 679.0568
## Time_PointPost 6.241809e+12 2.268308e+13 922494.8593
## Time_PointFollow-up 5.169579e+13 2.448392e+13 84465.1156
## GroupsExperimental -3.534170e+13 2.420626e+13 678.3670
## Time_PointPost:GroupsExperimental 4.523305e+13 3.163740e+13 304837.3041
## Time_PointFollow-up:GroupsExperimental 6.032549e+13 3.377747e+13 70736.6615
## t value Pr(>|t|)
## (Intercept) 26.3155413 9.378589e-106
## Time_PointPost 0.2751746 7.831821e-01
## Time_PointFollow-up 2.1114178 3.473935e-02
## GroupsExperimental -1.4600228 1.447468e-01
## Time_PointPost:GroupsExperimental 1.4297336 1.527945e-01
## Time_PointFollow-up:GroupsExperimental 1.7859680 7.410872e-02
# Formula model
formula(model_pf)
## Psych_Infle_T ~ Time_Point * Groups + (1 | id)
formula(model_ewb)
## Emot_Well_T ~ Time_Point * Groups + (1 | id)
# 4.4 Estimasi parameter dan kesesuaian model
# Interval kepercayaan
confint(model_pf, method = "Wald")
## 2.5 % 97.5 %
## .sig01 NA NA
## .sigma NA NA
## (Intercept) 4.196432e+14 4.846072e+14
## Time_PointPost -3.130964e+13 5.300522e+13
## Time_PointFollow-up -5.706168e+13 3.345461e+13
## GroupsExperimental -3.704001e+13 5.194623e+13
## Time_PointPost:GroupsExperimental -1.253064e+14 -8.989689e+12
## Time_PointFollow-up:GroupsExperimental -1.171244e+14 6.200469e+12
confint(model_ewb, method = "Wald")
## 2.5 % 97.5 %
## .sig01 NA NA
## .sigma NA NA
## (Intercept) 4.296255e+14 4.987719e+14
## Time_PointPost -3.821621e+13 5.069983e+13
## Time_PointFollow-up 3.708183e+12 9.968340e+13
## GroupsExperimental -8.278510e+13 1.210171e+13
## Time_PointPost:GroupsExperimental -1.677511e+13 1.072412e+14
## Time_PointFollow-up:GroupsExperimental -5.877144e+12 1.265281e+14
# Ukuran kesesuaian model
AIC(model_pf)
## [1] 33741.26
BIC(model_pf)
## [1] 33774.9
logLik(model_pf)
## 'log Lik.' -16862.63 (df=8)
AIC(model_ewb)
## [1] 32220.92
BIC(model_ewb)
## [1] 32254.18
logLik(model_ewb)
## 'log Lik.' -16102.46 (df=8)
# Fixed effect Psychological Flexibility
fixed_pf <- broom.mixed::tidy(
model_pf,
effects = "fixed",
conf.int = TRUE
)
fixed_pf
# Fixed effect Emotional Well-Being
fixed_ewb <- broom.mixed::tidy(
model_ewb,
effects = "fixed",
conf.int = TRUE
)
fixed_ewb
# Menyimpan hasil estimasi parameter
write.csv(
fixed_pf,
"Hasil_Fixed_Effect_Psychological_Flexibility.csv",
row.names = FALSE
)
write.csv(
fixed_ewb,
"Hasil_Fixed_Effect_Emotional_Well_Being.csv",
row.names = FALSE
)
# 4.5 Random effect
# Psychological Flexibility
ranef(model_pf)
## $id
## (Intercept)
## 1 -2.674432e+13
## 2 7.354523e+12
## 3 -4.722147e+13
## 4 -5.413846e+13
## 5 -4.032778e+13
## 6 4.671021e+13
## 7 8.730831e+12
## 8 1.076752e+13
## 9 8.738764e+12
## 10 5.227363e+13
## 11 -9.667991e+11
## 12 4.538151e+13
## 13 1.353865e+13
## 14 -3.338276e+13
## 15 3.148090e+13
## 16 -3.755665e+13
## 17 6.606580e+13
## 18 -4.791731e+13
## 19 2.875738e+13
## 20 -4.809251e+13
## 21 6.882635e+13
## 22 1.979154e+13
## 23 8.748717e+13
## 24 3.223385e+13
## 25 -4.151445e+13
## 26 -2.995918e+13
## 27 3.497060e+13
## 28 -4.608007e+13
## 29 1.771518e+13
## 30 7.394196e+12
## 31 -7.824534e+12
## 32 1.150461e+13
## 33 -7.655844e+13
## 34 3.224708e+13
## 35 -3.549615e+13
## 36 -1.405098e+13
## 37 1.908885e+13
## 38 -1.269054e+13
## 39 4.257335e+13
## 40 -5.428934e+13
## 41 5.847891e+13
## 42 3.084961e+13
## 43 -3.858506e+13
## 44 -7.055014e+13
## 45 -2.177600e+13
## 46 -6.428778e+13
## 47 7.145934e+13
## 48 -5.741306e+13
## 49 1.779921e+12
## 50 1.136911e+13
## 51 -1.484686e+13
## 52 -2.815422e+12
## 53 2.521947e+13
## 54 9.300684e+12
## 55 2.521682e+13
## 56 -2.042616e+13
## 57 -7.541532e+13
## 58 2.380878e+13
## 59 2.933517e+13
## 60 -5.296635e+13
## 61 -5.570683e+12
## 62 -3.342640e+13
## 63 4.869340e+13
## 64 2.040107e+13
## 65 3.559071e+13
## 66 -1.127059e+13
## 67 -1.695496e+13
## 68 -9.617421e+13
## 69 -4.582877e+13
## 70 4.457241e+13
## 71 -1.959218e+13
## 72 -6.036014e+13
## 73 5.525268e+13
## 74 -2.706021e+13
## 75 6.664359e+13
## 76 1.413760e+13
## 77 -1.069942e+13
## 78 8.117549e+13
## 79 7.633328e+13
## 80 -2.520487e+13
## 81 -2.867076e+13
## 82 -3.834723e+13
## 83 5.489340e+13
## 84 -5.175673e+12
## 85 2.796680e+13
## 86 6.734364e+13
## 87 -2.158663e+13
## 88 -3.697357e+13
## 89 2.586134e+13
## 90 -1.349171e+13
## 91 3.147225e+13
## 92 -2.450216e+13
## 93 -9.566361e+12
## 94 2.404901e+13
## 95 2.590482e+13
## 96 3.430598e+13
## 97 4.203750e+12
## 98 2.242923e+13
## 99 -3.791263e+13
## 100 -5.871983e+11
## 101 -1.963548e+13
## 102 5.896833e+13
## 103 4.456741e+12
## 104 -9.318929e+12
## 105 -2.200360e+13
## 106 -1.172048e+13
## 107 1.526408e+13
## 108 3.244135e+12
## 109 -3.965769e+13
## 110 7.073290e+13
## 111 -1.185425e+13
## 112 -5.246618e+13
## 113 3.247174e+12
## 114 -1.185425e+13
## 115 1.052919e+13
## 116 -5.651306e+13
## 117 3.655260e+13
## 118 3.983661e+13
## 119 5.017346e+13
## 120 -6.125700e+12
## 121 7.153869e+13
## 122 -1.269054e+13
## 123 -5.658501e+13
## 124 -4.880389e+12
## 125 2.311666e+13
## 126 2.529942e+13
## 127 5.904348e+13
## 128 5.344465e+12
## 129 5.283449e+12
## 130 9.308619e+12
## 131 4.523544e+13
## 132 4.899348e+13
## 133 4.451423e+13
## 134 1.040726e+14
## 135 1.977568e+13
## 136 3.639400e+11
## 137 -2.452333e+13
## 138 -4.435982e+13
## 139 -4.042624e+13
## 140 -1.024815e+13
## 141 -6.456833e+13
## 142 -8.006852e+13
## 143 -6.035351e+13
## 144 -4.149380e+13
## 145 8.028131e+12
## 146 -8.651164e+12
## 147 -7.257326e+12
## 148 5.974618e+13
## 149 -3.685032e+12
## 150 -9.212675e+13
## 151 3.141418e+13
## 152 -2.818244e+13
## 153 -2.195996e+13
## 154 2.949711e+13
## 155 1.633359e+13
## 156 1.689815e+13
## 157 2.404749e+13
## 158 -1.826006e+13
## 159 -1.268261e+13
## 160 -2.441321e+13
## 161 -9.562196e+11
## 162 2.656668e+13
## 163 1.275336e+13
## 164 5.658197e+13
## 165 7.937600e+12
## 166 -3.024648e+12
## 167 -2.373437e+13
## 168 -1.829688e+13
## 169 -3.006558e+13
## 170 -5.798421e+12
## 171 -2.996116e+13
## 172 -4.425497e+13
## 173 -6.551981e+12
## 174 -2.076196e+13
## 175 1.165105e+12
## 176 -8.240502e+12
## 177 3.766707e+13
## 178 -2.591021e+13
## 179 -5.467508e+12
## 180 -5.091698e+13
## 181 2.452999e+13
## 182 -3.438532e+13
##
## with conditional variances for "id"
VarCorr(model_pf)
## Groups Name Std.Dev.
## id (Intercept) 6.4009e+13
## Residual 1.3874e+14
as.data.frame(VarCorr(model_pf))
random_pf <- ranef(model_pf, condVar = TRUE)
random_pf
## $id
## (Intercept)
## 1 -2.674432e+13
## 2 7.354523e+12
## 3 -4.722147e+13
## 4 -5.413846e+13
## 5 -4.032778e+13
## 6 4.671021e+13
## 7 8.730831e+12
## 8 1.076752e+13
## 9 8.738764e+12
## 10 5.227363e+13
## 11 -9.667991e+11
## 12 4.538151e+13
## 13 1.353865e+13
## 14 -3.338276e+13
## 15 3.148090e+13
## 16 -3.755665e+13
## 17 6.606580e+13
## 18 -4.791731e+13
## 19 2.875738e+13
## 20 -4.809251e+13
## 21 6.882635e+13
## 22 1.979154e+13
## 23 8.748717e+13
## 24 3.223385e+13
## 25 -4.151445e+13
## 26 -2.995918e+13
## 27 3.497060e+13
## 28 -4.608007e+13
## 29 1.771518e+13
## 30 7.394196e+12
## 31 -7.824534e+12
## 32 1.150461e+13
## 33 -7.655844e+13
## 34 3.224708e+13
## 35 -3.549615e+13
## 36 -1.405098e+13
## 37 1.908885e+13
## 38 -1.269054e+13
## 39 4.257335e+13
## 40 -5.428934e+13
## 41 5.847891e+13
## 42 3.084961e+13
## 43 -3.858506e+13
## 44 -7.055014e+13
## 45 -2.177600e+13
## 46 -6.428778e+13
## 47 7.145934e+13
## 48 -5.741306e+13
## 49 1.779921e+12
## 50 1.136911e+13
## 51 -1.484686e+13
## 52 -2.815422e+12
## 53 2.521947e+13
## 54 9.300684e+12
## 55 2.521682e+13
## 56 -2.042616e+13
## 57 -7.541532e+13
## 58 2.380878e+13
## 59 2.933517e+13
## 60 -5.296635e+13
## 61 -5.570683e+12
## 62 -3.342640e+13
## 63 4.869340e+13
## 64 2.040107e+13
## 65 3.559071e+13
## 66 -1.127059e+13
## 67 -1.695496e+13
## 68 -9.617421e+13
## 69 -4.582877e+13
## 70 4.457241e+13
## 71 -1.959218e+13
## 72 -6.036014e+13
## 73 5.525268e+13
## 74 -2.706021e+13
## 75 6.664359e+13
## 76 1.413760e+13
## 77 -1.069942e+13
## 78 8.117549e+13
## 79 7.633328e+13
## 80 -2.520487e+13
## 81 -2.867076e+13
## 82 -3.834723e+13
## 83 5.489340e+13
## 84 -5.175673e+12
## 85 2.796680e+13
## 86 6.734364e+13
## 87 -2.158663e+13
## 88 -3.697357e+13
## 89 2.586134e+13
## 90 -1.349171e+13
## 91 3.147225e+13
## 92 -2.450216e+13
## 93 -9.566361e+12
## 94 2.404901e+13
## 95 2.590482e+13
## 96 3.430598e+13
## 97 4.203750e+12
## 98 2.242923e+13
## 99 -3.791263e+13
## 100 -5.871983e+11
## 101 -1.963548e+13
## 102 5.896833e+13
## 103 4.456741e+12
## 104 -9.318929e+12
## 105 -2.200360e+13
## 106 -1.172048e+13
## 107 1.526408e+13
## 108 3.244135e+12
## 109 -3.965769e+13
## 110 7.073290e+13
## 111 -1.185425e+13
## 112 -5.246618e+13
## 113 3.247174e+12
## 114 -1.185425e+13
## 115 1.052919e+13
## 116 -5.651306e+13
## 117 3.655260e+13
## 118 3.983661e+13
## 119 5.017346e+13
## 120 -6.125700e+12
## 121 7.153869e+13
## 122 -1.269054e+13
## 123 -5.658501e+13
## 124 -4.880389e+12
## 125 2.311666e+13
## 126 2.529942e+13
## 127 5.904348e+13
## 128 5.344465e+12
## 129 5.283449e+12
## 130 9.308619e+12
## 131 4.523544e+13
## 132 4.899348e+13
## 133 4.451423e+13
## 134 1.040726e+14
## 135 1.977568e+13
## 136 3.639400e+11
## 137 -2.452333e+13
## 138 -4.435982e+13
## 139 -4.042624e+13
## 140 -1.024815e+13
## 141 -6.456833e+13
## 142 -8.006852e+13
## 143 -6.035351e+13
## 144 -4.149380e+13
## 145 8.028131e+12
## 146 -8.651164e+12
## 147 -7.257326e+12
## 148 5.974618e+13
## 149 -3.685032e+12
## 150 -9.212675e+13
## 151 3.141418e+13
## 152 -2.818244e+13
## 153 -2.195996e+13
## 154 2.949711e+13
## 155 1.633359e+13
## 156 1.689815e+13
## 157 2.404749e+13
## 158 -1.826006e+13
## 159 -1.268261e+13
## 160 -2.441321e+13
## 161 -9.562196e+11
## 162 2.656668e+13
## 163 1.275336e+13
## 164 5.658197e+13
## 165 7.937600e+12
## 166 -3.024648e+12
## 167 -2.373437e+13
## 168 -1.829688e+13
## 169 -3.006558e+13
## 170 -5.798421e+12
## 171 -2.996116e+13
## 172 -4.425497e+13
## 173 -6.551981e+12
## 174 -2.076196e+13
## 175 1.165105e+12
## 176 -8.240502e+12
## 177 3.766707e+13
## 178 -2.591021e+13
## 179 -5.467508e+12
## 180 -5.091698e+13
## 181 2.452999e+13
## 182 -3.438532e+13
##
## with conditional variances for "id"
random_pf_df <- as.data.frame(ranef(model_pf))
write.csv(
random_pf_df,
"Hasil_Random_Effect_Psychological_Flexibility.csv",
row.names = FALSE
)
# Emotional Well-Being
ranef(model_ewb)
## $id
## (Intercept)
## 1 1.776951e+13
## 2 4.036343e+13
## 3 -1.126451e+13
## 4 4.716990e+13
## 5 4.880585e+13
## 6 -4.936637e+13
## 7 3.144740e+13
## 8 -6.296028e+13
## 9 3.122324e+13
## 10 -9.399002e+11
## 11 2.925270e+13
## 12 -1.286523e+13
## 13 5.552226e+12
## 14 -2.489466e+13
## 15 -6.806380e+12
## 16 3.661714e+13
## 17 -9.284785e+13
## 18 4.102973e+13
## 19 -2.043332e+13
## 20 3.101586e+13
## 21 -9.591719e+13
## 22 1.449763e+13
## 23 -5.756785e+13
## 24 1.911304e+13
## 25 4.846832e+13
## 26 2.989731e+13
## 27 -1.774802e+13
## 28 -6.003953e+13
## 29 4.013461e+13
## 30 3.105714e+13
## 31 6.799860e+12
## 32 8.587714e+12
## 33 3.797410e+13
## 34 -4.968816e+13
## 35 3.686917e+13
## 36 5.061321e+13
## 37 -1.356875e+13
## 38 5.261375e+13
## 39 -7.467125e+12
## 40 4.179048e+13
## 41 -9.556762e+13
## 42 1.282832e+13
## 43 3.396214e+13
## 44 6.505407e+13
## 45 -2.777885e+13
## 46 5.101549e+13
## 47 -3.129506e+13
## 48 -6.166216e+13
## 49 5.163827e+13
## 50 1.587405e+13
## 51 -2.263968e+13
## 52 -6.499562e+13
## 53 5.525601e+12
## 54 5.274891e+12
## 55 -4.885846e+13
## 56 2.414895e+13
## 57 7.905343e+13
## 58 -1.117936e+12
## 59 -1.974542e+11
## 60 1.818324e+13
## 61 -4.017294e+13
## 62 -4.690106e+13
## 63 5.663860e+12
## 64 2.488551e+13
## 65 3.388169e+13
## 66 -3.345375e+13
## 67 3.851686e+13
## 68 -1.332376e+14
## 69 -5.485801e+13
## 70 -1.049131e+13
## 71 -6.269079e+12
## 72 4.879380e+13
## 73 -3.461855e+12
## 74 2.873555e+13
## 75 -1.154119e+13
## 76 4.074308e+13
## 77 5.317290e+13
## 78 -6.379475e+12
## 79 -8.417104e+13
## 80 9.120076e+12
## 81 2.751753e+13
## 82 -2.002240e+13
## 83 -1.522377e+13
## 84 4.107474e+13
## 85 5.776168e+13
## 86 -4.046318e+13
## 87 2.896325e+13
## 88 4.317074e+13
## 89 8.891461e+12
## 90 3.574891e+13
## 91 1.083555e+13
## 93 -8.040810e+13
## 94 -2.035606e+13
## 95 -8.045111e+13
## 96 8.613728e+12
## 97 2.116888e+13
## 98 -7.639549e+13
## 99 4.347303e+13
## 100 2.435376e+13
## 101 4.134535e+13
## 102 -4.280958e+13
## 103 7.806972e+11
## 104 2.916438e+13
## 105 2.777646e+13
## 106 2.942159e+13
## 107 -3.101344e+12
## 108 5.134448e+13
## 109 -5.115514e+12
## 110 -2.660447e+13
## 111 -7.028047e+13
## 112 -7.156672e+13
## 113 -1.981352e+13
## 114 -2.322208e+13
## 115 1.957105e+13
## 116 4.806724e+13
## 117 -2.814602e+13
## 118 -6.633595e+13
## 119 -8.115368e+13
## 120 2.364953e+13
## 121 -6.896863e+13
## 122 3.306130e+13
## 123 3.992220e+13
## 124 6.454830e+12
## 125 3.488947e+13
## 126 -1.691328e+13
## 127 -6.673917e+13
## 128 -1.463623e+13
## 129 3.031701e+12
## 130 5.451396e+12
## 131 1.052570e+12
## 132 -8.556588e+12
## 133 1.910244e+13
## 134 -4.410930e+13
## 135 -3.130629e+13
## 136 6.304213e+13
## 137 -2.194131e+13
## 138 -2.912637e+13
## 139 -4.662672e+13
## 140 3.783072e+13
## 141 6.222854e+13
## 142 5.012294e+13
## 143 7.921687e+12
## 144 3.483876e+13
## 145 1.629907e+13
## 146 1.798415e+13
## 147 2.212639e+13
## 148 -7.475924e+13
## 149 -3.702402e+13
## 150 -2.059265e+13
## 151 4.212037e+13
## 152 -3.092129e+13
## 153 -7.400235e+13
## 154 3.686402e+13
## 155 1.811530e+13
## 156 3.389165e+13
## 157 1.555414e+13
## 158 1.452871e+13
## 159 5.353203e+13
## 160 -3.406510e+13
## 161 -3.707035e+13
## 162 -1.066385e+14
## 163 -3.307163e+13
## 164 -9.152819e+13
## 165 6.127389e+12
## 166 2.724620e+13
## 167 5.720186e+13
## 168 4.404403e+13
## 169 5.992214e+13
## 170 4.422274e+13
## 171 -7.753619e+13
## 172 5.431250e+13
## 173 6.112971e+13
## 174 4.557839e+13
## 175 1.856222e+13
## 176 2.628217e+12
## 177 1.067035e+13
## 178 -1.009265e+13
## 179 2.447528e+13
## 180 -1.748116e+13
## 181 1.703587e+13
## 182 -5.595056e+13
##
## with conditional variances for "id"
VarCorr(model_ewb)
## Groups Name Std.Dev.
## id (Intercept) 7.0012e+13
## Residual 1.4475e+14
as.data.frame(VarCorr(model_ewb))
random_ewb <- ranef(model_ewb, condVar = TRUE)
random_ewb
## $id
## (Intercept)
## 1 1.776951e+13
## 2 4.036343e+13
## 3 -1.126451e+13
## 4 4.716990e+13
## 5 4.880585e+13
## 6 -4.936637e+13
## 7 3.144740e+13
## 8 -6.296028e+13
## 9 3.122324e+13
## 10 -9.399002e+11
## 11 2.925270e+13
## 12 -1.286523e+13
## 13 5.552226e+12
## 14 -2.489466e+13
## 15 -6.806380e+12
## 16 3.661714e+13
## 17 -9.284785e+13
## 18 4.102973e+13
## 19 -2.043332e+13
## 20 3.101586e+13
## 21 -9.591719e+13
## 22 1.449763e+13
## 23 -5.756785e+13
## 24 1.911304e+13
## 25 4.846832e+13
## 26 2.989731e+13
## 27 -1.774802e+13
## 28 -6.003953e+13
## 29 4.013461e+13
## 30 3.105714e+13
## 31 6.799860e+12
## 32 8.587714e+12
## 33 3.797410e+13
## 34 -4.968816e+13
## 35 3.686917e+13
## 36 5.061321e+13
## 37 -1.356875e+13
## 38 5.261375e+13
## 39 -7.467125e+12
## 40 4.179048e+13
## 41 -9.556762e+13
## 42 1.282832e+13
## 43 3.396214e+13
## 44 6.505407e+13
## 45 -2.777885e+13
## 46 5.101549e+13
## 47 -3.129506e+13
## 48 -6.166216e+13
## 49 5.163827e+13
## 50 1.587405e+13
## 51 -2.263968e+13
## 52 -6.499562e+13
## 53 5.525601e+12
## 54 5.274891e+12
## 55 -4.885846e+13
## 56 2.414895e+13
## 57 7.905343e+13
## 58 -1.117936e+12
## 59 -1.974542e+11
## 60 1.818324e+13
## 61 -4.017294e+13
## 62 -4.690106e+13
## 63 5.663860e+12
## 64 2.488551e+13
## 65 3.388169e+13
## 66 -3.345375e+13
## 67 3.851686e+13
## 68 -1.332376e+14
## 69 -5.485801e+13
## 70 -1.049131e+13
## 71 -6.269079e+12
## 72 4.879380e+13
## 73 -3.461855e+12
## 74 2.873555e+13
## 75 -1.154119e+13
## 76 4.074308e+13
## 77 5.317290e+13
## 78 -6.379475e+12
## 79 -8.417104e+13
## 80 9.120076e+12
## 81 2.751753e+13
## 82 -2.002240e+13
## 83 -1.522377e+13
## 84 4.107474e+13
## 85 5.776168e+13
## 86 -4.046318e+13
## 87 2.896325e+13
## 88 4.317074e+13
## 89 8.891461e+12
## 90 3.574891e+13
## 91 1.083555e+13
## 93 -8.040810e+13
## 94 -2.035606e+13
## 95 -8.045111e+13
## 96 8.613728e+12
## 97 2.116888e+13
## 98 -7.639549e+13
## 99 4.347303e+13
## 100 2.435376e+13
## 101 4.134535e+13
## 102 -4.280958e+13
## 103 7.806972e+11
## 104 2.916438e+13
## 105 2.777646e+13
## 106 2.942159e+13
## 107 -3.101344e+12
## 108 5.134448e+13
## 109 -5.115514e+12
## 110 -2.660447e+13
## 111 -7.028047e+13
## 112 -7.156672e+13
## 113 -1.981352e+13
## 114 -2.322208e+13
## 115 1.957105e+13
## 116 4.806724e+13
## 117 -2.814602e+13
## 118 -6.633595e+13
## 119 -8.115368e+13
## 120 2.364953e+13
## 121 -6.896863e+13
## 122 3.306130e+13
## 123 3.992220e+13
## 124 6.454830e+12
## 125 3.488947e+13
## 126 -1.691328e+13
## 127 -6.673917e+13
## 128 -1.463623e+13
## 129 3.031701e+12
## 130 5.451396e+12
## 131 1.052570e+12
## 132 -8.556588e+12
## 133 1.910244e+13
## 134 -4.410930e+13
## 135 -3.130629e+13
## 136 6.304213e+13
## 137 -2.194131e+13
## 138 -2.912637e+13
## 139 -4.662672e+13
## 140 3.783072e+13
## 141 6.222854e+13
## 142 5.012294e+13
## 143 7.921687e+12
## 144 3.483876e+13
## 145 1.629907e+13
## 146 1.798415e+13
## 147 2.212639e+13
## 148 -7.475924e+13
## 149 -3.702402e+13
## 150 -2.059265e+13
## 151 4.212037e+13
## 152 -3.092129e+13
## 153 -7.400235e+13
## 154 3.686402e+13
## 155 1.811530e+13
## 156 3.389165e+13
## 157 1.555414e+13
## 158 1.452871e+13
## 159 5.353203e+13
## 160 -3.406510e+13
## 161 -3.707035e+13
## 162 -1.066385e+14
## 163 -3.307163e+13
## 164 -9.152819e+13
## 165 6.127389e+12
## 166 2.724620e+13
## 167 5.720186e+13
## 168 4.404403e+13
## 169 5.992214e+13
## 170 4.422274e+13
## 171 -7.753619e+13
## 172 5.431250e+13
## 173 6.112971e+13
## 174 4.557839e+13
## 175 1.856222e+13
## 176 2.628217e+12
## 177 1.067035e+13
## 178 -1.009265e+13
## 179 2.447528e+13
## 180 -1.748116e+13
## 181 1.703587e+13
## 182 -5.595056e+13
##
## with conditional variances for "id"
random_ewb_df <- as.data.frame(ranef(model_ewb))
write.csv(
random_ewb_df,
"Hasil_Random_Effect_Emotional_Well_Being.csv",
row.names = FALSE
)
# Intraclass Correlation Coefficient (ICC)
performance::icc(model_pf)
performance::icc(model_ewb)
# 4.6 Pengujian fixed effect
# Psychological Flexibility
anova_pf <- anova(model_pf)
anova_pf
summary(model_pf)
## Linear mixed model fit by maximum likelihood . t-tests use Satterthwaite's
## method [lmerModLmerTest]
## Formula: Psych_Infle_T ~ Time_Point * Groups + (1 | id)
## Data: Dataset_longitudinal_GLS
##
## AIC BIC logLik -2*log(L) df.resid
## 33741.3 33774.9 -16862.6 33725.3 487
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.0368 -0.2782 0.1353 0.5509 1.9129
##
## Random effects:
## Groups Name Variance Std.Dev.
## id (Intercept) 4.097e+27 6.401e+13
## Residual 1.925e+28 1.387e+14
## Number of obs: 495, groups: id, 182
##
## Fixed effects:
## Estimate Std. Error df t value
## (Intercept) 4.521e+14 1.657e+13 7.949e+02 27.281
## Time_PointPost 1.085e+13 2.151e+13 3.646e+06 0.504
## Time_PointFollow-up -1.180e+13 2.309e+13 1.196e+05 -0.511
## GroupsExperimental 7.453e+12 2.270e+13 7.949e+02 0.328
## Time_PointPost:GroupsExperimental -6.715e+13 2.967e+13 1.328e+06 -2.263
## Time_PointFollow-up:GroupsExperimental -5.546e+13 3.146e+13 1.271e+05 -1.763
## Pr(>|t|)
## (Intercept) <2e-16 ***
## Time_PointPost 0.6140
## Time_PointFollow-up 0.6092
## GroupsExperimental 0.7428
## Time_PointPost:GroupsExperimental 0.0236 *
## Time_PointFollow-up:GroupsExperimental 0.0779 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) Tm_PnP Tm_PF- GrpsEx T_PP:G
## Time_PntPst -0.635
## Tm_PntFllw- -0.592 0.459
## GrpsExprmnt -0.730 0.464 0.432
## Tm_PntPs:GE 0.460 -0.725 -0.333 -0.631
## Tm_PntF-:GE 0.434 -0.337 -0.734 -0.595 0.460
# Emotional Well-Being
anova_ewb <- anova(model_ewb)
anova_ewb
summary(model_ewb)
## Linear mixed model fit by maximum likelihood . t-tests use Satterthwaite's
## method [lmerModLmerTest]
## Formula: Emot_Well_T ~ Time_Point * Groups + (1 | id)
## Data: Dataset_longitudinal_GLS
##
## AIC BIC logLik -2*log(L) df.resid
## 32220.9 32254.2 -16102.5 32204.9 464
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.1293 -0.2635 0.2475 0.5645 1.6445
##
## Random effects:
## Groups Name Variance Std.Dev.
## id (Intercept) 4.902e+27 7.001e+13
## Residual 2.095e+28 1.448e+14
## Number of obs: 472, groups: id, 181
##
## Fixed effects:
## Estimate Std. Error df t value
## (Intercept) 4.642e+14 1.764e+13 6.791e+02 26.316
## Time_PointPost 6.242e+12 2.268e+13 9.225e+05 0.275
## Time_PointFollow-up 5.170e+13 2.448e+13 8.447e+04 2.111
## GroupsExperimental -3.534e+13 2.421e+13 6.784e+02 -1.460
## Time_PointPost:GroupsExperimental 4.523e+13 3.164e+13 3.048e+05 1.430
## Time_PointFollow-up:GroupsExperimental 6.033e+13 3.378e+13 7.074e+04 1.786
## Pr(>|t|)
## (Intercept) <2e-16 ***
## Time_PointPost 0.7832
## Time_PointFollow-up 0.0347 *
## GroupsExperimental 0.1447
## Time_PointPost:GroupsExperimental 0.1528
## Time_PointFollow-up:GroupsExperimental 0.0741 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) Tm_PnP Tm_PF- GrpsEx T_PP:G
## Time_PntPst -0.634
## Tm_PntFllw- -0.586 0.459
## GrpsExprmnt -0.729 0.462 0.427
## Tm_PntPs:GE 0.454 -0.717 -0.329 -0.623
## Tm_PntF-:GE 0.425 -0.332 -0.725 -0.583 0.452
# Menyimpan hasil pengujian fixed effect
write.csv(
as.data.frame(anova_pf),
"Pengujian_Fixed_Effect_Psychological_Flexibility.csv",
row.names = TRUE
)
write.csv(
as.data.frame(anova_ewb),
"Pengujian_Fixed_Effect_Emotional_Well_Being.csv",
row.names = TRUE
)
# Memeriksa koefisien interaksi Time dan Group
grep(
"Time_Point.*:Groups",
rownames(coef_pf),
value = TRUE
)
## [1] "Time_PointPost:GroupsExperimental"
## [2] "Time_PointFollow-up:GroupsExperimental"
grep(
"Time_Point.*:Groups",
rownames(coef_ewb),
value = TRUE
)
## [1] "Time_PointPost:GroupsExperimental"
## [2] "Time_PointFollow-up:GroupsExperimental"
# Membandingkan model dengan dan tanpa interaksi
model_pf_no_interaction <- lmer(
Psych_Infle_T ~ Time_Point + Groups + (1 | id),
data = Dataset_longitudinal_GLS,
REML = FALSE
)
anova(model_pf_no_interaction, model_pf)
model_ewb_no_interaction <- lmer(
Emot_Well_T ~ Time_Point + Groups + (1 | id),
data = Dataset_longitudinal_GLS,
REML = FALSE
)
anova(model_ewb_no_interaction, model_ewb)