# predict epds by time and group
mod_epds1 <- mmrm(epds ~ time * group + epds_pre + us(time|group/id),
method = "Kenward-Roger", data = data)
# switch time factor
data$time2 <- factor(data$time, levels = c("T2","T1"))
mod_epds1.1 <- mmrm(epds ~ time2 * group + epds_pre + us(time2|group/id),
method = "Kenward-Roger", data = data)
kable(tidy(mod_epds1, conf.int = T), caption = "Model 1: EPDS (Time Ref = T1)")
| term | estimate | std.error | df | statistic | p.value | conf.low | conf.high |
|---|---|---|---|---|---|---|---|
| (Intercept) | 4.8345099 | 1.0829927 | 73.28262 | 4.464028 | 0.0000286 | 2.6762489 | 6.9927709 |
| epds_pre | 0.6113849 | 0.0803578 | 70.23853 | 7.608279 | 0.0000000 | 0.4511258 | 0.7716440 |
| groupExp | -1.6862586 | 1.0636283 | 73.26451 | -1.585383 | 0.1171864 | -3.8059378 | 0.4334206 |
| timeT2 | -1.5333247 | 0.5716504 | 42.42001 | -2.682277 | 0.0103776 | -2.6866237 | -0.3800257 |
| timeT2:groupExp | 2.9063478 | 0.9969495 | 58.68121 | 2.915241 | 0.0050254 | 0.9112297 | 4.9014659 |
kable(tidy(mod_epds1.1, conf.int = T), caption = "Model 2: EPDS (Time Ref = T2)")
| term | estimate | std.error | df | statistic | p.value | conf.low | conf.high |
|---|---|---|---|---|---|---|---|
| (Intercept) | 3.3012441 | 1.1585227 | 77.61833 | 2.849529 | 0.0056041 | 0.9946239 | 5.6078642 |
| epds_pre | 0.6113803 | 0.0804032 | 70.23617 | 7.603927 | 0.0000000 | 0.4510306 | 0.7717301 |
| groupExp | 1.2200826 | 1.0957489 | 73.74985 | 1.113469 | 0.2691229 | -0.9633677 | 3.4035330 |
| time2T1 | 1.5333059 | 0.5716188 | 42.41970 | 2.682392 | 0.0103746 | 0.3800705 | 2.6865414 |
| time2T1:groupExp | -2.9063275 | 0.9960972 | 58.67930 | -2.917715 | 0.0049908 | -4.8997413 | -0.9129138 |
vc_list <- VarCorr(mod_epds1)
Sigma_a <- as.matrix(vc_list[["Ctrl"]])
Sigma_b <- as.matrix(vc_list[["Exp"]])
Ra <- cov2cor(Sigma_a)
Rb <- cov2cor(Sigma_b)
sigmaa <- sqrt(Sigma_a[2, 2])
sigmab <- sqrt(Sigma_b[2, 2])
beta <- coef(mod_epds1)
epds_pre_mean <- mean(data$epds_pre, na.rm = TRUE)
new_a <- data.frame(time = factor("T2", levels = levels(data$time)),
group = factor("Ctrl", levels = levels(data$group)),
epds_pre = epds_pre_mean)
new_b <- data.frame(time = factor("T2", levels = levels(data$time)),
group = factor("Exp", levels = levels(data$group)),
epds_pre = epds_pre_mean)
X_a <- model.matrix(~ time * group + epds_pre, new_a)
X_b <- model.matrix(~ time * group + epds_pre, new_b)
X_a_use <- X_a[, names(beta), drop = FALSE]
X_b_use <- X_b[, names(beta), drop = FALSE]
mu_a <- as.numeric(X_a_use %*% beta)
mu_b <- as.numeric(X_b_use %*% beta)
delta <- abs(mu_b - mu_a)
power.mmrm(
N = length(unique(data$id)),
Ra = Ra,
ra = rep(1,2),
sigmaa = sigmaa,
Rb = Rb,
rb = rep(1,2),
sigmab = sigmab,
lambda = 0.7924,
delta = delta,
sig.level = 0.05
)
##
## Power for Mixed Model of Repeated Measures (Lu, Luo, & Chen, 2008)
##
## n1 = 41.99844
## n2 = 53.00156
## retention1 = 1, 1
## retention2 = 1, 1
## delta = 1.220089
## sig.level = 0.05
## power = 0.2244424
## alternative = two.sided
# predict psi by time and group
mod_psi1 <- mmrm(psi ~ time * group + psi_pre + us(time|group/id),
method = "Kenward-Roger", data = data)
# switch time factor
data$time2 <- factor(data$time, levels = c("T2","T1"))
mod_psi1.1 <- mmrm(psi ~ time2 * group + psi_pre + us(time2|group/id),
method = "Kenward-Roger", data = data)
kable(tidy(mod_psi1, conf.int = TRUE), caption = "Model 1: PSI (Time Ref = T1)")
| term | estimate | std.error | df | statistic | p.value | conf.low | conf.high |
|---|---|---|---|---|---|---|---|
| (Intercept) | 17.0569094 | 5.5292976 | 69.05806 | 3.0848239 | 0.0029285 | 6.0264279 | 28.0873910 |
| groupExp | -4.4497214 | 3.2142914 | 66.68982 | -1.3843553 | 0.1708646 | -10.8660225 | 1.9665797 |
| psi_pre | 0.8221064 | 0.0718433 | 64.48998 | 11.4430572 | 0.0000000 | 0.6786041 | 0.9656088 |
| timeT2 | -1.5399587 | 2.2536148 | 37.97122 | -0.6833283 | 0.4985481 | -6.1022768 | 3.0223594 |
| timeT2:groupExp | 4.1741587 | 3.4110506 | 62.27455 | 1.2237164 | 0.2256692 | -2.6438364 | 10.9921537 |
kable(tidy(mod_psi1.1, conf.int = TRUE), caption = "Model 2: PSI (Time Ref = T2)")
| term | estimate | std.error | df | statistic | p.value | conf.low | conf.high |
|---|---|---|---|---|---|---|---|
| (Intercept) | 15.5170180 | 5.6879908 | 78.81181 | 2.7280315 | 0.0078525 | 4.1949351 | 26.8391009 |
| groupExp | -0.2755245 | 3.3187190 | 70.37184 | -0.0830214 | 0.9340703 | -6.8938861 | 6.3428370 |
| psi_pre | 0.8221055 | 0.0718005 | 64.49372 | 11.4498630 | 0.0000000 | 0.6786888 | 0.9655223 |
| time2T1 | 1.5399608 | 2.2599124 | 37.97311 | 0.6814250 | 0.4997376 | -3.0350992 | 6.1150207 |
| time2T1:groupExp | -4.1742015 | 3.4119625 | 62.27506 | -1.2234019 | 0.2257870 | -10.9940182 | 2.6456152 |
mod_epds2 <- mmrm(epds ~ time * group * age_c + epds_pre + us(time|group/id),
method = "Kenward-Roger", data = data)
mod_epds2.1 <- mmrm(epds ~ time2 * group * age_c + epds_pre + us(time2|group/id),
method = "Kenward-Roger", data = data)
kable(tidy(mod_epds2, conf.int = T), caption = "Model 1: EPDS (Time Ref = T1)")
| term | estimate | std.error | df | statistic | p.value | conf.low | conf.high |
|---|---|---|---|---|---|---|---|
| (Intercept) | 6.3088895 | 1.6035977 | 50.33955 | 3.9342097 | 0.0002563 | 3.0885070 | 9.5292720 |
| age_c | -0.1799192 | 0.2039350 | 41.52183 | -0.8822379 | 0.3827273 | -0.5916171 | 0.2317788 |
| epds_pre | 0.5927851 | 0.0856536 | 70.48612 | 6.9207299 | 0.0000000 | 0.4219752 | 0.7635951 |
| groupExp | -2.7597139 | 2.1837358 | 67.70717 | -1.2637581 | 0.2106507 | -7.1176322 | 1.5982044 |
| groupExp:age_c | 0.1592669 | 0.3367016 | 63.95716 | 0.4730210 | 0.6378086 | -0.5133805 | 0.8319144 |
| timeT2 | -0.9439212 | 1.2047680 | 40.05222 | -0.7834880 | 0.4379494 | -3.3787493 | 1.4909068 |
| timeT2:age_c | -0.1030553 | 0.1725217 | 39.96322 | -0.5973468 | 0.5536456 | -0.4517446 | 0.2456341 |
| timeT2:groupExp | 0.9811894 | 2.0219665 | 56.03339 | 0.4852649 | 0.6293804 | -3.0692430 | 5.0316218 |
| timeT2:groupExp:age_c | 0.3279749 | 0.3107376 | 51.79220 | 1.0554722 | 0.2961082 | -0.2956253 | 0.9515751 |
kable(tidy(mod_epds2.1, conf.int = T), caption = "Model 2: EPDS (Time Ref = T2)")
| term | estimate | std.error | df | statistic | p.value | conf.low | conf.high |
|---|---|---|---|---|---|---|---|
| (Intercept) | 5.3650116 | 1.8046190 | 49.04252 | 2.9729331 | 0.0045629 | 1.7385735 | 8.9914498 |
| age_c | -0.2829736 | 0.2353758 | 40.04442 | -1.2022201 | 0.2363394 | -0.7586695 | 0.1927223 |
| epds_pre | 0.5927803 | 0.0856856 | 70.49276 | 6.9180896 | 0.0000000 | 0.4219069 | 0.7636538 |
| groupExp | -1.7784749 | 2.2515573 | 68.46367 | -0.7898866 | 0.4323213 | -6.2708367 | 2.7138869 |
| groupExp:age_c | 0.4872435 | 0.3409095 | 66.74499 | 1.4292458 | 0.1575974 | -0.1932625 | 1.1677494 |
| time2T1 | 0.9439205 | 1.2050273 | 40.05680 | 0.7833188 | 0.4380470 | -1.4914229 | 3.3792640 |
| time2T1:age_c | 0.1030561 | 0.1725601 | 39.96776 | 0.5972186 | 0.5537300 | -0.2457096 | 0.4518217 |
| time2T1:groupExp | -0.9812475 | 2.0202915 | 56.02585 | -0.4856960 | 0.6290769 | -5.0283365 | 3.0658416 |
| time2T1:groupExp:age_c | -0.3279733 | 0.3103930 | 51.78443 | -1.0566389 | 0.2955810 | -0.9508842 | 0.2949376 |
mod_epds4 <- mmrm(epds ~ time * appuse + epds_pre + us(time|group/id),
method = "Kenward-Roger", data = data[data$group == "Exp",])
mod_epds4.1 <- mmrm(epds ~ time2 * appuse + epds_pre + us(time2|group/id),
method = "Kenward-Roger", data = data[data$group == "Exp",])
kable(tidy(mod_epds4, conf.int = T), caption = "Model 1: EPDS (Time Ref = T1)")
| term | estimate | std.error | df | statistic | p.value | conf.low | conf.high |
|---|---|---|---|---|---|---|---|
| (Intercept) | 1.6085632 | 1.4805763 | 37.70829 | 1.0864440 | 0.2841791 | -1.3894684 | 4.6065948 |
| appuse | 0.0051391 | 0.0054722 | 34.43259 | 0.9391212 | 0.3542101 | -0.0059767 | 0.0162549 |
| epds_pre | 0.7008865 | 0.1071593 | 30.88264 | 6.5406030 | 0.0000003 | 0.4823000 | 0.9194731 |
| timeT2 | 1.9413789 | 0.9828136 | 30.39130 | 1.9753276 | 0.0573738 | -0.0647112 | 3.9474690 |
| timeT2:appuse | -0.0059432 | 0.0053298 | 28.48546 | -1.1150803 | 0.2741355 | -0.0168524 | 0.0049661 |
kable(tidy(mod_epds4.1, conf.int = T), caption = "Model 2: EPDS (Time Ref = T2)")
| term | estimate | std.error | df | statistic | p.value | conf.low | conf.high |
|---|---|---|---|---|---|---|---|
| (Intercept) | 3.5499495 | 1.4850485 | 35.83999 | 2.3904603 | 0.0222068 | 0.5376645 | 6.5622344 |
| appuse | -0.0008041 | 0.0051387 | 29.62659 | -0.1564764 | 0.8767190 | -0.0113044 | 0.0096962 |
| epds_pre | 0.7008867 | 0.1072132 | 30.88351 | 6.5373152 | 0.0000003 | 0.4821905 | 0.9195830 |
| time2T1 | -1.9413871 | 0.9822597 | 30.39146 | -1.9764500 | 0.0572404 | -3.9463461 | 0.0635718 |
| time2T1:appuse | 0.0059432 | 0.0053226 | 28.48558 | 1.1165848 | 0.2735022 | -0.0049514 | 0.0168378 |
mod_psi2 <- mmrm(psi ~ time * group * age_c + psi_pre + us(time|group/id),
method = "Kenward-Roger", data = data)
mod_psi2.1 <- mmrm(psi ~ time2 * group * age_c + psi_pre + us(time2|group/id),
method = "Kenward-Roger", data = data)
kable(tidy(mod_psi2, conf.int = T), caption = "Model 1: PSI (Time Ref = T1)")
| term | estimate | std.error | df | statistic | p.value | conf.low | conf.high |
|---|---|---|---|---|---|---|---|
| (Intercept) | 27.3439401 | 7.1725131 | 61.01591 | 3.812324 | 0.0003230 | 13.0016895 | 41.6861908 |
| age_c | -1.1873323 | 0.5717774 | 36.67133 | -2.076564 | 0.0449058 | -2.3462139 | -0.0284506 |
| groupExp | -18.0961908 | 6.7332102 | 65.79453 | -2.687602 | 0.0091051 | -31.5402622 | -4.6521193 |
| groupExp:age_c | 2.3791818 | 1.0499076 | 64.42569 | 2.266087 | 0.0268130 | 0.2820172 | 4.4763465 |
| psi_pre | 0.7838814 | 0.0807940 | 65.38819 | 9.702220 | 0.0000000 | 0.6225427 | 0.9452200 |
| timeT2 | -8.3219749 | 4.5294544 | 35.30249 | -1.837302 | 0.0745949 | -17.5144406 | 0.8704909 |
| timeT2:age_c | 1.0507986 | 0.6488716 | 35.18834 | 1.619425 | 0.1142852 | -0.2662287 | 2.3678260 |
| timeT2:groupExp | 14.5906683 | 6.8406384 | 58.13177 | 2.132940 | 0.0371633 | 0.8983037 | 28.2830329 |
| timeT2:groupExp:age_c | -1.7747768 | 1.0404203 | 55.15658 | -1.705827 | 0.0936662 | -3.8596927 | 0.3101391 |
kable(tidy(mod_psi2.1, conf.int = T), caption = "Model 2: PSI (Time Ref = T2)")
| term | estimate | std.error | df | statistic | p.value | conf.low | conf.high |
|---|---|---|---|---|---|---|---|
| (Intercept) | 19.0216982 | 7.7435764 | 75.88649 | 2.4564487 | 0.0163173 | 3.5986560 | 34.4447403 |
| age_c | -0.1365327 | 0.7121332 | 41.88816 | -0.1917236 | 0.8488851 | -1.5737895 | 1.3007240 |
| groupExp | -3.5053655 | 7.2695999 | 71.69781 | -0.4821951 | 0.6311362 | -17.9980916 | 10.9873606 |
| groupExp:age_c | 0.6043814 | 1.1112102 | 69.27240 | 0.5438947 | 0.5882602 | -1.6122669 | 2.8210297 |
| psi_pre | 0.7838850 | 0.0806435 | 65.39032 | 9.7203729 | 0.0000000 | 0.6228470 | 0.9449230 |
| time2T1 | 8.3219651 | 4.5446022 | 35.30288 | 1.8311757 | 0.0755247 | -0.9012391 | 17.5451693 |
| time2T1:age_c | -1.0507967 | 0.6510979 | 35.18873 | -1.6138844 | 0.1154856 | -2.3723423 | 0.2707489 |
| time2T1:groupExp | -14.5907276 | 6.8478089 | 58.13400 | -2.1307148 | 0.0373541 | -28.2974337 | -0.8840215 |
| time2T1:groupExp:age_c | 1.7747819 | 1.0412266 | 55.15886 | 1.7045107 | 0.0939131 | -0.3117478 | 3.8613115 |
mod_psi4 <- mmrm(psi ~ time * appuse + psi_pre + us(time|group/id),
method = "Kenward-Roger", data = data[data$group == "Exp",])
mod_psi4.1 <- mmrm(psi ~ time2 * appuse + psi_pre + us(time2|group/id),
method = "Kenward-Roger", data = data[data$group == "Exp",])
kable(tidy(mod_psi4, conf.int = T), caption = "Model 1: PSI (Time Ref = T1)")
| term | estimate | std.error | df | statistic | p.value | conf.low | conf.high |
|---|---|---|---|---|---|---|---|
| (Intercept) | 6.9417312 | 7.5332336 | 32.64179 | 0.9214809 | 0.3635603 | -8.3911398 | 22.2746021 |
| appuse | 0.0137551 | 0.0172156 | 33.05016 | 0.7989925 | 0.4299996 | -0.0212683 | 0.0487785 |
| psi_pre | 0.8814760 | 0.0970092 | 28.08793 | 9.0865194 | 0.0000000 | 0.6827897 | 1.0801623 |
| timeT2 | 3.5617274 | 3.1238880 | 28.10896 | 1.1401585 | 0.2638426 | -2.8361498 | 9.9596045 |
| timeT2:appuse | -0.0085993 | 0.0168811 | 26.52025 | -0.5094062 | 0.6146804 | -0.0432659 | 0.0260672 |
kable(tidy(mod_psi4.1, conf.int = T), caption = "Model 2: PSI (Time Ref = T2)")
| term | estimate | std.error | df | statistic | p.value | conf.low | conf.high |
|---|---|---|---|---|---|---|---|
| (Intercept) | 10.5034691 | 7.3033213 | 28.23920 | 1.4381771 | 0.1613748 | -4.4509995 | 25.4579376 |
| appuse | 0.0051558 | 0.0156809 | 27.62205 | 0.3287967 | 0.7447893 | -0.0269848 | 0.0372965 |
| psi_pre | 0.8814757 | 0.0971517 | 28.08765 | 9.0731923 | 0.0000000 | 0.6824975 | 1.0804539 |
| time2T1 | -3.5617175 | 3.1186119 | 28.10892 | -1.1420843 | 0.2630547 | -9.9487893 | 2.8253543 |
| time2T1:appuse | 0.0085993 | 0.0168418 | 26.52022 | 0.5105930 | 0.6138602 | -0.0259866 | 0.0431852 |
excluding participants with no app usage
mod_epds5 <- mmrm(epds ~ time * group + epds_pre + us(time|group/id),
method = "Kenward-Roger", data = data[data$appuse > 0 | is.na(data$appuse),])
mod_epds5.1 <- mmrm(epds ~ time2 * group + epds_pre + us(time2|group/id),
method = "Kenward-Roger", data = data[data$appuse > 0 | is.na(data$appuse),])
kable(tidy(mod_epds5, conf.int = T), caption = "Model 1: EPDS (Time Ref = T1)")
| term | estimate | std.error | df | statistic | p.value | conf.low | conf.high |
|---|---|---|---|---|---|---|---|
| (Intercept) | 5.1288242 | 1.1216805 | 71.15612 | 4.572447 | 0.0000198 | 2.8923418 | 7.3653066 |
| epds_pre | 0.5830902 | 0.0852514 | 70.60164 | 6.839658 | 0.0000000 | 0.4130872 | 0.7530932 |
| groupExp | -1.3728961 | 1.1180550 | 65.86028 | -1.227933 | 0.2238428 | -3.6052534 | 0.8594612 |
| timeT2 | -1.5271374 | 0.5715379 | 42.43927 | -2.671979 | 0.0106517 | -2.6801941 | -0.3740808 |
| timeT2:groupExp | 2.7934358 | 1.0545753 | 50.49229 | 2.648873 | 0.0107517 | 0.6757705 | 4.9111011 |
kable(tidy(mod_epds5.1, conf.int = T), caption = "Model 2: EPDS (Time Ref = T2)")
| term | estimate | std.error | df | statistic | p.value | conf.low | conf.high |
|---|---|---|---|---|---|---|---|
| (Intercept) | 3.6017395 | 1.1935536 | 76.14739 | 3.017660 | 0.0034631 | 1.2246459 | 5.9788331 |
| epds_pre | 0.5830853 | 0.0852829 | 70.60088 | 6.837070 | 0.0000000 | 0.4130193 | 0.7531513 |
| groupExp | 1.4205311 | 1.1452330 | 68.00654 | 1.240386 | 0.2190951 | -0.8647418 | 3.7058040 |
| time2T1 | 1.5271350 | 0.5715243 | 42.44020 | 2.672039 | 0.0106500 | 0.3741066 | 2.6801635 |
| time2T1:groupExp | -2.7934198 | 1.0536159 | 50.49139 | -2.651270 | 0.0106851 | -4.9091595 | -0.6776801 |
adding covariates
mod_epds6 <- mmrm(epds ~ time * group + epds_pre + SP + edu + citizen +
finaid + cts + preg_planned + us(time|group/id),
method = "Kenward-Roger", data = data)
mod_epds6.1 <- mmrm(epds ~ time2 * group + epds_pre + SP + edu + citizen +
finaid + cts + preg_planned + us(time2|group/id),
method = "Kenward-Roger", data = data)
kable(tidy(mod_epds6, conf.int = T), caption = "Model 1: EPDS (Time Ref = T1)")
| term | estimate | std.error | df | statistic | p.value | conf.low | conf.high |
|---|---|---|---|---|---|---|---|
| (Intercept) | 6.9384114 | 3.0685558 | 66.00092 | 2.2611325 | 0.0270529 | 0.8118437 | 13.0649791 |
| citizen | 1.3797309 | 1.4811082 | 61.69634 | 0.9315531 | 0.3551986 | -1.5812520 | 4.3407139 |
| cts | -0.0804287 | 0.1347181 | 58.25491 | -0.5970148 | 0.5528109 | -0.3500712 | 0.1892138 |
| edu | -0.1045481 | 0.4134496 | 66.37514 | -0.2528679 | 0.8011518 | -0.9299399 | 0.7208436 |
| epds_pre | 0.6025155 | 0.0868145 | 58.37140 | 6.9402607 | 0.0000000 | 0.4287609 | 0.7762702 |
| finaid | -3.6168370 | 1.3787807 | 55.56593 | -2.6232141 | 0.0112219 | -6.3793430 | -0.8543311 |
| groupExp | -1.6097248 | 1.1463420 | 60.16748 | -1.4042274 | 0.1653923 | -3.9026189 | 0.6831692 |
| preg_planned | -1.8099873 | 1.2480103 | 58.16271 | -1.4502984 | 0.1523470 | -4.3080026 | 0.6880280 |
| SP | 0.4173183 | 1.4306401 | 59.98280 | 0.2917004 | 0.7715221 | -2.4444049 | 3.2790416 |
| timeT2 | -1.2950867 | 0.6006221 | 37.71710 | -2.1562421 | 0.0375076 | -2.5112822 | -0.0788912 |
| timeT2:groupExp | 2.1430896 | 1.0192843 | 52.23605 | 2.1025435 | 0.0403428 | 0.0979660 | 4.1882133 |
kable(tidy(mod_epds6.1, conf.int = T), caption = "Model 2: EPDS (Time Ref = T2)")
| term | estimate | std.error | df | statistic | p.value | conf.low | conf.high |
|---|---|---|---|---|---|---|---|
| (Intercept) | 5.6432324 | 3.1052187 | 68.88105 | 1.8173382 | 0.0735149 | -0.5517002 | 11.8381651 |
| citizen | 1.3797675 | 1.4832251 | 61.69485 | 0.9302483 | 0.3558683 | -1.5854488 | 4.3449839 |
| cts | -0.0804268 | 0.1349415 | 58.25363 | -0.5960121 | 0.5534761 | -0.3505166 | 0.1896630 |
| edu | -0.1045375 | 0.4137413 | 66.37356 | -0.2526639 | 0.8013088 | -0.9305119 | 0.7214369 |
| epds_pre | 0.6025167 | 0.0869728 | 58.37014 | 6.9276444 | 0.0000000 | 0.4284452 | 0.7765882 |
| finaid | -3.6168144 | 1.3811067 | 55.56476 | -2.6187799 | 0.0113523 | -6.3839818 | -0.8496469 |
| groupExp | 0.5333510 | 1.1948908 | 63.65568 | 0.4463596 | 0.6568522 | -1.8539665 | 2.9206686 |
| preg_planned | -1.8100088 | 1.2504620 | 58.16139 | -1.4474720 | 0.1531337 | -4.3129327 | 0.6929151 |
| SP | 0.4173179 | 1.4326767 | 59.98145 | 0.2912855 | 0.7718379 | -2.4484803 | 3.2831161 |
| time2T1 | 1.2950872 | 0.6002718 | 37.71755 | 2.1575015 | 0.0374025 | 0.0796017 | 2.5105728 |
| time2T1:groupExp | -2.1430813 | 1.0166760 | 52.23608 | -2.1079295 | 0.0398534 | -4.1829714 | -0.1031911 |
excluding participants with no app usage
mod_psi5 <- mmrm(psi ~ time * group + psi_pre + us(time|group/id),
method = "Kenward-Roger", data = data[data$appuse > 0 | is.na(data$appuse),])
mod_psi5.1 <- mmrm(psi ~ time2 * group + psi_pre + us(time2|group/id),
method = "Kenward-Roger", data = data[data$appuse > 0 | is.na(data$appuse),])
kable(tidy(mod_psi5, conf.int = T), caption = "Model 1: PSI (Time Ref = T1)")
| term | estimate | std.error | df | statistic | p.value | conf.low | conf.high |
|---|---|---|---|---|---|---|---|
| (Intercept) | 16.7647316 | 5.7188826 | 65.83608 | 2.9314698 | 0.0046349 | 5.3460835 | 28.183380 |
| groupExp | -3.6622098 | 3.3598121 | 59.92865 | -1.0900043 | 0.2800748 | -10.3829992 | 3.058580 |
| psi_pre | 0.8261623 | 0.0746454 | 61.80107 | 11.0678188 | 0.0000000 | 0.6769386 | 0.975386 |
| timeT2 | -1.5408675 | 2.2530992 | 37.98850 | -0.6838880 | 0.4981966 | -6.1020738 | 3.020339 |
| timeT2:groupExp | 2.7177914 | 3.3334364 | 58.57302 | 0.8153122 | 0.4181966 | -3.9534170 | 9.389000 |
kable(tidy(mod_psi5.1, conf.int = T), caption = "Model 2: PSI (Time Ref = T2)")
| term | estimate | std.error | df | statistic | p.value | conf.low | conf.high |
|---|---|---|---|---|---|---|---|
| (Intercept) | 15.2241275 | 5.8741850 | 74.91084 | 2.5917004 | 0.0114755 | 3.521923 | 26.9263324 |
| groupExp | -0.9444507 | 3.3891420 | 62.53071 | -0.2786696 | 0.7814179 | -7.718106 | 5.8292041 |
| psi_pre | 0.8261587 | 0.0746044 | 61.80139 | 11.0738582 | 0.0000000 | 0.677017 | 0.9753003 |
| time2T1 | 1.5408679 | 2.2594539 | 37.98799 | 0.6819648 | 0.4993984 | -3.033205 | 6.1149407 |
| time2T1:groupExp | -2.7177534 | 3.3342209 | 58.57338 | -0.8151090 | 0.4183120 | -9.390531 | 3.9550241 |
adding covariates
mod_psi6 <- mmrm(psi ~ time * group + psi_pre + SP + edu + citizen +
finaid + cts + preg_planned + us(time|group/id),
method = "Kenward-Roger", data = data)
mod_psi6.1 <- mmrm(psi ~ time2 * group + psi_pre + SP + edu + citizen +
finaid + cts + preg_planned + us(time2|group/id),
method = "Kenward-Roger", data = data)
kable(tidy(mod_psi6, conf.int = T), caption = "Model 1: PSI (Time Ref = T1)")
| term | estimate | std.error | df | statistic | p.value | conf.low | conf.high |
|---|---|---|---|---|---|---|---|
| (Intercept) | 4.3776108 | 10.0145075 | 63.43621 | 0.4371269 | 0.6635038 | -15.6320927 | 24.3873143 |
| citizen | 2.6635208 | 4.4126006 | 58.79621 | 0.6036170 | 0.5484201 | -6.1667130 | 11.4937546 |
| cts | 0.5285038 | 0.4071192 | 56.45022 | 1.2981548 | 0.1995131 | -0.2869105 | 1.3439181 |
| edu | 2.0102048 | 1.2909308 | 61.97358 | 1.5571747 | 0.1245215 | -0.5703509 | 4.5907605 |
| finaid | 0.3088264 | 4.2378485 | 55.87983 | 0.0728734 | 0.9421671 | -8.1810071 | 8.7986600 |
| groupExp | -4.4939552 | 3.6226185 | 59.42535 | -1.2405268 | 0.2196562 | -11.7417127 | 2.7538023 |
| preg_planned | -0.3701674 | 3.8805960 | 57.27791 | -0.0953893 | 0.9243385 | -8.1401099 | 7.3997750 |
| psi_pre | 0.7986455 | 0.0789524 | 50.77292 | 10.1155248 | 0.0000000 | 0.6401246 | 0.9571663 |
| SP | -0.4783158 | 4.3927445 | 58.45252 | -0.1088877 | 0.9136645 | -9.2699001 | 8.3132685 |
| timeT2 | -0.4010091 | 1.9488872 | 36.50934 | -0.2057631 | 0.8381190 | -4.3516218 | 3.5496036 |
| timeT2:groupExp | 2.5889151 | 3.3684611 | 50.76934 | 0.7685750 | 0.4457062 | -4.1742988 | 9.3521290 |
kable(tidy(mod_psi6.1, conf.int = T), caption = "Model 2: PSI (Time Ref = T2)")
| term | estimate | std.error | df | statistic | p.value | conf.low | conf.high |
|---|---|---|---|---|---|---|---|
| (Intercept) | 3.9766851 | 10.0203626 | 63.72797 | 0.3968604 | 0.6927963 | -16.0429362 | 23.9963064 |
| citizen | 2.6635400 | 4.4168253 | 58.79551 | 0.6030440 | 0.5487986 | -6.1751502 | 11.5022301 |
| cts | 0.5285147 | 0.4075543 | 56.44907 | 1.2967958 | 0.1999773 | -0.2877713 | 1.3448007 |
| edu | 2.0101722 | 1.2912911 | 61.97283 | 1.5567149 | 0.1246307 | -0.5711046 | 4.5914489 |
| finaid | 0.3087952 | 4.2403818 | 55.87862 | 0.0728225 | 0.9422074 | -8.1861174 | 8.8037079 |
| groupExp | -1.9050284 | 3.5024199 | 59.68580 | -0.5439178 | 0.5885242 | -8.9116700 | 5.1016131 |
| preg_planned | -0.3701916 | 3.8849710 | 57.27699 | -0.0952881 | 0.9244186 | -8.1488966 | 7.4085134 |
| psi_pre | 0.7986440 | 0.0790606 | 50.77166 | 10.1016674 | 0.0000000 | 0.6399059 | 0.9573821 |
| SP | -0.4781988 | 4.3950021 | 58.45139 | -0.1088051 | 0.9137297 | -9.2743050 | 8.3179074 |
| time2T1 | 0.4009994 | 1.9498435 | 36.51118 | 0.2056572 | 0.8382011 | -3.5515450 | 4.3535438 |
| time2T1:groupExp | -2.5889276 | 3.3625485 | 50.76396 | -0.7699302 | 0.4449095 | -9.3402876 | 4.1624324 |