Setup, Data, Packages
if (Sys.info()[["user"]] == "jwile") {
loc.data <- "g:/My Drive/CBTI+Light project/Recruitment and data collection/"
} else {
loc.data <- "/Volumes/GoogleDrive/My Drive/CBTI+Light project/Recruitment and data collection/"
}
## graphics packages
library(ggplot2)
library(ggpubr)
## tools and miscellaneous packages
library(JWileymisc)
## Registered S3 methods overwritten by 'lme4':
## method from
## cooks.distance.influence.merMod car
## influence.merMod car
## dfbeta.influence.merMod car
## dfbetas.influence.merMod car
## data related packages
library(reshape2)
library(data.table)
##
## Attaching package: 'data.table'
## The following objects are masked from 'package:reshape2':
##
## dcast, melt
library(rhdf5)
## modelling packages
library(MplusAutomation)
## Version: 0.8
## We work hard to write this free software. Please help us get credit by citing:
##
## Hallquist, M. N. & Wiley, J. F. (2018). MplusAutomation: An R Package for Facilitating Large-Scale Latent Variable Analyses in Mplus. Structural Equation Modeling, 25, 621-638. doi: 10.1080/10705511.2017.1402334.
##
## -- see citation("MplusAutomation").
##
## Attaching package: 'MplusAutomation'
## The following object is masked from 'package:JWileymisc':
##
## cd
theme_set(theme_pubr())
Sys.setenv(TZ = "Australia/Melbourne")
SEtrans <- function(x) {
(10 - sqrt(100 - x)) ^2
}
SEback <- function(x) {
100 - ((10 - sqrt(x))^2)
}
square <- function(x) x^2
d.all <- readRDS(file.path(loc.data, "Data", "SleepWell_Surveys.RDS"))
d.sleep <- readRDS(file.path(loc.data, "Data", "SleepWell_Sleep.RDS"))
ds2 <- d.sleep[!is.na(Date)]
ds2 <- merge(ds2, d.all[!duplicated(ID), .(ID, condition, baseline_isi_high, baseline_stage_high)],
by = "ID", all.x = TRUE)
## create stratification factors
ds2[, dcond := as.integer(condition == "CBT+")]
ds2[, dstrat1 := as.integer(baseline_isi_high == "ISI <= 7" & baseline_stage_high == "Stage <= 2")]
ds2[, dstrat2 := as.integer(baseline_isi_high == "ISI <= 7" & baseline_stage_high == "Stage >= 3")]
ds2[, dstrat3 := as.integer(baseline_isi_high == "ISI >= 8" & baseline_stage_high == "Stage <= 2")]
ds2[, dstrat4 := as.integer(baseline_isi_high == "ISI >= 8" & baseline_stage_high == "Stage >= 3")]
## time variable, weeks since Email1Date
ds2[, Time := as.integer(Date - Email1Date)/7, by = ID]
## covariates
ds2[, WKND := as.integer(weekdays(Date) %in% c("Saturday", "Sunday"))]
ds2[!is.na(DEXA), USEDEXA := as.integer(!DEXA %in% c("", "0"))]
## transform sleep variables that are not normal / are skewed
ds2[, SEstrans := SEtrans(SEs)]
ds2[, SEactitrans := SEtrans(SEacti)]
ds2[, SOLstrans := as.numeric(winsorizor(sqrt(SOL), percentile = .005))]
ds2[, SOLactitrans := as.numeric(winsorizor(sqrt(SOLacti), percentile = .005))]
ds2[, WASOstrans := as.numeric(winsorizor(sqrt(WASO), percentile = .005))]
ds2[, WASOactitrans := as.numeric(winsorizor(sqrt(WASOacti), percentile = .005))]
## weighted.mean(c(1, 4, 2, 5), w = c(.3, .2, .25, .25))
## check that weight the differences relative to first by weights matches
## 1 + 3 * .2 + 1 * .25 + 4 * .25
mcsetup <- "
MODEL CONSTRAINT:
NEW(itau icbt idiff stau scbt sdiff);
itau = mi + i1 * %0.4f + i2 * %0.4f + i3 * %0.4f;
icbt = itau + i4;
idiff = i4;
stau = ms;
scbt = ms + s1;
sdiff = s1;
PLOT(tau cbt delta d);
LOOP(Time, 0, 6, 0.1428571);
tau = itau + stau * Time;
cbt = icbt + scbt * Time;
delta = cbt - tau;
d = delta / sqrt(vi + resvar);
resvar > .001;
vi > .001;
vs > .001;
"
## define geoms and styles and labels for
## the diary / acti sleep outcomes
dailysleepStyle <- list(
geom_ribbon(colour = NA, alpha = .2),
geom_line(size = 1),
scale_x_continuous("week", breaks = -1:6, labels = c(
"",
"Intervention Start ",
paste0("Wk ", 1:5),
"End")),
theme(axis.title.x = element_blank()),
color_palette("jco"),
fill_palette("jco"),
coord_cartesian(xlim = c(-.5, 6), expand = FALSE, clip = "off"),
theme(plot.margin = margin(6, 12, 0, 20, "pt")))
Diary - Sleep Efficiency
sesdat <- na.omit(ds2[, .(ID, Time, dstrat2, dstrat3, dstrat4, dcond, SEstrans)])
sesfit <- mplusModeler(mplusObject(
TITLE = "Self-Report SE Analysis;",
VARIABLE = "
WITHIN = Time;
BETWEEN = dstrat2 dstrat3 dstrat4 dcond;
CLUSTER = ID;",
ANALYSIS = "
ESTIMATOR = ML;
TYPE = TWOLEVEL RANDOM;
PROCESSORS = 2;
STARTS = 50 5;
STITERATIONS = 200;
MITERATIONS = 10000;
MCONVERGENCE = .000001;
",
MODEL = "
%WITHIN%
s | SEstrans ON Time;
SEstrans* (resvar);
%BETWEEN%
SEstrans ON dstrat2 dstrat3 dstrat4 dcond (i1 - i4);
s ON dcond (s1);
SEstrans WITH s*;
SEstrans* s* (vi vs);
[SEstrans* s*] (mi ms);
",
OUTPUT = "CINTERVAL;",
PLOT = "TYPE = PLOT2;",
MODELCONSTRAINT = sprintf(
mcsetup,
mean(sesdat$dstrat2),
mean(sesdat$dstrat3),
mean(sesdat$dstrat4)),
usevariables = c("ID", "Time", "SEstrans",
"dstrat2", "dstrat3", "dstrat4", "dcond"),
rdata = as.data.frame(sesdat)),
dataout = "02_ses.dat", run = TRUE, writeData = "always", hashfilename = FALSE)
## Wrote model to: 02_ses.inp
## Wrote data to: 02_ses.dat
## model information, coefficients, and effect sizes
sesout <- cbind(
coef(sesfit, param = c("reg", "exp", "new")),
round(confint(sesfit, param = c("reg", "exp", "new"))[,-1], 2))[, c(1, 2, 5, 6, 4)]
with(sesout,
data.frame(
Label = Label,
Out = sprintf("%0.2f (%0.2f, %0.2f)", round(est, 2), LowerCI, UpperCI),
pval = formatPval(pval, d = 3, sd = 3)))
## Label Out pval
## 1 B S<-DCOND -0.52 (-1.57, 0.53) .331
## 2 B SESTRANS<-DSTRAT2 0.88 (-9.99, 11.76) .873
## 3 B SESTRANS<-DSTRAT3 -8.56 (-16.93, -0.19) .045
## 4 B SESTRANS<-DSTRAT4 -3.41 (-11.63, 4.81) .417
## 5 B SESTRANS<-DCOND 6.03 (-0.00, 12.05) .050
## 6 B SESTRANS<-Intercepts 47.31 (40.05, 54.58) < .001
## 7 B S<-Intercepts 1.48 (0.74, 2.21) < .001
## 8 B ITAU 43.36 (38.90, 47.82) < .001
## 9 B ICBT 49.39 (45.34, 53.43) < .001
## 10 B IDIFF 6.03 (-0.00, 12.05) .050
## 11 B STAU 1.48 (0.74, 2.21) < .001
## 12 B SCBT 0.96 (0.21, 1.71) .012
## 13 B SDIFF -0.52 (-1.57, 0.53) .331
sesplot <- data.table(
Condition = rep(c("TAU+", "CBT-I+Light"), each = 43),
Time = c(sesfit$results$gh5$loop_data$xvalues, sesfit$results$gh5$loop_data$xvalues),
Estimate = c(sesfit$results$gh5$loop_data$estimates[1, ], sesfit$results$gh5$loop_data$estimates[2, ]),
LL = c(sesfit$results$gh5$loop_data$lowerci[1, ], sesfit$results$gh5$loop_data$lowerci[2, ]),
UL = c(sesfit$results$gh5$loop_data$upperci[1, ], sesfit$results$gh5$loop_data$upperci[2, ]))
p.ses <- ggplot(sesplot, aes(Time, SEback(Estimate), ymin = SEback(LL), ymax = SEback(UL),
colour = Condition, fill = Condition)) +
scale_y_continuous("SE (Diary)", breaks = 86:95) +
annotate("text", x = 2, y = 93.5, label = sprintf("CBT-I+Light slope %s", formatPval(subset(sesout, Label == "B SCBT")$pval, d = 3, sd = 3, includeP = TRUE))) +
annotate("text", x = 2, y = 88, label = sprintf("TAU+ slope %s", formatPval(subset(sesout, Label == "B STAU")$pval, d = 3, sd = 3, includeP = TRUE))) +
dailysleepStyle
print(p.ses)
sesdiffplot <- with(sesfit$results$gh5$loop_data, data.table(
Type = rep(c("Raw", "standardized"), each = 43),
Time = round(c(xvalues, xvalues) * 7),
Estimate = c(estimates[3, ], estimates[4, ]),
LL = c(lowerci[3, ], lowerci[4, ]),
UL = c(upperci[3, ], upperci[4, ])))
sesdiffplot[Type == "Raw"]
## Type Time Estimate LL UL
## 1: Raw 0 6.024970 -0.003316119 12.05326
## 2: Raw 1 5.950692 -0.045116261 11.94650
## 3: Raw 2 5.876413 -0.090502083 11.84333
## 4: Raw 3 5.802135 -0.139525905 11.74380
## 5: Raw 4 5.727857 -0.192234263 11.64795
## 6: Raw 5 5.653578 -0.248667583 11.55582
## 7: Raw 6 5.579299 -0.308859706 11.46746
## 8: Raw 7 5.505021 -0.372837692 11.38288
## 9: Raw 8 5.430743 -0.440621406 11.30211
## 10: Raw 9 5.356464 -0.512223542 11.22515
## 11: Raw 10 5.282186 -0.587649286 11.15202
## 12: Raw 11 5.207908 -0.666896403 11.08271
## 13: Raw 12 5.133629 -0.749955237 11.01721
## 14: Raw 13 5.059351 -0.836808741 10.95551
## 15: Raw 14 4.985073 -0.927432716 10.89758
## 16: Raw 15 4.910794 -1.021795988 10.84338
## 17: Raw 16 4.836516 -1.119860649 10.79289
## 18: Raw 17 4.762238 -1.221582770 10.74606
## 19: Raw 18 4.687959 -1.326912045 10.70283
## 20: Raw 19 4.613681 -1.435793042 10.66315
## 21: Raw 20 4.539402 -1.548165202 10.62697
## 22: Raw 21 4.465124 -1.663963437 10.59421
## 23: Raw 22 4.390846 -1.783118725 10.56481
## 24: Raw 23 4.316567 -1.905558109 10.53869
## 25: Raw 24 4.242289 -2.031206369 10.51578
## 26: Raw 25 4.168011 -2.159985065 10.49601
## 27: Raw 26 4.093732 -2.291814089 10.47928
## 28: Raw 27 4.019454 -2.426611662 10.46552
## 29: Raw 28 3.945175 -2.564295292 10.45465
## 30: Raw 29 3.870897 -2.704781294 10.44658
## 31: Raw 30 3.796619 -2.847985744 10.44122
## 32: Raw 31 3.722340 -2.993825197 10.43851
## 33: Raw 32 3.648062 -3.142216206 10.43834
## 34: Raw 33 3.573784 -3.293076515 10.44064
## 35: Raw 34 3.499505 -3.446323872 10.44533
## 36: Raw 35 3.425227 -3.601878166 10.45233
## 37: Raw 36 3.350949 -3.759660006 10.46156
## 38: Raw 37 3.276670 -3.919592142 10.47293
## 39: Raw 38 3.202392 -4.081598759 10.48638
## 40: Raw 39 3.128114 -4.245605469 10.50183
## 41: Raw 40 3.053835 -4.411540508 10.51921
## 42: Raw 41 2.979557 -4.579333782 10.53845
## 43: Raw 42 2.905278 -4.748916626 10.55947
## Type Time Estimate LL UL
sesdiffplot[Type == "standardized"]
## Type Time Estimate LL UL
## 1: standardized 0 0.2970576 -0.001270341 0.5953856
## 2: standardized 1 0.2933954 -0.003310000 0.5901008
## 3: standardized 2 0.2897331 -0.005525920 0.5849922
## 4: standardized 3 0.2860709 -0.007920701 0.5800624
## 5: standardized 4 0.2824086 -0.010496666 0.5753139
## 6: standardized 5 0.2787464 -0.013255837 0.5707486
## 7: standardized 6 0.2750841 -0.016199918 0.5663682
## 8: standardized 7 0.2714219 -0.019330280 0.5621740
## 9: standardized 8 0.2677596 -0.022647945 0.5581672
## 10: standardized 9 0.2640974 -0.026153581 0.5543483
## 11: standardized 10 0.2604351 -0.029847492 0.5507177
## 12: standardized 11 0.2567729 -0.033729617 0.5472754
## 13: standardized 12 0.2531106 -0.037799530 0.5440208
## 14: standardized 13 0.2494484 -0.042056438 0.5409532
## 15: standardized 14 0.2457861 -0.046499208 0.5380715
## 16: standardized 15 0.2421239 -0.051126346 0.5353740
## 17: standardized 16 0.2384616 -0.055936050 0.5328593
## 18: standardized 17 0.2347994 -0.060926188 0.5305249
## 19: standardized 18 0.2311371 -0.066094346 0.5283685
## 20: standardized 19 0.2274749 -0.071437828 0.5263875
## 21: standardized 20 0.2238126 -0.076953694 0.5245789
## 22: standardized 21 0.2201504 -0.082638785 0.5229395
## 23: standardized 22 0.2164881 -0.088489726 0.5214659
## 24: standardized 23 0.2128258 -0.094502978 0.5201547
## 25: standardized 24 0.2091636 -0.100674845 0.5190020
## 26: standardized 25 0.2055013 -0.107001513 0.5180042
## 27: standardized 26 0.2018391 -0.113479041 0.5171572
## 28: standardized 27 0.1981768 -0.120103441 0.5164571
## 29: standardized 28 0.1945146 -0.126870647 0.5158998
## 30: standardized 29 0.1908523 -0.133776560 0.5154812
## 31: standardized 30 0.1871901 -0.140817061 0.5151972
## 32: standardized 31 0.1835278 -0.147988051 0.5150437
## 33: standardized 32 0.1798656 -0.155285418 0.5150166
## 34: standardized 33 0.1762033 -0.162705094 0.5151117
## 35: standardized 34 0.1725411 -0.170243070 0.5153252
## 36: standardized 35 0.1688788 -0.177895367 0.5156530
## 37: standardized 36 0.1652166 -0.185658082 0.5160912
## 38: standardized 37 0.1615543 -0.193527415 0.5166361
## 39: standardized 38 0.1578921 -0.201499581 0.5172837
## 40: standardized 39 0.1542298 -0.209570974 0.5180306
## 41: standardized 40 0.1505676 -0.217737988 0.5188731
## 42: standardized 41 0.1469053 -0.225997165 0.5198078
## 43: standardized 42 0.1432431 -0.234345168 0.5208313
## Type Time Estimate LL UL
Diary - WASO
wasodat <- na.omit(ds2[, .(ID, Time, dstrat2, dstrat3, dstrat4, dcond, WASOstrans)])
wasofit <- mplusModeler(mplusObject(
TITLE = "Self-Report WASO Analysis;",
VARIABLE = "
WITHIN = Time;
BETWEEN = dstrat2 dstrat3 dstrat4 dcond;
CLUSTER = ID;",
ANALYSIS = "
ESTIMATOR = ML;
TYPE = TWOLEVEL RANDOM;
PROCESSORS = 2;
STARTS = 50 5;
STITERATIONS = 200;
MITERATIONS = 10000;
MCONVERGENCE = .000001;
",
MODEL = "
%WITHIN%
s | WASOstrans ON Time;
WASOstrans* (resvar);
%BETWEEN%
WASOstrans ON dstrat2 dstrat3 dstrat4 dcond (i1 - i4);
s ON dcond (s1);
WASOstrans WITH s*;
WASOstrans* s* (vi vs);
[WASOstrans* s*] (mi ms);
",
OUTPUT = "CINTERVAL;",
PLOT = "TYPE = PLOT2;",
MODELCONSTRAINT = sprintf(
mcsetup,
mean(wasodat$dstrat2),
mean(wasodat$dstrat3),
mean(wasodat$dstrat4)),
usevariables = c("ID", "Time", "WASOstrans",
"dstrat2", "dstrat3", "dstrat4", "dcond"),
rdata = as.data.frame(wasodat)),
dataout = "02_waso.dat", run = TRUE, writeData = "always", hashfilename = FALSE)
## Wrote model to: 02_waso.inp
## Wrote data to: 02_waso.dat
## model information, coefficients, and effect sizes
wasoout <- cbind(
coef(wasofit, param = c("reg", "exp", "new")),
round(confint(wasofit, param = c("reg", "exp", "new"))[,-1], 2))[, c(1, 2, 5, 6, 4)]
with(wasoout,
data.frame(
Label = Label,
Out = sprintf("%0.2f (%0.2f, %0.2f)", round(est, 2), LowerCI, UpperCI),
pval = formatPval(pval, d = 3, sd = 3)))
## Label Out pval
## 1 B S<-DCOND 0.02 (-0.16, 0.19) .855
## 2 B WASOSTRANS<-DSTRAT2 0.28 (-1.77, 2.32) .791
## 3 B WASOSTRANS<-DSTRAT3 1.87 (0.30, 3.44) .020
## 4 B WASOSTRANS<-DSTRAT4 0.42 (-1.12, 1.96) .597
## 5 B WASOSTRANS<-DCOND -0.46 (-1.60, 0.68) .430
## 6 B WASOSTRANS<-Intercepts 4.70 (3.32, 6.07) < .001
## 7 B S<-Intercepts -0.16 (-0.28, -0.04) .012
## 8 B ITAU 5.50 (4.66, 6.34) < .001
## 9 B ICBT 5.04 (4.28, 5.80) < .001
## 10 B IDIFF -0.46 (-1.60, 0.68) .430
## 11 B STAU -0.16 (-0.28, -0.04) .012
## 12 B SCBT -0.14 (-0.27, -0.02) .025
## 13 B SDIFF 0.02 (-0.16, 0.19) .855
wasoplot <- data.table(
Condition = rep(c("TAU+", "CBT-I+Light"), each = 43),
Time = c(wasofit$results$gh5$loop_data$xvalues, wasofit$results$gh5$loop_data$xvalues),
Estimate = c(wasofit$results$gh5$loop_data$estimates[1, ], wasofit$results$gh5$loop_data$estimates[2, ]),
LL = c(wasofit$results$gh5$loop_data$lowerci[1, ], wasofit$results$gh5$loop_data$lowerci[2, ]),
UL = c(wasofit$results$gh5$loop_data$upperci[1, ], wasofit$results$gh5$loop_data$upperci[2, ]))
p.waso <- ggplot(wasoplot, aes(Time, Estimate^2, ymin = LL^2, ymax = UL^2,
colour = Condition, fill = Condition)) +
scale_y_continuous("WASO (Diary)", breaks = seq(10,60,5)) +
annotate("text", x = 2, y = 20, label = sprintf("CBT-I+Light slope %s", formatPval(subset(wasoout, Label == "B SCBT")$pval, d = 3, sd = 3, includeP = TRUE))) +
annotate("text", x = 2, y = 35, label = sprintf("TAU+ slope %s", formatPval(subset(wasoout, Label == "B STAU")$pval, d = 3, sd = 3, includeP = TRUE))) +
dailysleepStyle
print(p.waso)
wasodiffplot <- with(wasofit$results$gh5$loop_data, data.table(
Type = rep(c("Raw", "standardized"), each = 43),
Time = c(xvalues, xvalues),
Estimate = c(estimates[3, ], estimates[4, ]),
LL = c(lowerci[3, ], lowerci[4, ]),
UL = c(upperci[3, ], upperci[4, ])))
wasodiffplot[Type == "Raw"]
## Type Time Estimate LL UL
## 1: Raw 0.0000000 -0.4586557 -1.598403 0.6810911
## 2: Raw 0.1428571 -0.4563038 -1.589337 0.6767299
## 3: Raw 0.2857142 -0.4539518 -1.580795 0.6728910
## 4: Raw 0.4285713 -0.4515999 -1.572783 0.6695830
## 5: Raw 0.5714284 -0.4492479 -1.565310 0.6668140
## 6: Raw 0.7142855 -0.4468960 -1.558383 0.6645916
## 7: Raw 0.8571426 -0.4445440 -1.552010 0.6629223
## 8: Raw 0.9999998 -0.4421921 -1.546196 0.6618124
## 9: Raw 1.1428568 -0.4398401 -1.540947 0.6612670
## 10: Raw 1.2857139 -0.4374882 -1.536267 0.6612906
## 11: Raw 1.4285710 -0.4351362 -1.532159 0.6618869
## 12: Raw 1.5714282 -0.4327843 -1.528627 0.6630586
## 13: Raw 1.7142853 -0.4304323 -1.525672 0.6648076
## 14: Raw 1.8571423 -0.4280804 -1.523296 0.6671348
## 15: Raw 1.9999995 -0.4257284 -1.521497 0.6700402
## 16: Raw 2.1428566 -0.4233764 -1.520276 0.6735231
## 17: Raw 2.2857137 -0.4210245 -1.519631 0.6775815
## 18: Raw 2.4285707 -0.4186725 -1.519558 0.6822129
## 19: Raw 2.5714278 -0.4163206 -1.520055 0.6874137
## 20: Raw 2.7142849 -0.4139686 -1.521117 0.6931794
## 21: Raw 2.8571420 -0.4116167 -1.522738 0.6995049
## 22: Raw 2.9999993 -0.4092647 -1.524914 0.7063842
## 23: Raw 3.1428564 -0.4069128 -1.527636 0.7138106
## 24: Raw 3.2857134 -0.4045608 -1.530898 0.7217767
## 25: Raw 3.4285705 -0.4022089 -1.534692 0.7302744
## 26: Raw 3.5714276 -0.3998569 -1.539009 0.7392952
## 27: Raw 3.7142847 -0.3975050 -1.543840 0.7488299
## 28: Raw 3.8571417 -0.3951530 -1.549175 0.7588689
## 29: Raw 3.9999990 -0.3928010 -1.555004 0.7694023
## 30: Raw 4.1428561 -0.3904491 -1.561318 0.7804196
## 31: Raw 4.2857132 -0.3880971 -1.568105 0.7919102
## 32: Raw 4.4285703 -0.3857452 -1.575354 0.8038632
## 33: Raw 4.5714273 -0.3833932 -1.583054 0.8162675
## 34: Raw 4.7142844 -0.3810413 -1.591194 0.8291119
## 35: Raw 4.8571415 -0.3786893 -1.599764 0.8423849
## 36: Raw 4.9999986 -0.3763374 -1.608750 0.8560753
## 37: Raw 5.1428556 -0.3739854 -1.618142 0.8701715
## 38: Raw 5.2857127 -0.3716335 -1.627929 0.8846623
## 39: Raw 5.4285698 -0.3692815 -1.638099 0.8995363
## 40: Raw 5.5714269 -0.3669296 -1.648641 0.9147821
## 41: Raw 5.7142839 -0.3645776 -1.659544 0.9303889
## 42: Raw 5.8571415 -0.3622257 -1.670797 0.9463455
## 43: Raw 5.9999986 -0.3598737 -1.682389 0.9626412
## Type Time Estimate LL UL
wasodiffplot[Type == "standardized"]
## Type Time Estimate LL UL
## 1: standardized 0.0000000 -0.12558317 -0.4382071 0.1870408
## 2: standardized 0.1428571 -0.12493919 -0.4357198 0.1858415
## 3: standardized 0.2857142 -0.12429521 -0.4333753 0.1847849
## 4: standardized 0.4285713 -0.12365123 -0.4311759 0.1838735
## 5: standardized 0.5714284 -0.12300725 -0.4291239 0.1831094
## 6: standardized 0.7142855 -0.12236326 -0.4272212 0.1824947
## 7: standardized 0.8571426 -0.12171929 -0.4254697 0.1820312
## 8: standardized 0.9999998 -0.12107530 -0.4238712 0.1817206
## 9: standardized 1.1428568 -0.12043132 -0.4224270 0.1815643
## 10: standardized 1.2857139 -0.11978734 -0.4211383 0.1815636
## 11: standardized 1.4285710 -0.11914336 -0.4200062 0.1817195
## 12: standardized 1.5714282 -0.11849938 -0.4190315 0.1820327
## 13: standardized 1.7142853 -0.11785539 -0.4182146 0.1825038
## 14: standardized 1.8571423 -0.11721142 -0.4175558 0.1831330
## 15: standardized 1.9999995 -0.11656743 -0.4170552 0.1839203
## 16: standardized 2.1428566 -0.11592345 -0.4167125 0.1848656
## 17: standardized 2.2857137 -0.11527947 -0.4165273 0.1859683
## 18: standardized 2.4285707 -0.11463549 -0.4164988 0.1872278
## 19: standardized 2.5714278 -0.11399151 -0.4166260 0.1886430
## 20: standardized 2.7142849 -0.11334752 -0.4169078 0.1902128
## 21: standardized 2.8571420 -0.11270355 -0.4173429 0.1919358
## 22: standardized 2.9999993 -0.11205956 -0.4179295 0.1938103
## 23: standardized 3.1428564 -0.11141558 -0.4186658 0.1958346
## 24: standardized 3.2857134 -0.11077160 -0.4195498 0.1980066
## 25: standardized 3.4285705 -0.11012762 -0.4205794 0.2003242
## 26: standardized 3.5714276 -0.10948364 -0.4217522 0.2027850
## 27: standardized 3.7142847 -0.10883965 -0.4230658 0.2053864
## 28: standardized 3.8571417 -0.10819567 -0.4245174 0.2081260
## 29: standardized 3.9999990 -0.10755169 -0.4261044 0.2110010
## 30: standardized 4.1428561 -0.10690771 -0.4278240 0.2140086
## 31: standardized 4.2857132 -0.10626373 -0.4296732 0.2171458
## 32: standardized 4.4285703 -0.10561974 -0.4316491 0.2204096
## 33: standardized 4.5714273 -0.10497577 -0.4337487 0.2237972
## 34: standardized 4.7142844 -0.10433178 -0.4359688 0.2273053
## 35: standardized 4.8571415 -0.10368780 -0.4383065 0.2309309
## 36: standardized 4.9999986 -0.10304382 -0.4407585 0.2346709
## 37: standardized 5.1428556 -0.10239984 -0.4433218 0.2385221
## 38: standardized 5.2857127 -0.10175586 -0.4459932 0.2424815
## 39: standardized 5.4285698 -0.10111187 -0.4487697 0.2465459
## 40: standardized 5.5714269 -0.10046790 -0.4516481 0.2507123
## 41: standardized 5.7142839 -0.09982391 -0.4546255 0.2549777
## 42: standardized 5.8571415 -0.09917993 -0.4576989 0.2593390
## 43: standardized 5.9999986 -0.09853595 -0.4608653 0.2637933
## Type Time Estimate LL UL
Diary - SOL
soldat <- na.omit(ds2[, .(ID, Time, dstrat2, dstrat3, dstrat4, dcond, SOLstrans)])
solfit <- mplusModeler(mplusObject(
TITLE = "Self-Report SOL Analysis;",
VARIABLE = "
WITHIN = Time;
BETWEEN = dstrat2 dstrat3 dstrat4 dcond;
CLUSTER = ID;",
ANALYSIS = "
ESTIMATOR = ML;
TYPE = TWOLEVEL RANDOM;
PROCESSORS = 2;
STARTS = 50 5;
STITERATIONS = 200;
MITERATIONS = 10000;
MCONVERGENCE = .000001;
",
MODEL = "
%WITHIN%
s | SOLstrans ON Time;
SOLstrans* (resvar);
%BETWEEN%
SOLstrans ON dstrat2 dstrat3 dstrat4 dcond (i1 - i4);
s ON dcond (s1);
SOLstrans WITH s*;
SOLstrans* s* (vi vs);
[SOLstrans* s*] (mi ms);
",
OUTPUT = "CINTERVAL;",
PLOT = "TYPE = PLOT2;",
MODELCONSTRAINT = sprintf(
mcsetup,
mean(soldat$dstrat2),
mean(soldat$dstrat3),
mean(soldat$dstrat4)),
usevariables = c("ID", "Time", "SOLstrans",
"dstrat2", "dstrat3", "dstrat4", "dcond"),
rdata = as.data.frame(soldat)),
dataout = "02_sol.dat", run = TRUE, writeData = "always", hashfilename = FALSE)
## Wrote model to: 02_sol.inp
## Wrote data to: 02_sol.dat
## model information, coefficients, and effect sizes
## summary(solfit)
solout <- cbind(
coef(solfit, param = c("reg", "exp", "new")),
round(confint(solfit, param = c("reg", "exp", "new"))[,-1], 2))[, c(1, 2, 5, 6, 4)]
with(solout,
data.frame(
Label = Label,
Out = sprintf("%0.2f (%0.2f, %0.2f)", round(est, 2), LowerCI, UpperCI),
pval = formatPval(pval, d = 3, sd = 3)))
## Label Out pval
## 1 B S<-DCOND 0.04 (-0.10, 0.17) .594
## 2 B SOLSTRANS<-DSTRAT2 0.16 (-1.18, 1.50) .814
## 3 B SOLSTRANS<-DSTRAT3 0.59 (-0.43, 1.62) .257
## 4 B SOLSTRANS<-DSTRAT4 0.84 (-0.17, 1.86) .105
## 5 B SOLSTRANS<-DCOND -0.09 (-0.89, 0.70) .821
## 6 B SOLSTRANS<-Intercepts 3.95 (3.02, 4.87) < .001
## 7 B S<-Intercepts -0.11 (-0.20, -0.01) .026
## 8 B ITAU 4.46 (3.87, 5.05) < .001
## 9 B ICBT 4.37 (3.84, 4.90) < .001
## 10 B IDIFF -0.09 (-0.89, 0.70) .821
## 11 B STAU -0.11 (-0.20, -0.01) .026
## 12 B SCBT -0.07 (-0.16, 0.02) .135
## 13 B SDIFF 0.04 (-0.10, 0.17) .594
solplot <- data.table(
Condition = rep(c("TAU+", "CBT-I+Light"), each = 43),
Time = c(solfit$results$gh5$loop_data$xvalues, solfit$results$gh5$loop_data$xvalues),
Estimate = c(solfit$results$gh5$loop_data$estimates[1, ], solfit$results$gh5$loop_data$estimates[2, ]),
LL = c(solfit$results$gh5$loop_data$lowerci[1, ], solfit$results$gh5$loop_data$lowerci[2, ]),
UL = c(solfit$results$gh5$loop_data$upperci[1, ], solfit$results$gh5$loop_data$upperci[2, ]))
p.sol <- ggplot(solplot, aes(Time, Estimate^2, ymin = LL^2, ymax = UL^2,
colour = Condition, fill = Condition)) +
scale_y_continuous("SOL (Diary)", breaks = seq(10,30,2)) +
annotate("text", x = 2, y = 16, label = sprintf("CBT-I+Light slope %s", formatPval(subset(solout, Label == "B SCBT")$pval, d = 3, sd = 3, includeP = TRUE))) +
annotate("text", x = 2, y = 21, label = sprintf("TAU+ slope %s", formatPval(subset(solout, Label == "B STAU")$pval, d = 3, sd = 3, includeP = TRUE))) +
dailysleepStyle
print(p.sol)
soldiffplot <- with(solfit$results$gh5$loop_data, data.table(
Type = rep(c("Raw", "standardized"), each = 43),
Time = c(xvalues, xvalues),
Estimate = c(estimates[3, ], estimates[4, ]),
LL = c(lowerci[3, ], lowerci[4, ]),
UL = c(upperci[3, ], upperci[4, ])))
soldiffplot[Type == "Raw"]
## Type Time Estimate LL UL
## 1: Raw 0.0000000 -0.0917580724 -0.8873730 0.7038569
## 2: Raw 0.1428571 -0.0866391957 -0.8744766 0.7011982
## 3: Raw 0.2857142 -0.0815203190 -0.8619567 0.6989161
## 4: Raw 0.4285713 -0.0764014497 -0.8498243 0.6970214
## 5: Raw 0.5714284 -0.0712825730 -0.8380899 0.6955248
## 6: Raw 0.7142855 -0.0661636963 -0.8267639 0.6944365
## 7: Raw 0.8571426 -0.0610448271 -0.8158564 0.6937668
## 8: Raw 0.9999998 -0.0559259504 -0.8053771 0.6935252
## 9: Raw 1.1428568 -0.0508070774 -0.7953352 0.6937211
## 10: Raw 1.2857139 -0.0456882045 -0.7857395 0.6943631
## 11: Raw 1.4285710 -0.0405693315 -0.7765982 0.6954595
## 12: Raw 1.5714282 -0.0354504548 -0.7679185 0.6970176
## 13: Raw 1.7142853 -0.0303315837 -0.7597075 0.6990443
## 14: Raw 1.8571423 -0.0252127089 -0.7519710 0.7015456
## 15: Raw 1.9999995 -0.0200938359 -0.7447142 0.7045265
## 16: Raw 2.1428566 -0.0149749611 -0.7379413 0.7079914
## 17: Raw 2.2857137 -0.0098560872 -0.7316557 0.7119436
## 18: Raw 2.4285707 -0.0047372137 -0.7258598 0.7163853
## 19: Raw 2.5714278 0.0003816604 -0.7205548 0.7213181
## 20: Raw 2.7142849 0.0055005341 -0.7157412 0.7267423
## 21: Raw 2.8571420 0.0106194085 -0.7114183 0.7326572
## 22: Raw 2.9999993 0.0157382824 -0.7075847 0.7390612
## 23: Raw 3.1428564 0.0208571553 -0.7042376 0.7459519
## 24: Raw 3.2857134 0.0259760302 -0.7013734 0.7533255
## 25: Raw 3.4285705 0.0310949031 -0.6989878 0.7611776
## 26: Raw 3.5714276 0.0362137780 -0.6970753 0.7695029
## 27: Raw 3.7142847 0.0413326509 -0.6956298 0.7782952
## 28: Raw 3.8571417 0.0464515239 -0.6946445 0.7875475
## 29: Raw 3.9999990 0.0515704006 -0.6941114 0.7972522
## 30: Raw 4.1428561 0.0566892736 -0.6940225 0.8074010
## 31: Raw 4.2857132 0.0618081465 -0.6943688 0.8179851
## 32: Raw 4.4285703 0.0669270232 -0.6951410 0.8289950
## 33: Raw 4.5714273 0.0720458925 -0.6963292 0.8404210
## 34: Raw 4.7142844 0.0771647692 -0.6979234 0.8522529
## 35: Raw 4.8571415 0.0822836384 -0.6999130 0.8644803
## 36: Raw 4.9999986 0.0874025151 -0.7022875 0.8770925
## 37: Raw 5.1428556 0.0925213918 -0.7050359 0.8900787
## 38: Raw 5.2857127 0.0976402611 -0.7081473 0.9034278
## 39: Raw 5.4285698 0.1027591377 -0.7116107 0.9171289
## 40: Raw 5.5714269 0.1078780144 -0.7154151 0.9311711
## 41: Raw 5.7142839 0.1129968837 -0.7195494 0.9455432
## 42: Raw 5.8571415 0.1181157604 -0.7240030 0.9602345
## 43: Raw 5.9999986 0.1232346296 -0.7287648 0.9752341
## Type Time Estimate LL UL
soldiffplot[Type == "standardized"]
## Type Time Estimate LL UL
## 1: standardized 0.0000000 -0.0357192643 -0.3454691 0.2740305
## 2: standardized 0.1428571 -0.0337266065 -0.3404470 0.2729938
## 3: standardized 0.2857142 -0.0317339487 -0.3355715 0.2721036
## 4: standardized 0.4285713 -0.0297412928 -0.3308468 0.2713642
## 5: standardized 0.5714284 -0.0277486350 -0.3262770 0.2707797
## 6: standardized 0.7142855 -0.0257559773 -0.3218661 0.2703542
## 7: standardized 0.8571426 -0.0237633195 -0.3176181 0.2700915
## 8: standardized 0.9999998 -0.0217706617 -0.3135368 0.2699955
## 9: standardized 1.1428568 -0.0197780039 -0.3096257 0.2700697
## 10: standardized 1.2857139 -0.0177853480 -0.3058884 0.2703176
## 11: standardized 1.4285710 -0.0157926902 -0.3023278 0.2707424
## 12: standardized 1.5714282 -0.0138000315 -0.2989470 0.2713469
## 13: standardized 1.7142853 -0.0118073747 -0.2957486 0.2721338
## 14: standardized 1.8571423 -0.0098147169 -0.2927349 0.2731054
## 15: standardized 1.9999995 -0.0078220591 -0.2899079 0.2742637
## 16: standardized 2.1428566 -0.0058294013 -0.2872693 0.2756105
## 17: standardized 2.2857137 -0.0038367438 -0.2848204 0.2771469
## 18: standardized 2.4285707 -0.0018440862 -0.2825621 0.2788739
## 19: standardized 2.5714278 0.0001485714 -0.2804949 0.2807921
## 20: standardized 2.7142849 0.0021412291 -0.2786191 0.2829016
## 21: standardized 2.8571420 0.0041338867 -0.2769343 0.2852021
## 22: standardized 2.9999993 0.0061265444 -0.2754400 0.2876931
## 23: standardized 3.1428564 0.0081192022 -0.2741351 0.2903735
## 24: standardized 3.2857134 0.0101118600 -0.2730182 0.2932419
## 25: standardized 3.4285705 0.0121045168 -0.2720877 0.2962967
## 26: standardized 3.5714276 0.0140971746 -0.2713413 0.2995357
## 27: standardized 3.7142847 0.0160898324 -0.2707768 0.3029565
## 28: standardized 3.8571417 0.0180824902 -0.2703915 0.3065565
## 29: standardized 3.9999990 0.0200751480 -0.2701823 0.3103326
## 30: standardized 4.1428561 0.0220678058 -0.2701460 0.3142816
## 31: standardized 4.2857132 0.0240604635 -0.2702792 0.3184001
## 32: standardized 4.4285703 0.0260531213 -0.2705782 0.3226845
## 33: standardized 4.5714273 0.0280457772 -0.2710393 0.3271309
## 34: standardized 4.7142844 0.0300384350 -0.2716584 0.3317353
## 35: standardized 4.8571415 0.0320310928 -0.2724316 0.3364938
## 36: standardized 4.9999986 0.0340237506 -0.2733546 0.3414021
## 37: standardized 5.1428556 0.0360164084 -0.2744232 0.3464560
## 38: standardized 5.2857127 0.0380090661 -0.2756331 0.3516513
## 39: standardized 5.4285698 0.0400017239 -0.2769802 0.3569836
## 40: standardized 5.5714269 0.0419943817 -0.2784600 0.3624488
## 41: standardized 5.7142839 0.0439870395 -0.2800683 0.3680424
## 42: standardized 5.8571415 0.0459796973 -0.2818010 0.3737604
## 43: standardized 5.9999986 0.0479723550 -0.2836537 0.3795984
## Type Time Estimate LL UL
Diary - TST
tstdat <- na.omit(ds2[, .(ID, Time, dstrat2, dstrat3, dstrat4, dcond, TSTs)])
tstfit <- mplusModeler(mplusObject(
TITLE = "Self-Report TST Analysis;",
VARIABLE = "
WITHIN = Time;
BETWEEN = dstrat2 dstrat3 dstrat4 dcond;
CLUSTER = ID;",
ANALYSIS = "
ESTIMATOR = ML;
TYPE = TWOLEVEL RANDOM;
PROCESSORS = 2;
STARTS = 50 5;
STITERATIONS = 200;
MITERATIONS = 10000;
MCONVERGENCE = .000001;
",
MODEL = "
%WITHIN%
s | TSTs ON Time;
TSTs* (resvar);
%BETWEEN%
TSTs ON dstrat2 dstrat3 dstrat4 dcond (i1 - i4);
s ON dcond (s1);
TSTs WITH s*;
TSTs* s* (vi vs);
[TSTs* s*] (mi ms);
",
OUTPUT = "CINTERVAL;",
PLOT = "TYPE = PLOT2;",
MODELCONSTRAINT = sprintf(
mcsetup,
mean(tstdat$dstrat2),
mean(tstdat$dstrat3),
mean(tstdat$dstrat4)),
usevariables = c("ID", "Time", "TSTs",
"dstrat2", "dstrat3", "dstrat4", "dcond"),
rdata = as.data.frame(tstdat)),
dataout = "02_tst.dat", run = TRUE, writeData = "always", hashfilename = FALSE)
## Wrote model to: 02_tst.inp
## Wrote data to: 02_tst.dat
## model information, coefficients, and effect sizes
tstout <- cbind(
coef(tstfit, param = c("reg", "exp", "new")),
round(confint(tstfit, param = c("reg", "exp", "new"))[,-1], 2))[, c(1, 2, 5, 6, 4)]
with(tstout,
data.frame(
Label = Label,
Out = sprintf("%0.2f (%0.2f, %0.2f)", round(est, 2), LowerCI, UpperCI),
pval = formatPval(pval, d = 3, sd = 3)))
## Label Out pval
## 1 B S<-DCOND -0.07 (-0.15, 0.02) .118
## 2 B TSTS<-DSTRAT2 0.07 (-0.78, 0.93) .867
## 3 B TSTS<-DSTRAT3 -0.26 (-0.93, 0.41) .450
## 4 B TSTS<-DSTRAT4 0.06 (-0.59, 0.71) .857
## 5 B TSTS<-DCOND 0.49 (-0.00, 0.99) .051
## 6 B TSTS<-Intercepts 6.64 (6.05, 7.22) < .001
## 7 B S<-Intercepts 0.13 (0.07, 0.19) < .001
## 8 B ITAU 6.58 (6.21, 6.95) < .001
## 9 B ICBT 7.08 (6.74, 7.41) < .001
## 10 B IDIFF 0.49 (-0.00, 0.99) .051
## 11 B STAU 0.13 (0.07, 0.19) < .001
## 12 B SCBT 0.06 (0.00, 0.12) .047
## 13 B SDIFF -0.07 (-0.15, 0.02) .118
tstplot <- data.table(
Condition = rep(c("TAU+", "CBT-I+Light"), each = 43),
Time = c(tstfit$results$gh5$loop_data$xvalues, tstfit$results$gh5$loop_data$xvalues),
Estimate = c(tstfit$results$gh5$loop_data$estimates[1, ], tstfit$results$gh5$loop_data$estimates[2, ]),
LL = c(tstfit$results$gh5$loop_data$lowerci[1, ], tstfit$results$gh5$loop_data$lowerci[2, ]),
UL = c(tstfit$results$gh5$loop_data$upperci[1, ], tstfit$results$gh5$loop_data$upperci[2, ]))
p.tst <- ggplot(tstplot, aes(Time, Estimate, ymin = LL, ymax = UL,
colour = Condition, fill = Condition)) +
scale_y_continuous("TST (Diary)", breaks = seq(6,8,0.5)) +
annotate("text", x = 2, y = 7.5, label = sprintf("CBT-I+Light slope %s", formatPval(subset(tstout, Label == "B SCBT")$pval, d = 3, sd = 3, includeP = TRUE))) +
annotate("text", x = 2, y = 6.5, label = sprintf("TAU+ slope %s", formatPval(subset(tstout, Label == "B STAU")$pval, d = 3, sd = 3, includeP = TRUE))) +
dailysleepStyle
print(p.tst)
tstdiffplot <- with(tstfit$results$gh5$loop_data, data.table(
Type = rep(c("Raw", "standardized"), each = 43),
Time = c(xvalues, xvalues),
Estimate = c(estimates[3, ], estimates[4, ]),
LL = c(lowerci[3, ], lowerci[4, ]),
UL = c(upperci[3, ], upperci[4, ])))
tstdiffplot[Type == "Raw"]
## Type Time Estimate LL UL
## 1: Raw 0.0000000 0.49381885 -0.002033150 0.9896709
## 2: Raw 0.1428571 0.48420468 -0.007524122 0.9759335
## 3: Raw 0.2857142 0.47459048 -0.013278329 0.9624593
## 4: Raw 0.4285713 0.46497628 -0.019302063 0.9492546
## 5: Raw 0.5714284 0.45536211 -0.025601361 0.9363256
## 6: Raw 0.7142855 0.44574791 -0.032181956 0.9236778
## 7: Raw 0.8571426 0.43613371 -0.039049238 0.9113167
## 8: Raw 0.9999998 0.42651954 -0.046208199 0.8992473
## 9: Raw 1.1428568 0.41690534 -0.053663410 0.8874741
## 10: Raw 1.2857139 0.40729114 -0.061418965 0.8760013
## 11: Raw 1.4285710 0.39767697 -0.069478445 0.8648324
## 12: Raw 1.5714282 0.38806278 -0.077844903 0.8539705
## 13: Raw 1.7142853 0.37844858 -0.086520791 0.8434179
## 14: Raw 1.8571423 0.36883441 -0.095508002 0.8331768
## 15: Raw 1.9999995 0.35922021 -0.104807787 0.8232482
## 16: Raw 2.1428566 0.34960601 -0.114420794 0.8136328
## 17: Raw 2.2857137 0.33999184 -0.124347009 0.8043306
## 18: Raw 2.4285707 0.33037764 -0.134585813 0.7953411
## 19: Raw 2.5714278 0.32076344 -0.145135954 0.7866629
## 20: Raw 2.7142849 0.31114927 -0.155995533 0.7782941
## 21: Raw 2.8571420 0.30153507 -0.167162120 0.7702323
## 22: Raw 2.9999993 0.29192090 -0.178632662 0.7624744
## 23: Raw 3.1428564 0.28230670 -0.190403566 0.7550169
## 24: Raw 3.2857134 0.27269250 -0.202470750 0.7478558
## 25: Raw 3.4285705 0.26307833 -0.214829654 0.7409863
## 26: Raw 3.5714276 0.25346413 -0.227475286 0.7344036
## 27: Raw 3.7142847 0.24384993 -0.240402251 0.7281021
## 28: Raw 3.8571417 0.23423575 -0.253604829 0.7220764
## 29: Raw 3.9999990 0.22462156 -0.267076999 0.7163201
## 30: Raw 4.1428561 0.21500736 -0.280812413 0.7108272
## 31: Raw 4.2857132 0.20539318 -0.294804633 0.7055910
## 32: Raw 4.4285703 0.19577900 -0.309046924 0.7006049
## 33: Raw 4.5714273 0.18616480 -0.323532522 0.6958621
## 34: Raw 4.7142844 0.17655061 -0.338254482 0.6913557
## 35: Raw 4.8571415 0.16693643 -0.353205860 0.6870787
## 36: Raw 4.9999986 0.15732224 -0.368379653 0.6830241
## 37: Raw 5.1428556 0.14770804 -0.383768886 0.6791850
## 38: Raw 5.2857127 0.13809386 -0.399366617 0.6755543
## 39: Raw 5.4285698 0.12847967 -0.415165961 0.6721253
## 40: Raw 5.5714269 0.11886548 -0.431160152 0.6688911
## 41: Raw 5.7142839 0.10925129 -0.447342426 0.6658450
## 42: Raw 5.8571415 0.09963710 -0.463706225 0.6629804
## 43: Raw 5.9999986 0.09002291 -0.480245143 0.6602910
## Type Time Estimate LL UL
tstdiffplot[Type == "standardized"]
## Type Time Estimate LL UL
## 1: standardized 0.0000000 0.28715542 -0.001830861 0.5761417
## 2: standardized 0.1428571 0.28156477 -0.005007682 0.5681372
## 3: standardized 0.2857142 0.27597412 -0.008337324 0.5602856
## 4: standardized 0.4285713 0.27038348 -0.011823458 0.5525904
## 5: standardized 0.5714284 0.26479283 -0.015469611 0.5450553
## 6: standardized 0.7142855 0.25920218 -0.019279134 0.5376835
## 7: standardized 0.8571426 0.25361153 -0.023255181 0.5304782
## 8: standardized 0.9999998 0.24802089 -0.027400680 0.5234424
## 9: standardized 1.1428568 0.24243024 -0.031718310 0.5165788
## 10: standardized 1.2857139 0.23683961 -0.036210481 0.5098897
## 11: standardized 1.4285710 0.23124896 -0.040879305 0.5033772
## 12: standardized 1.5714282 0.22565831 -0.045726582 0.4970432
## 13: standardized 1.7142853 0.22006766 -0.050753783 0.4908891
## 14: standardized 1.8571423 0.21447702 -0.055962030 0.4849161
## 15: standardized 1.9999995 0.20888637 -0.061352096 0.4791248
## 16: standardized 2.1428566 0.20329572 -0.066924378 0.4735158
## 17: standardized 2.2857137 0.19770508 -0.072678924 0.4680891
## 18: standardized 2.4285707 0.19211443 -0.078615390 0.4628443
## 19: standardized 2.5714278 0.18652378 -0.084733091 0.4577807
## 20: standardized 2.7142849 0.18093313 -0.091030970 0.4528973
## 21: standardized 2.8571420 0.17534250 -0.097507626 0.4481926
## 22: standardized 2.9999993 0.16975185 -0.104161322 0.4436650
## 23: standardized 3.1428564 0.16416121 -0.110990010 0.4393124
## 24: standardized 3.2857134 0.15857056 -0.117991336 0.4351324
## 25: standardized 3.4285705 0.15297991 -0.125162676 0.4311225
## 26: standardized 3.5714276 0.14738926 -0.132501140 0.4272797
## 27: standardized 3.7142847 0.14179862 -0.140003636 0.4236009
## 28: standardized 3.8571417 0.13620797 -0.147666842 0.4200828
## 29: standardized 3.9999990 0.13061732 -0.155487254 0.4167219
## 30: standardized 4.1428561 0.12502667 -0.163461238 0.4135146
## 31: standardized 4.2857132 0.11943603 -0.171585023 0.4104571
## 32: standardized 4.4285703 0.11384539 -0.179854736 0.4075455
## 33: standardized 4.5714273 0.10825474 -0.188266411 0.4047759
## 34: standardized 4.7142844 0.10266409 -0.196816042 0.4021442
## 35: standardized 4.8571415 0.09707344 -0.205499575 0.3996465
## 36: standardized 4.9999986 0.09148280 -0.214312956 0.3972785
## 37: standardized 5.1428556 0.08589216 -0.223252133 0.3950364
## 38: standardized 5.2857127 0.08030151 -0.232313037 0.3929161
## 39: standardized 5.4285698 0.07471086 -0.241491675 0.3909134
## 40: standardized 5.5714269 0.06912021 -0.250784069 0.3890245
## 41: standardized 5.7142839 0.06352957 -0.260186374 0.3872455
## 42: standardized 5.8571415 0.05793892 -0.269694686 0.3855725
## 43: standardized 5.9999986 0.05234828 -0.279305279 0.3840018
## Type Time Estimate LL UL
Actigraphy - Sleep Efficiency
seactidat <- na.omit(ds2[, .(ID, Time, dstrat2, dstrat3, dstrat4, dcond, SEactitrans)])
seactifit <- mplusModeler(mplusObject(
TITLE = "Actigraphy SE Analysis;",
VARIABLE = "
WITHIN = Time;
BETWEEN = dstrat2 dstrat3 dstrat4 dcond;
CLUSTER = ID;",
ANALYSIS = "
ESTIMATOR = ML;
TYPE = TWOLEVEL RANDOM;
PROCESSORS = 2;
STARTS = 50 5;
STITERATIONS = 200;
MITERATIONS = 10000;
MCONVERGENCE = .000001;
",
MODEL = "
%WITHIN%
s | SEactitrans ON Time;
SEactitrans* (resvar);
%BETWEEN%
SEactitrans ON dstrat2 dstrat3 dstrat4 dcond (i1 - i4);
s ON dcond (s1);
SEactitrans WITH s*;
SEactitrans* s* (vi vs);
[SEactitrans* s*] (mi ms);
",
OUTPUT = "CINTERVAL;",
PLOT = "TYPE = PLOT2;",
MODELCONSTRAINT = sprintf(
mcsetup,
mean(seactidat$dstrat2),
mean(seactidat$dstrat3),
mean(seactidat$dstrat4)),
usevariables = c("ID", "Time", "SEactitrans",
"dstrat2", "dstrat3", "dstrat4", "dcond"),
rdata = as.data.frame(seactidat)),
dataout = "02_seacti.dat", run = TRUE, writeData = "always", hashfilename = FALSE)
## Wrote model to: 02_seacti.inp
## Wrote data to: 02_seacti.dat
## model information, coefficients, and effect sizes
seactiout <- cbind(
coef(seactifit, param = c("reg", "exp", "new")),
round(confint(seactifit, param = c("reg", "exp", "new"))[,-1], 2))[, c(1, 2, 5, 6, 4)]
with(seactiout,
data.frame(
Label = Label,
Out = sprintf("%0.2f (%0.2f, %0.2f)", round(est, 2), LowerCI, UpperCI),
pval = formatPval(pval, d = 3, sd = 3)))
## Label Out pval
## 1 B S<-DCOND 0.83 (-0.10, 1.76) .080
## 2 B SEACTITRAN<-DSTRAT2 -3.47 (-12.56, 5.62) .455
## 3 B SEACTITRAN<-DSTRAT3 -2.78 (-9.00, 3.44) .382
## 4 B SEACTITRAN<-DSTRAT4 -1.45 (-7.74, 4.84) .651
## 5 B SEACTITRAN<-DCOND 1.15 (-3.44, 5.75) .623
## 6 B SEACTITRAN<-Intercepts 46.20 (40.75, 51.65) < .001
## 7 B S<-Intercepts -0.07 (-0.71, 0.56) .817
## 8 B ITAU 44.33 (41.04, 47.63) < .001
## 9 B ICBT 45.49 (42.29, 48.69) < .001
## 10 B IDIFF 1.15 (-3.44, 5.75) .623
## 11 B STAU -0.07 (-0.71, 0.56) .817
## 12 B SCBT 0.76 (0.07, 1.44) .030
## 13 B SDIFF 0.83 (-0.10, 1.76) .080
seactiplot <- data.table(
Condition = rep(c("TAU+", "CBT-I+Light"), each = 43),
Time = c(seactifit$results$gh5$loop_data$xvalues, seactifit$results$gh5$loop_data$xvalues),
Estimate = c(seactifit$results$gh5$loop_data$estimates[1, ], seactifit$results$gh5$loop_data$estimates[2, ]),
LL = c(seactifit$results$gh5$loop_data$lowerci[1, ], seactifit$results$gh5$loop_data$lowerci[2, ]),
UL = c(seactifit$results$gh5$loop_data$upperci[1, ], seactifit$results$gh5$loop_data$upperci[2, ]))
p.seacti <- ggplot(seactiplot, aes(Time, SEback(Estimate), ymin = SEback(LL), ymax = SEback(UL),
colour = Condition, fill = Condition)) +
scale_y_continuous("SE (Acti)", breaks = 85:95) +
annotate("text", x = 2, y = 91, label = sprintf("CBT-I+Light slope %s", formatPval(subset(seactiout, Label == "B SCBT")$pval, d = 3, sd = 3, includeP = TRUE))) +
annotate("text", x = 2, y = 88, label = sprintf("TAU+ slope %s", formatPval(subset(seactiout, Label == "B STAU")$pval, d = 3, sd = 3, includeP = TRUE))) +
dailysleepStyle
print(p.seacti)
seactidiffplot <- with(seactifit$results$gh5$loop_data, data.table(
Type = rep(c("Raw", "standardized"), each = 43),
Time = c(xvalues, xvalues),
Estimate = c(estimates[3, ], estimates[4, ]),
LL = c(lowerci[3, ], lowerci[4, ]),
UL = c(upperci[3, ], upperci[4, ])))
seactidiffplot[Type == "Raw"]
## Type Time Estimate LL UL
## 1: Raw 0.0000000 1.154032 -3.4424651 5.750529
## 2: Raw 0.1428571 1.272887 -3.2956939 5.841468
## 3: Raw 0.2857142 1.391742 -3.1526587 5.936142
## 4: Raw 0.4285713 1.510597 -3.0134199 6.034614
## 5: Raw 0.5714284 1.629452 -2.8780289 6.136932
## 6: Raw 0.7142855 1.748306 -2.7465279 6.243141
## 7: Raw 0.8571426 1.867161 -2.6189501 6.353272
## 8: Raw 0.9999998 1.986016 -2.4953182 6.467350
## 9: Raw 1.1428568 2.104871 -2.3756447 6.585387
## 10: Raw 1.2857139 2.223726 -2.2599323 6.707384
## 11: Raw 1.4285710 2.342581 -2.1481721 6.833333
## 12: Raw 1.5714282 2.461435 -2.0403457 6.963216
## 13: Raw 1.7142853 2.580290 -1.9364243 7.097005
## 14: Raw 1.8571423 2.699145 -1.8363693 7.234659
## 15: Raw 1.9999995 2.818000 -1.7401327 7.376132
## 16: Raw 2.1428566 2.936855 -1.6476582 7.521368
## 17: Raw 2.2857137 3.055710 -1.5588813 7.670300
## 18: Raw 2.4285707 3.174564 -1.4737300 7.822859
## 19: Raw 2.5714278 3.293419 -1.3921262 7.978965
## 20: Raw 2.7142849 3.412274 -1.3139859 8.138534
## 21: Raw 2.8571420 3.531129 -1.2392206 8.301478
## 22: Raw 2.9999993 3.649984 -1.1677376 8.467705
## 23: Raw 3.1428564 3.768839 -1.0994411 8.637118
## 24: Raw 3.2857134 3.887693 -1.0342327 8.809620
## 25: Raw 3.4285705 4.006548 -0.9720129 8.985109
## 26: Raw 3.5714276 4.125403 -0.9126806 9.163486
## 27: Raw 3.7142847 4.244258 -0.8561349 9.344650
## 28: Raw 3.8571417 4.363113 -0.8022749 9.528501
## 29: Raw 3.9999990 4.481967 -0.7510005 9.714935
## 30: Raw 4.1428561 4.600822 -0.7022129 9.903857
## 31: Raw 4.2857132 4.719677 -0.6558148 10.095169
## 32: Raw 4.4285703 4.838532 -0.6117110 10.288775
## 33: Raw 4.5714273 4.957387 -0.5698084 10.484582
## 34: Raw 4.7142844 5.076241 -0.5300162 10.682500
## 35: Raw 4.8571415 5.195096 -0.4922466 10.882440
## 36: Raw 4.9999986 5.313951 -0.4564142 11.084317
## 37: Raw 5.1428556 5.432806 -0.4224366 11.288049
## 38: Raw 5.2857127 5.551661 -0.3902344 11.493556
## 39: Raw 5.4285698 5.670516 -0.3597310 11.700763
## 40: Raw 5.5714269 5.789371 -0.3308528 11.909595
## 41: Raw 5.7142839 5.908226 -0.3035293 12.119981
## 42: Raw 5.8571415 6.027081 -0.2776927 12.331854
## 43: Raw 5.9999986 6.145935 -0.2532781 12.545149
## Type Time Estimate LL UL
seactidiffplot[Type == "standardized"]
## Type Time Estimate LL UL
## 1: standardized 0.0000000 0.08535194 -0.25472772 0.4254316
## 2: standardized 0.1428571 0.09414241 -0.24389766 0.4321825
## 3: standardized 0.2857142 0.10293289 -0.23334627 0.4392121
## 4: standardized 0.4285713 0.11172337 -0.22307792 0.4465246
## 5: standardized 0.5714284 0.12051384 -0.21309641 0.4541241
## 6: standardized 0.7142855 0.12930432 -0.20340478 0.4620134
## 7: standardized 0.8571426 0.13809480 -0.19400543 0.4701950
## 8: standardized 0.9999998 0.14688526 -0.18489994 0.4786705
## 9: standardized 1.1428568 0.15567574 -0.17608915 0.4874406
## 10: standardized 1.2857139 0.16446622 -0.16757314 0.4965056
## 11: standardized 1.4285710 0.17325670 -0.15935114 0.5058645
## 12: standardized 1.5714282 0.18204716 -0.15142168 0.5155160
## 13: standardized 1.7142853 0.19083764 -0.14378248 0.5254577
## 14: standardized 1.8571423 0.19962811 -0.13643058 0.5356868
## 15: standardized 1.9999995 0.20841859 -0.12936229 0.5461994
## 16: standardized 2.1428566 0.21720907 -0.12257329 0.5569914
## 17: standardized 2.2857137 0.22599953 -0.11605870 0.5680578
## 18: standardized 2.4285707 0.23479001 -0.10981308 0.5793931
## 19: standardized 2.5714278 0.24358049 -0.10383050 0.5909915
## 20: standardized 2.7142849 0.25237095 -0.09810466 0.6028466
## 21: standardized 2.8571420 0.26116145 -0.09262887 0.6149517
## 22: standardized 2.9999993 0.26995191 -0.08739619 0.6273000
## 23: standardized 3.1428564 0.27874240 -0.08239942 0.6398842
## 24: standardized 3.2857134 0.28753287 -0.07763121 0.6526970
## 25: standardized 3.4285705 0.29632333 -0.07308411 0.6657308
## 26: standardized 3.5714276 0.30511382 -0.06875057 0.6789782
## 27: standardized 3.7142847 0.31390429 -0.06462305 0.6924316
## 28: standardized 3.8571417 0.32269475 -0.06069405 0.7060836
## 29: standardized 3.9999990 0.33148524 -0.05695609 0.7199266
## 30: standardized 4.1428561 0.34027570 -0.05340184 0.7339532
## 31: standardized 4.2857132 0.34906620 -0.05002405 0.7481564
## 32: standardized 4.4285703 0.35785666 -0.04681566 0.7625290
## 33: standardized 4.5714273 0.36664712 -0.04376973 0.7770640
## 34: standardized 4.7142844 0.37543762 -0.04087956 0.7917548
## 35: standardized 4.8571415 0.38422808 -0.03813861 0.8065948
## 36: standardized 4.9999986 0.39301857 -0.03554056 0.8215777
## 37: standardized 5.1428556 0.40180904 -0.03307931 0.8366974
## 38: standardized 5.2857127 0.41059950 -0.03074898 0.8519480
## 39: standardized 5.4285698 0.41938999 -0.02854389 0.8673239
## 40: standardized 5.5714269 0.42818046 -0.02645862 0.8828195
## 41: standardized 5.7142839 0.43697092 -0.02448792 0.8984298
## 42: standardized 5.8571415 0.44576141 -0.02262681 0.9141496
## 43: standardized 5.9999986 0.45455188 -0.02087048 0.9299743
## Type Time Estimate LL UL
Actigraphy - WASO
wasoactidat <- na.omit(ds2[, .(ID, Time, dstrat2, dstrat3, dstrat4, dcond, WASOactitrans)])
wasoactifit <- mplusModeler(mplusObject(
TITLE = "Actigraphy WASO Analysis;",
VARIABLE = "
WITHIN = Time;
BETWEEN = dstrat2 dstrat3 dstrat4 dcond;
CLUSTER = ID;",
ANALYSIS = "
ESTIMATOR = ML;
TYPE = TWOLEVEL RANDOM;
PROCESSORS = 2;
STARTS = 50 5;
STITERATIONS = 200;
MITERATIONS = 10000;
MCONVERGENCE = .000001;
",
MODEL = "
%WITHIN%
s | WASOactitrans ON Time;
WASOactitrans* (resvar);
%BETWEEN%
WASOactitrans ON dstrat2 dstrat3 dstrat4 dcond (i1 - i4);
s ON dcond (s1);
WASOactitrans WITH s*;
WASOactitrans* s* (vi vs);
[WASOactitrans* s*] (mi ms);
",
OUTPUT = "CINTERVAL;",
PLOT = "TYPE = PLOT2;",
MODELCONSTRAINT = sprintf(
mcsetup,
mean(wasoactidat$dstrat2),
mean(wasoactidat$dstrat3),
mean(wasoactidat$dstrat4)),
usevariables = c("ID", "Time", "WASOactitrans",
"dstrat2", "dstrat3", "dstrat4", "dcond"),
rdata = as.data.frame(wasoactidat)),
dataout = "02_wasoacti.dat", run = TRUE, writeData = "always", hashfilename = FALSE)
## Wrote model to: 02_wasoacti.inp
## Wrote data to: 02_wasoacti.dat
## model information, coefficients, and effect sizes
wasoactiout <- cbind(
coef(wasoactifit, param = c("reg", "exp", "new")),
round(confint(wasoactifit, param = c("reg", "exp", "new"))[,-1], 2))[, c(1, 2, 5, 6, 4)]
with(wasoactiout,
data.frame(
Label = Label,
Out = sprintf("%0.2f (%0.2f, %0.2f)", round(est, 2), LowerCI, UpperCI),
pval = formatPval(pval, d = 3, sd = 3)))
## Label Out pval
## 1 B S<-DCOND -0.14 (-0.28, 0.00) .058
## 2 B WASOACTITR<-DSTRAT2 0.86 (-0.57, 2.28) .238
## 3 B WASOACTITR<-DSTRAT3 0.58 (-0.41, 1.57) .252
## 4 B WASOACTITR<-DSTRAT4 0.34 (-0.64, 1.32) .497
## 5 B WASOACTITR<-DCOND -0.05 (-0.78, 0.68) .896
## 6 B WASOACTITR<-Intercepts 6.69 (5.83, 7.55) < .001
## 7 B S<-Intercepts 0.04 (-0.06, 0.14) .426
## 8 B ITAU 7.10 (6.58, 7.63) < .001
## 9 B ICBT 7.05 (6.54, 7.56) < .001
## 10 B IDIFF -0.05 (-0.78, 0.68) .896
## 11 B STAU 0.04 (-0.06, 0.14) .426
## 12 B SCBT -0.10 (-0.20, 0.01) .067
## 13 B SDIFF -0.14 (-0.28, 0.00) .058
wasoactiplot <- data.table(
Condition = rep(c("TAU+", "CBT-I+Light"), each = 43),
Time = c(wasoactifit$results$gh5$loop_data$xvalues, wasoactifit$results$gh5$loop_data$xvalues),
Estimate = c(wasoactifit$results$gh5$loop_data$estimates[1, ], wasoactifit$results$gh5$loop_data$estimates[2, ]),
LL = c(wasoactifit$results$gh5$loop_data$lowerci[1, ], wasoactifit$results$gh5$loop_data$lowerci[2, ]),
UL = c(wasoactifit$results$gh5$loop_data$upperci[1, ], wasoactifit$results$gh5$loop_data$upperci[2, ]))
p.wasoacti<-ggplot(wasoactiplot, aes(Time, Estimate^2, ymin = LL^2, ymax = UL^2,
colour = Condition, fill = Condition)) +
scale_y_continuous("WASO (Acti)", breaks = seq(10,60,5)) +
annotate("text", x = 2, y = 42, label = sprintf("CBT-I+Light slope %s", formatPval(subset(wasoactiout, Label == "B SCBT")$pval, d = 3, sd = 3, includeP = TRUE))) +
annotate("text", x = 2, y = 56, label = sprintf("TAU+ slope %s", formatPval(subset(wasoactiout, Label == "B STAU")$pval, d = 3, sd = 3, includeP = TRUE))) +
dailysleepStyle
print(p.wasoacti)
wasoactidiffplot <- with(wasoactifit$results$gh5$loop_data, data.table(
Type = rep(c("Raw", "standardized"), each = 43),
Time = c(xvalues, xvalues),
Estimate = c(estimates[3, ], estimates[4, ]),
LL = c(lowerci[3, ], lowerci[4, ]),
UL = c(upperci[3, ], upperci[4, ])))
wasoactidiffplot[Type == "Raw"]
## Type Time Estimate LL UL
## 1: Raw 0.0000000 -0.04896117 -0.7805454 0.68262309
## 2: Raw 0.1428571 -0.06872622 -0.7953514 0.65789902
## 3: Raw 0.2857142 -0.08849127 -0.8107027 0.63372016
## 4: Raw 0.4285713 -0.10825632 -0.8266092 0.61009657
## 5: Raw 0.5714284 -0.12802137 -0.8430800 0.58703727
## 6: Raw 0.7142855 -0.14778642 -0.8601228 0.56454998
## 7: Raw 0.8571426 -0.16755147 -0.8777443 0.54264140
## 8: Raw 0.9999998 -0.18731652 -0.8959497 0.52131671
## 9: Raw 1.1428568 -0.20708157 -0.9147429 0.50057977
## 10: Raw 1.2857139 -0.22684662 -0.9341263 0.48043302
## 11: Raw 1.4285710 -0.24661167 -0.9541008 0.46087742
## 12: Raw 1.5714282 -0.26637673 -0.9746659 0.44191247
## 13: Raw 1.7142853 -0.28614178 -0.9958197 0.42353612
## 14: Raw 1.8571423 -0.30590683 -1.0175586 0.40574494
## 15: Raw 1.9999995 -0.32567188 -1.0398779 0.38853410
## 16: Raw 2.1428566 -0.34543693 -1.0627712 0.37189740
## 17: Raw 2.2857137 -0.36520198 -1.0862312 0.35582733
## 18: Raw 2.4285707 -0.38496703 -1.1102493 0.34031525
## 19: Raw 2.5714278 -0.40473208 -1.1348156 0.32535145
## 20: Raw 2.7142849 -0.42449713 -1.1599194 0.31092513
## 21: Raw 2.8571420 -0.44426218 -1.1855490 0.29702470
## 22: Raw 2.9999993 -0.46402723 -1.2116922 0.28363776
## 23: Raw 3.1428564 -0.48379228 -1.2383360 0.27075136
## 24: Raw 3.2857134 -0.50355732 -1.2654666 0.25835189
## 25: Raw 3.4285705 -0.52332240 -1.2930701 0.24642536
## 26: Raw 3.5714276 -0.54308742 -1.3211324 0.23495750
## 27: Raw 3.7142847 -0.56285250 -1.3496388 0.22393382
## 28: Raw 3.8571417 -0.58261752 -1.3785747 0.21333963
## 29: Raw 3.9999990 -0.60238260 -1.4079255 0.20316032
## 30: Raw 4.1428561 -0.62214762 -1.4376764 0.19338121
## 31: Raw 4.2857132 -0.64191270 -1.4678131 0.18398783
## 32: Raw 4.4285703 -0.66167772 -1.4983213 0.17496578
## 33: Raw 4.5714273 -0.68144280 -1.5291866 0.16630100
## 34: Raw 4.7142844 -0.70120782 -1.5603952 0.15797962
## 35: Raw 4.8571415 -0.72097290 -1.5919338 0.14998809
## 36: Raw 4.9999986 -0.74073792 -1.6237891 0.14231323
## 37: Raw 5.1428556 -0.76050299 -1.6559482 0.13494222
## 38: Raw 5.2857127 -0.78026801 -1.6883987 0.12786260
## 39: Raw 5.4285698 -0.80003309 -1.7211285 0.12106235
## 40: Raw 5.5714269 -0.81979811 -1.7541261 0.11452983
## 41: Raw 5.7142839 -0.83956319 -1.7873802 0.10825383
## 42: Raw 5.8571415 -0.85932821 -1.8208801 0.10222355
## 43: Raw 5.9999986 -0.87909329 -1.8546152 0.09642862
## Type Time Estimate LL UL
wasoactidiffplot[Type == "standardized"]
## Type Time Estimate LL UL
## 1: standardized 0.0000000 -0.02159541 -0.3442978 0.30110696
## 2: standardized 0.1428571 -0.03031322 -0.3508398 0.29021338
## 3: standardized 0.2857142 -0.03903103 -0.3576241 0.27956206
## 4: standardized 0.4285713 -0.04774884 -0.3646551 0.26915738
## 5: standardized 0.5714284 -0.05646665 -0.3719366 0.25900334
## 6: standardized 0.7142855 -0.06518447 -0.3794723 0.24910340
## 7: standardized 0.8571426 -0.07390228 -0.3872649 0.23946038
## 8: standardized 0.9999998 -0.08262009 -0.3953168 0.23007660
## 9: standardized 1.1428568 -0.09133790 -0.4036295 0.22095369
## 10: standardized 1.2857139 -0.10005571 -0.4122041 0.21209270
## 11: standardized 1.4285710 -0.10877352 -0.4210410 0.20349395
## 12: standardized 1.5714282 -0.11749133 -0.4301398 0.19515717
## 13: standardized 1.7142853 -0.12620915 -0.4394997 0.18708138
## 14: standardized 1.8571423 -0.13492696 -0.4491189 0.17926502
## 15: standardized 1.9999995 -0.14364478 -0.4589954 0.17170583
## 16: standardized 2.1428566 -0.15236259 -0.4691262 0.16440099
## 17: standardized 2.2857137 -0.16108039 -0.4795079 0.15734713
## 18: standardized 2.4285707 -0.16979821 -0.4901367 0.15054032
## 19: standardized 2.5714278 -0.17851602 -0.5010082 0.14397620
## 20: standardized 2.7142849 -0.18723384 -0.5121176 0.13764991
## 21: standardized 2.8571420 -0.19595164 -0.5234596 0.13155626
## 22: standardized 2.9999993 -0.20466946 -0.5350286 0.12568969
## 23: standardized 3.1428564 -0.21338727 -0.5468189 0.12004439
## 24: standardized 3.2857134 -0.22210509 -0.5588245 0.11461429
## 25: standardized 3.4285705 -0.23082289 -0.5710390 0.10939316
## 26: standardized 3.5714276 -0.23954071 -0.5834560 0.10437463
## 27: standardized 3.7142847 -0.24825852 -0.5960693 0.09955223
## 28: standardized 3.8571417 -0.25697634 -0.6088721 0.09491944
## 29: standardized 3.9999990 -0.26569414 -0.6218580 0.09046975
## 30: standardized 4.1428561 -0.27441195 -0.6350206 0.08619664
## 31: standardized 4.2857132 -0.28312975 -0.6483532 0.08209368
## 32: standardized 4.4285703 -0.29184759 -0.6618497 0.07815450
## 33: standardized 4.5714273 -0.30056539 -0.6755036 0.07437284
## 34: standardized 4.7142844 -0.30928320 -0.6893089 0.07074254
## 35: standardized 4.8571415 -0.31800100 -0.7032596 0.06725764
## 36: standardized 4.9999986 -0.32671884 -0.7173499 0.06391227
## 37: standardized 5.1428556 -0.33543664 -0.7315741 0.06070076
## 38: standardized 5.2857127 -0.34415445 -0.7459265 0.05761760
## 39: standardized 5.4285698 -0.35287225 -0.7604020 0.05465748
## 40: standardized 5.5714269 -0.36159009 -0.7749954 0.05181526
## 41: standardized 5.7142839 -0.37030789 -0.7897018 0.04908597
## 42: standardized 5.8571415 -0.37902570 -0.8045163 0.04646485
## 43: standardized 5.9999986 -0.38774350 -0.8194343 0.04394731
## Type Time Estimate LL UL
Actigraphy - SOL
solactidat <- na.omit(ds2[, .(ID, Time, dstrat2, dstrat3, dstrat4, dcond, SOLactitrans)])
solactifit <- mplusModeler(mplusObject(
TITLE = "Actigraphy SOL Analysis;",
VARIABLE = "
WITHIN = Time;
BETWEEN = dstrat2 dstrat3 dstrat4 dcond;
CLUSTER = ID;",
ANALYSIS = "
ESTIMATOR = ML;
TYPE = TWOLEVEL RANDOM;
PROCESSORS = 2;
STARTS = 50 5;
STITERATIONS = 200;
MITERATIONS = 10000;
MCONVERGENCE = .000001;
",
MODEL = "
%WITHIN%
s | SOLactitrans ON Time;
SOLactitrans* (resvar);
%BETWEEN%
SOLactitrans ON dstrat2 dstrat3 dstrat4 dcond (i1 - i4);
s ON dcond (s1);
SOLactitrans WITH s*;
SOLactitrans* s* (vi vs);
[SOLactitrans* s*] (mi ms);
",
OUTPUT = "CINTERVAL;",
PLOT = "TYPE = PLOT2;",
MODELCONSTRAINT = sprintf(
mcsetup,
mean(solactidat$dstrat2),
mean(solactidat$dstrat3),
mean(solactidat$dstrat4)),
usevariables = c("ID", "Time", "SOLactitrans",
"dstrat2", "dstrat3", "dstrat4", "dcond"),
rdata = as.data.frame(solactidat)),
dataout = "02_solacti.dat", run = TRUE, writeData = "always", hashfilename = FALSE)
## Wrote model to: 02_solacti.inp
## Wrote data to: 02_solacti.dat
## model information, coefficients, and effect sizes
solactiout <- cbind(
coef(solactifit, param = c("reg", "exp", "new")),
round(confint(solactifit, param = c("reg", "exp", "new"))[,-1], 2))[, c(1, 2, 5, 6, 4)]
with(solactiout,
data.frame(
Label = Label,
Out = sprintf("%0.2f (%0.2f, %0.2f)", round(est, 2), LowerCI, UpperCI),
pval = formatPval(pval, d = 3, sd = 3)))
## Label Out pval
## 1 B S<-DCOND -0.04 (-0.12, 0.03) .271
## 2 B SOLACTITRA<-DSTRAT2 -0.62 (-1.21, -0.04) .038
## 3 B SOLACTITRA<-DSTRAT3 0.12 (-0.30, 0.53) .579
## 4 B SOLACTITRA<-DSTRAT4 0.16 (-0.25, 0.58) .441
## 5 B SOLACTITRA<-DCOND -0.01 (-0.35, 0.34) .969
## 6 B SOLACTITRA<-Intercepts 1.35 (0.97, 1.73) < .001
## 7 B S<-Intercepts 0.00 (-0.05, 0.05) .988
## 8 B ITAU 1.39 (1.14, 1.63) < .001
## 9 B ICBT 1.38 (1.14, 1.62) < .001
## 10 B IDIFF -0.01 (-0.35, 0.34) .969
## 11 B STAU 0.00 (-0.05, 0.05) .988
## 12 B SCBT -0.04 (-0.10, 0.01) .139
## 13 B SDIFF -0.04 (-0.12, 0.03) .271
solactiplot <- data.table(
Condition = rep(c("TAU+", "CBT-I+Light"), each = 43),
Time = c(solactifit$results$gh5$loop_data$xvalues, solactifit$results$gh5$loop_data$xvalues),
Estimate = c(solactifit$results$gh5$loop_data$estimates[1, ], solactifit$results$gh5$loop_data$estimates[2, ]),
LL = c(solactifit$results$gh5$loop_data$lowerci[1, ], solactifit$results$gh5$loop_data$lowerci[2, ]),
UL = c(solactifit$results$gh5$loop_data$upperci[1, ], solactifit$results$gh5$loop_data$upperci[2, ]))
p.solacti <- ggplot(solactiplot, aes(Time, Estimate^2, ymin = LL^2, ymax = UL^2,
colour = Condition, fill = Condition)) +
scale_y_continuous("SOL (Acti)", breaks = seq(0,10,0.5)) +
annotate("text", x = 2, y = 1.4, label = sprintf("CBT-I+Light slope %s", formatPval(subset(solactiout, Label == "B SCBT")$pval, d = 3, sd = 3, includeP = TRUE))) +
annotate("text", x = 2, y = 2.1, label = sprintf("TAU+ slope %s", formatPval(subset(solactiout, Label == "B STAU")$pval, d = 3, sd = 3, includeP = TRUE))) +
dailysleepStyle
print(p.solacti)
solactidiffplot <- with(solactifit$results$gh5$loop_data, data.table(
Type = rep(c("Raw", "standardized"), each = 43),
Time = c(xvalues, xvalues),
Estimate = c(estimates[3, ], estimates[4, ]),
LL = c(lowerci[3, ], lowerci[4, ]),
UL = c(upperci[3, ], upperci[4, ])))
solactidiffplot[Type == "Raw"]
## Type Time Estimate LL UL
## 1: Raw 0.0000000 -0.006827544 -0.3494283 0.3357732
## 2: Raw 0.1428571 -0.012929919 -0.3501855 0.3243256
## 3: Raw 0.2857142 -0.019032294 -0.3512125 0.3131479
## 4: Raw 0.4285713 -0.025134670 -0.3525219 0.3022525
## 5: Raw 0.5714284 -0.031237043 -0.3541263 0.2916522
## 6: Raw 0.7142855 -0.037339419 -0.3560382 0.2813593
## 7: Raw 0.8571426 -0.043441795 -0.3582698 0.2713862
## 8: Raw 0.9999998 -0.049544170 -0.3608332 0.2617448
## 9: Raw 1.1428568 -0.055646542 -0.3637396 0.2524465
## 10: Raw 1.2857139 -0.061748918 -0.3670000 0.2435021
## 11: Raw 1.4285710 -0.067851290 -0.3706242 0.2349216
## 12: Raw 1.5714282 -0.073953666 -0.3746212 0.2267139
## 13: Raw 1.7142853 -0.080056041 -0.3789990 0.2188870
## 14: Raw 1.8571423 -0.086158417 -0.3837642 0.2114474
## 15: Raw 1.9999995 -0.092260793 -0.3889219 0.2044004
## 16: Raw 2.1428566 -0.098363169 -0.3944761 0.1977497
## 17: Raw 2.2857137 -0.104465544 -0.4004287 0.1914976
## 18: Raw 2.4285707 -0.110567920 -0.4067805 0.1856447
## 19: Raw 2.5714278 -0.116670296 -0.4135305 0.1801899
## 20: Raw 2.7142849 -0.122772664 -0.4206760 0.1751307
## 21: Raw 2.8571420 -0.128875047 -0.4282130 0.1704629
## 22: Raw 2.9999993 -0.134977415 -0.4361357 0.1661809
## 23: Raw 3.1428564 -0.141079798 -0.4444374 0.1622778
## 24: Raw 3.2857134 -0.147182167 -0.4531097 0.1587454
## 25: Raw 3.4285705 -0.153284535 -0.4621435 0.1555745
## 26: Raw 3.5714276 -0.159386918 -0.4715286 0.1527548
## 27: Raw 3.7142847 -0.165489286 -0.4812540 0.1502755
## 28: Raw 3.8571417 -0.171591669 -0.4913082 0.1481249
## 29: Raw 3.9999990 -0.177694038 -0.5016791 0.1462910
## 30: Raw 4.1428561 -0.183796421 -0.5123543 0.1447615
## 31: Raw 4.2857132 -0.189898789 -0.5233214 0.1435238
## 32: Raw 4.4285703 -0.196001172 -0.5345678 0.1425654
## 33: Raw 4.5714273 -0.202103540 -0.5460809 0.1418738
## 34: Raw 4.7142844 -0.208205909 -0.5578483 0.1414365
## 35: Raw 4.8571415 -0.214308292 -0.5698580 0.1412414
## 36: Raw 4.9999986 -0.220410660 -0.5820980 0.1412767
## 37: Raw 5.1428556 -0.226513043 -0.5945568 0.1415307
## 38: Raw 5.2857127 -0.232615411 -0.6072233 0.1419924
## 39: Raw 5.4285698 -0.238717794 -0.6200867 0.1426511
## 40: Raw 5.5714269 -0.244820163 -0.6331368 0.1434965
## 41: Raw 5.7142839 -0.250922531 -0.6463637 0.1445186
## 42: Raw 5.8571415 -0.257024914 -0.6597581 0.1457082
## 43: Raw 5.9999986 -0.263127297 -0.6733109 0.1470564
## Type Time Estimate LL UL
solactidiffplot[Type == "standardized"]
## Type Time Estimate LL UL
## 1: standardized 0.0000000 -0.005074088 -0.2596910 0.2495428
## 2: standardized 0.1428571 -0.009609245 -0.2602572 0.2410387
## 3: standardized 0.2857142 -0.014144401 -0.2610245 0.2327357
## 4: standardized 0.4285713 -0.018679557 -0.2620023 0.2246431
## 5: standardized 0.5714284 -0.023214715 -0.2631999 0.2167704
## 6: standardized 0.7142855 -0.027749872 -0.2646266 0.2091269
## 7: standardized 0.8571426 -0.032285027 -0.2662916 0.2017215
## 8: standardized 0.9999998 -0.036820184 -0.2682037 0.1945633
## 9: standardized 1.1428568 -0.041355342 -0.2703715 0.1876608
## 10: standardized 1.2857139 -0.045890499 -0.2728028 0.1810218
## 11: standardized 1.4285710 -0.050425656 -0.2755052 0.1746539
## 12: standardized 1.5714282 -0.054960813 -0.2784852 0.1685636
## 13: standardized 1.7142853 -0.059495971 -0.2817487 0.1627568
## 14: standardized 1.8571423 -0.064031124 -0.2853007 0.1572384
## 15: standardized 1.9999995 -0.068566285 -0.2891449 0.1520123
## 16: standardized 2.1428566 -0.073101439 -0.2932841 0.1470812
## 17: standardized 2.2857137 -0.077636600 -0.2977198 0.1424467
## 18: standardized 2.4285707 -0.082171753 -0.3024526 0.1381091
## 19: standardized 2.5714278 -0.086706907 -0.3074816 0.1340678
## 20: standardized 2.7142849 -0.091242068 -0.3128048 0.1303206
## 21: standardized 2.8571420 -0.095777221 -0.3184190 0.1268646
## 22: standardized 2.9999993 -0.100312382 -0.3243202 0.1236955
## 23: standardized 3.1428564 -0.104847535 -0.3305030 0.1208080
## 24: standardized 3.2857134 -0.109382696 -0.3369614 0.1181961
## 25: standardized 3.4285705 -0.113917850 -0.3436885 0.1158528
## 26: standardized 3.5714276 -0.118453011 -0.3506766 0.1137705
## 27: standardized 3.7142847 -0.122988164 -0.3579175 0.1119412
## 28: standardized 3.8571417 -0.127523318 -0.3654026 0.1103560
## 29: standardized 3.9999990 -0.132058471 -0.3731230 0.1090061
## 30: standardized 4.1428561 -0.136593640 -0.3810695 0.1078823
## 31: standardized 4.2857132 -0.141128793 -0.3892328 0.1069752
## 32: standardized 4.4285703 -0.145663947 -0.3976033 0.1062754
## 33: standardized 4.5714273 -0.150199100 -0.4061720 0.1057738
## 34: standardized 4.7142844 -0.154734269 -0.4149295 0.1054610
## 35: standardized 4.8571415 -0.159269422 -0.4238668 0.1053280
## 36: standardized 4.9999986 -0.163804576 -0.4329751 0.1053659
## 37: standardized 5.1428556 -0.168339729 -0.4422458 0.1055663
## 38: standardized 5.2857127 -0.172874883 -0.4516706 0.1059209
## 39: standardized 5.4285698 -0.177410051 -0.4612417 0.1064216
## 40: standardized 5.5714269 -0.181945205 -0.4709512 0.1070608
## 41: standardized 5.7142839 -0.186480358 -0.4807920 0.1078313
## 42: standardized 5.8571415 -0.191015512 -0.4907571 0.1087260
## 43: standardized 5.9999986 -0.195550680 -0.5008398 0.1097384
## Type Time Estimate LL UL
Actigraphy - TST
tstactidat <- na.omit(ds2[, .(ID, Time, dstrat2, dstrat3, dstrat4, dcond, TSTacti)])
tstactifit <- mplusModeler(mplusObject(
TITLE = "Actigraphy TST Analysis;",
VARIABLE = "
WITHIN = Time;
BETWEEN = dstrat2 dstrat3 dstrat4 dcond;
CLUSTER = ID;",
ANALYSIS = "
ESTIMATOR = ML;
TYPE = TWOLEVEL RANDOM;
PROCESSORS = 2;
STARTS = 50 5;
STITERATIONS = 200;
MITERATIONS = 10000;
MCONVERGENCE = .000001;
",
MODEL = "
%WITHIN%
s | TSTacti ON Time;
TSTacti* (resvar);
%BETWEEN%
TSTacti ON dstrat2 dstrat3 dstrat4 dcond (i1 - i4);
s ON dcond (s1);
TSTacti WITH s*;
TSTacti* s* (vi vs);
[TSTacti* s*] (mi ms);
",
OUTPUT = "CINTERVAL;",
PLOT = "TYPE = PLOT2;",
MODELCONSTRAINT = sprintf(
mcsetup,
mean(tstactidat$dstrat2),
mean(tstactidat$dstrat3),
mean(tstactidat$dstrat4)),
usevariables = c("ID", "Time", "TSTacti",
"dstrat2", "dstrat3", "dstrat4", "dcond"),
rdata = as.data.frame(tstactidat)),
dataout = "02_tstacti.dat", run = TRUE, writeData = "always", hashfilename = FALSE)
## Wrote model to: 02_tstacti.inp
## Wrote data to: 02_tstacti.dat
## model information, coefficients, and effect sizes
tstactiout <- cbind(
coef(tstactifit, param = c("reg", "exp", "new")),
round(confint(tstactifit, param = c("reg", "exp", "new"))[,-1], 2))[, c(1, 2, 5, 6, 4)]
with(tstactiout,
data.frame(
Label = Label,
Out = sprintf("%0.2f (%0.2f, %0.2f)", round(est, 2), LowerCI, UpperCI),
pval = formatPval(pval, d = 3, sd = 3)))
## Label Out pval
## 1 B S<-DCOND -0.04 (-0.13, 0.05) .385
## 2 B TSTACTI<-DSTRAT2 0.24 (-0.62, 1.09) .589
## 3 B TSTACTI<-DSTRAT3 0.22 (-0.36, 0.80) .455
## 4 B TSTACTI<-DSTRAT4 0.50 (-0.07, 1.07) .087
## 5 B TSTACTI<-DCOND 0.33 (-0.13, 0.79) .158
## 6 B TSTACTI<-Intercepts 6.67 (6.14, 7.19) < .001
## 7 B S<-Intercepts 0.01 (-0.05, 0.07) .706
## 8 B ITAU 6.95 (6.62, 7.28) < .001
## 9 B ICBT 7.28 (6.96, 7.60) < .001
## 10 B IDIFF 0.33 (-0.13, 0.79) .158
## 11 B STAU 0.01 (-0.05, 0.07) .706
## 12 B SCBT -0.03 (-0.09, 0.04) .405
## 13 B SDIFF -0.04 (-0.13, 0.05) .385
tstactiplot <- data.table(
Condition = rep(c("TAU+", "CBT-I+Light"), each = 43),
Time = c(tstactifit$results$gh5$loop_data$xvalues, tstactifit$results$gh5$loop_data$xvalues),
Estimate = c(tstactifit$results$gh5$loop_data$estimates[1, ], tstactifit$results$gh5$loop_data$estimates[2, ]),
LL = c(tstactifit$results$gh5$loop_data$lowerci[1, ], tstactifit$results$gh5$loop_data$lowerci[2, ]),
UL = c(tstactifit$results$gh5$loop_data$upperci[1, ], tstactifit$results$gh5$loop_data$upperci[2, ]))
p.tstacti <- ggplot(tstactiplot, aes(Time, Estimate, ymin = LL, ymax = UL,
colour = Condition, fill = Condition)) +
scale_y_continuous("TST (Acti)", breaks = seq(6.6,8,0.2)) +
annotate("text", x = 2, y = 7.4, label = sprintf("CBT-I+Light slope %s", formatPval(subset(tstactiout, Label == "B SCBT")$pval, d = 3, sd = 3, includeP = TRUE))) +
annotate("text", x = 2, y = 6.8, label = sprintf("TAU+ slope %s", formatPval(subset(tstactiout, Label == "B STAU")$pval, d = 3, sd = 3, includeP = TRUE))) +
dailysleepStyle
print(p.tstacti)
tstactidiffplot <- with(tstactifit$results$gh5$loop_data, data.table(
Type = rep(c("Raw", "standardized"), each = 43),
Time = c(xvalues, xvalues),
Estimate = c(estimates[3, ], estimates[4, ]),
LL = c(lowerci[3, ], lowerci[4, ]),
UL = c(upperci[3, ], upperci[4, ])))
tstactidiffplot[Type == "Raw"]
## Type Time Estimate LL UL
## 1: Raw 0.0000000 0.33147380 -0.1290494 0.7919970
## 2: Raw 0.1428571 0.32586765 -0.1285938 0.7803291
## 3: Raw 0.2857142 0.32026154 -0.1284134 0.7689365
## 4: Raw 0.4285713 0.31465539 -0.1285190 0.7578298
## 5: Raw 0.5714284 0.30904928 -0.1289213 0.7470199
## 6: Raw 0.7142855 0.30344313 -0.1296311 0.7365174
## 7: Raw 0.8571426 0.29783702 -0.1306588 0.7263328
## 8: Raw 0.9999998 0.29223087 -0.1320149 0.7164766
## 9: Raw 1.1428568 0.28662476 -0.1337091 0.7069586
## 10: Raw 1.2857139 0.28101861 -0.1357511 0.6977884
## 11: Raw 1.4285710 0.27541250 -0.1381498 0.6889748
## 12: Raw 1.5714282 0.26980636 -0.1409137 0.6805264
## 13: Raw 1.7142853 0.26420024 -0.1440503 0.6724507
## 14: Raw 1.8571423 0.25859410 -0.1475663 0.6647546
## 15: Raw 1.9999995 0.25298798 -0.1514679 0.6574438
## 16: Raw 2.1428566 0.24738184 -0.1557597 0.6505234
## 17: Raw 2.2857137 0.24177571 -0.1604456 0.6439970
## 18: Raw 2.4285707 0.23616958 -0.1655284 0.6378675
## 19: Raw 2.5714278 0.23056345 -0.1710095 0.6321364
## 20: Raw 2.7142849 0.22495732 -0.1768894 0.6268041
## 21: Raw 2.8571420 0.21935119 -0.1831673 0.6218697
## 22: Raw 2.9999993 0.21374506 -0.1898411 0.6173312
## 23: Raw 3.1428564 0.20813893 -0.1969077 0.6131856
## 24: Raw 3.2857134 0.20253280 -0.2043630 0.6094286
## 25: Raw 3.4285705 0.19692667 -0.2122015 0.6060549
## 26: Raw 3.5714276 0.19132054 -0.2204172 0.6030583
## 27: Raw 3.7142847 0.18571441 -0.2290028 0.6004316
## 28: Raw 3.8571417 0.18010828 -0.2379505 0.5981671
## 29: Raw 3.9999990 0.17450215 -0.2472517 0.5962560
## 30: Raw 4.1428561 0.16889602 -0.2568971 0.5946891
## 31: Raw 4.2857132 0.16328989 -0.2668770 0.5934568
## 32: Raw 4.4285703 0.15768376 -0.2771814 0.5925490
## 33: Raw 4.5714273 0.15207763 -0.2877999 0.5919552
## 34: Raw 4.7142844 0.14647150 -0.2987219 0.5916649
## 35: Raw 4.8571415 0.14086537 -0.3099366 0.5916673
## 36: Raw 4.9999986 0.13525924 -0.3214332 0.5919517
## 37: Raw 5.1428556 0.12965311 -0.3332010 0.5925072
## 38: Raw 5.2857127 0.12404698 -0.3452292 0.5933232
## 39: Raw 5.4285698 0.11844084 -0.3575075 0.5943891
## 40: Raw 5.5714269 0.11283471 -0.3700253 0.5956947
## 41: Raw 5.7142839 0.10722858 -0.3827726 0.5972297
## 42: Raw 5.8571415 0.10162245 -0.3957394 0.5989843
## 43: Raw 5.9999986 0.09601633 -0.4089162 0.6009488
## Type Time Estimate LL UL
tstactidiffplot[Type == "standardized"]
## Type Time Estimate LL UL
## 1: standardized 0.0000000 0.23649727 -0.09238436 0.5653789
## 2: standardized 0.1428571 0.23249745 -0.09205899 0.5570539
## 3: standardized 0.2857142 0.22849764 -0.09192974 0.5489250
## 4: standardized 0.4285713 0.22449782 -0.09200426 0.5409999
## 5: standardized 0.5714284 0.22049801 -0.09229024 0.5332863
## 6: standardized 0.7142855 0.21649818 -0.09279530 0.5257917
## 7: standardized 0.8571426 0.21249837 -0.09352694 0.5185237
## 8: standardized 0.9999998 0.20849855 -0.09449248 0.5114896
## 9: standardized 1.1428568 0.20449874 -0.09569903 0.5046965
## 10: standardized 1.2857139 0.20049892 -0.09715337 0.4981512
## 11: standardized 1.4285710 0.19649911 -0.09886191 0.4918601
## 12: standardized 1.5714282 0.19249928 -0.10083060 0.4858292
## 13: standardized 1.7142853 0.18849947 -0.10306487 0.4800638
## 14: standardized 1.8571423 0.18449965 -0.10556959 0.4745689
## 15: standardized 1.9999995 0.18049984 -0.10834894 0.4693486
## 16: standardized 2.1428566 0.17650002 -0.11140643 0.4644065
## 17: standardized 2.2857137 0.17250021 -0.11474478 0.4597452
## 18: standardized 2.4285707 0.16850038 -0.11836595 0.4553667
## 19: standardized 2.5714278 0.16450056 -0.12227105 0.4512722
## 20: standardized 2.7142849 0.16050075 -0.12646036 0.4474619
## 21: standardized 2.8571420 0.15650094 -0.13093331 0.4439352
## 22: standardized 2.9999993 0.15250112 -0.13568854 0.4406908
## 23: standardized 3.1428564 0.14850131 -0.14072379 0.4377264
## 24: standardized 3.2857134 0.14450148 -0.14603610 0.4350391
## 25: standardized 3.4285705 0.14050166 -0.15162171 0.4326251
## 26: standardized 3.5714276 0.13650185 -0.15747623 0.4304799
## 27: standardized 3.7142847 0.13250203 -0.16359457 0.4285986
## 28: standardized 3.8571417 0.12850222 -0.16997115 0.4269756
## 29: standardized 3.9999990 0.12450240 -0.17659982 0.4256046
## 30: standardized 4.1428561 0.12050258 -0.18347406 0.4244792
## 31: standardized 4.2857132 0.11650276 -0.19058697 0.4235925
## 32: standardized 4.4285703 0.11250295 -0.19793136 0.4229372
## 33: standardized 4.5714273 0.10850313 -0.20549986 0.4225061
## 34: standardized 4.7142844 0.10450331 -0.21328488 0.4222915
## 35: standardized 4.8571415 0.10050350 -0.22127882 0.4222858
## 36: standardized 4.9999986 0.09650368 -0.22947396 0.4224813
## 37: standardized 5.1428556 0.09250386 -0.23786268 0.4228704
## 38: standardized 5.2857127 0.08850405 -0.24643734 0.4234454
## 39: standardized 5.4285698 0.08450423 -0.25519043 0.4241989
## 40: standardized 5.5714269 0.08050441 -0.26411459 0.4251234
## 41: standardized 5.7142839 0.07650460 -0.27320254 0.4262117
## 42: standardized 5.8571415 0.07250478 -0.28244731 0.4274569
## 43: standardized 5.9999986 0.06850496 -0.29184198 0.4288519
## Type Time Estimate LL UL
Final Panel Plot
p.all <- ggarrange(
p.ses, p.seacti, p.sol, p.solacti, p.waso, p.wasoacti, p.tst, p.tstacti,
labels = c("A", "B", "C", "D", "E", "F", "G", "H"),
ncol=2, nrow=4,
legend = "bottom",
common.legend = TRUE)
print(p.all)
pdf(file = "figure4.pdf", width = 11, height = 12)
print(p.all)
dev.off()
## png
## 2
p.allgrey <- ggarrange(
p.ses + color_palette("grey")+ fill_palette("grey"),
p.seacti + color_palette("grey")+ fill_palette("grey"),
p.sol+ color_palette("grey")+ fill_palette("grey"),
p.solacti+ color_palette("grey")+ fill_palette("grey"),
p.waso+ color_palette("grey")+ fill_palette("grey"),
p.wasoacti+ color_palette("grey")+ fill_palette("grey"),
p.tst+ color_palette("grey")+ fill_palette("grey"),
p.tstacti+ color_palette("grey")+ fill_palette("grey"),
labels = c("A", "B", "C", "D", "E", "F", "G", "H"),
ncol=2, nrow=4,
legend = "bottom",
common.legend = TRUE)
## Scale for 'colour' is already present. Adding another scale for 'colour',
## which will replace the existing scale.
## Scale for 'fill' is already present. Adding another scale for 'fill', which
## will replace the existing scale.
## Scale for 'colour' is already present. Adding another scale for 'colour',
## which will replace the existing scale.
## Scale for 'fill' is already present. Adding another scale for 'fill', which
## will replace the existing scale.
## Scale for 'colour' is already present. Adding another scale for 'colour',
## which will replace the existing scale.
## Scale for 'fill' is already present. Adding another scale for 'fill', which
## will replace the existing scale.
## Scale for 'colour' is already present. Adding another scale for 'colour',
## which will replace the existing scale.
## Scale for 'fill' is already present. Adding another scale for 'fill', which
## will replace the existing scale.
## Scale for 'colour' is already present. Adding another scale for 'colour',
## which will replace the existing scale.
## Scale for 'fill' is already present. Adding another scale for 'fill', which
## will replace the existing scale.
## Scale for 'colour' is already present. Adding another scale for 'colour',
## which will replace the existing scale.
## Scale for 'fill' is already present. Adding another scale for 'fill', which
## will replace the existing scale.
## Scale for 'colour' is already present. Adding another scale for 'colour',
## which will replace the existing scale.
## Scale for 'fill' is already present. Adding another scale for 'fill', which
## will replace the existing scale.
## Scale for 'colour' is already present. Adding another scale for 'colour',
## which will replace the existing scale.
## Scale for 'fill' is already present. Adding another scale for 'fill', which
## will replace the existing scale.
tiff(file = "figure4_greyscale.tif", width = 11, height = 12, units = "in", res = 300, compression = "lzw+p")
print(p.allgrey)
dev.off()
## png
## 2
Supplementary Analyses
## does DEXA differ between conditions?
xtabs(~ USEDEXA + condition, data = ds2)
## condition
## USEDEXA Relaxation CBT+
## 0 1226 1322
## 1 126 176
round(prop.table(xtabs(~ USEDEXA + condition, data = ds2), 2)*100, 1)
## condition
## USEDEXA Relaxation CBT+
## 0 90.7 88.3
## 1 9.3 11.7
summary(lme4::glmer(USEDEXA ~ condition + (1 | ID),
data = ds2, family = binomial(), nAGQ = 100))
## Generalized linear mixed model fit by maximum likelihood (Adaptive
## Gauss-Hermite Quadrature, nAGQ = 100) [glmerMod]
## Family: binomial ( logit )
## Formula: USEDEXA ~ condition + (1 | ID)
## Data: ds2
##
## AIC BIC logLik deviance df.resid
## 1622.0 1639.9 -808.0 1616.0 2847
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.6309 -0.3487 -0.2671 -0.1163 5.4404
##
## Random effects:
## Groups Name Variance Std.Dev.
## ID (Intercept) 2.179 1.476
## Number of obs: 2850, groups: ID, 76
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -3.0819 0.3120 -9.877 <2e-16 ***
## conditionCBT+ 0.5063 0.3973 1.274 0.203
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## conditnCBT+ -0.738
## does sleep differ on dexa days?
summary(lmerTest::lmer(SEstrans ~ USEDEXA + (1 | ID), data = ds2))
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: SEstrans ~ USEDEXA + (1 | ID)
## Data: ds2
##
## REML criterion at convergence: 20611
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.4871 -0.5897 0.0674 0.5985 4.5027
##
## Random effects:
## Groups Name Variance Std.Dev.
## ID (Intercept) 168.1 12.96
## Residual 274.4 16.57
## Number of obs: 2414, groups: ID, 73
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 51.318 1.581 70.714 32.46 <2e-16 ***
## USEDEXA -12.931 1.239 2379.219 -10.43 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## USEDEXA -0.082
summary(lmerTest::lmer(SOLstrans ~ USEDEXA + (1 | ID), data = ds2))
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: SOLstrans ~ USEDEXA + (1 | ID)
## Data: ds2
##
## REML criterion at convergence: 11022.9
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.6067 -0.5382 -0.1259 0.3444 5.8877
##
## Random effects:
## Groups Name Variance Std.Dev.
## ID (Intercept) 2.498 1.580
## Residual 4.184 2.045
## Number of obs: 2531, groups: ID, 74
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 4.0789 0.1918 68.7307 21.262 < 2e-16 ***
## USEDEXA 0.8925 0.1486 2499.1784 6.006 2.18e-09 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## USEDEXA -0.084
summary(lmerTest::lmer(WASOstrans ~ USEDEXA + (1 | ID), data = ds2))
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: WASOstrans ~ USEDEXA + (1 | ID)
## Data: ds2
##
## REML criterion at convergence: 12561.9
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.5768 -0.5748 -0.0637 0.4769 4.5850
##
## Random effects:
## Groups Name Variance Std.Dev.
## ID (Intercept) 5.816 2.412
## Residual 8.144 2.854
## Number of obs: 2499, groups: ID, 75
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 4.6439 0.2898 70.6261 16.027 <2e-16 ***
## USEDEXA 1.8148 0.2081 2456.8733 8.719 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## USEDEXA -0.076
summary(lmerTest::lmer(TSTs ~ USEDEXA + (1 | ID), data = ds2))
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: TSTs ~ USEDEXA + (1 | ID)
## Data: ds2
##
## REML criterion at convergence: 8732.4
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -4.2729 -0.5284 0.0319 0.5862 4.6195
##
## Random effects:
## Groups Name Variance Std.Dev.
## ID (Intercept) 0.8977 0.9475
## Residual 2.0107 1.4180
## Number of obs: 2414, groups: ID, 73
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 7.2382 0.1170 69.1644 61.87 <2e-16 ***
## USEDEXA -1.2644 0.1059 2388.2684 -11.94 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## USEDEXA -0.094
summary(lmerTest::lmer(SEactitrans ~ USEDEXA + (1 | ID), data = ds2))
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: SEactitrans ~ USEDEXA + (1 | ID)
## Data: ds2
##
## REML criterion at convergence: 14700.1
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -4.4163 -0.5726 -0.0275 0.4691 5.4092
##
## Random effects:
## Groups Name Variance Std.Dev.
## ID (Intercept) 78.14 8.839
## Residual 124.49 11.157
## Number of obs: 1897, groups: ID, 58
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 46.0359 1.2080 58.8095 38.111 <2e-16 ***
## USEDEXA -2.2660 0.9531 1887.9430 -2.377 0.0175 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## USEDEXA -0.096
summary(lmerTest::lmer(SOLactitrans ~ USEDEXA + (1 | ID), data = ds2))
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: SOLactitrans ~ USEDEXA + (1 | ID)
## Data: ds2
##
## REML criterion at convergence: 6368.9
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.2516 -0.7316 -0.2052 0.6000 4.1764
##
## Random effects:
## Groups Name Variance Std.Dev.
## ID (Intercept) 0.3246 0.5698
## Residual 1.5804 1.2571
## Number of obs: 1897, groups: ID, 58
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 1.325e+00 8.286e-02 5.966e+01 15.989 <2e-16 ***
## USEDEXA 5.757e-02 1.057e-01 1.872e+03 0.545 0.586
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## USEDEXA -0.151
summary(lmerTest::lmer(WASOactitrans ~ USEDEXA + (1 | ID), data = ds2))
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: WASOactitrans ~ USEDEXA + (1 | ID)
## Data: ds2
##
## REML criterion at convergence: 8033.7
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -4.0478 -0.5435 0.0079 0.5677 5.0797
##
## Random effects:
## Groups Name Variance Std.Dev.
## ID (Intercept) 1.940 1.393
## Residual 3.712 1.927
## Number of obs: 1897, groups: ID, 58
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 6.999e+00 1.916e-01 5.911e+01 36.521 <2e-16 ***
## USEDEXA 6.213e-02 1.643e-01 1.892e+03 0.378 0.705
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## USEDEXA -0.104
summary(lmerTest::lmer(TSTacti ~ USEDEXA + (1 | ID), data = ds2))
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: TSTacti ~ USEDEXA + (1 | ID)
## Data: ds2
##
## REML criterion at convergence: 6135.5
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -4.3239 -0.5698 0.0176 0.6175 3.7041
##
## Random effects:
## Groups Name Variance Std.Dev.
## ID (Intercept) 0.6112 0.7818
## Residual 1.3690 1.1700
## Number of obs: 1897, groups: ID, 58
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 7.1711 0.1083 57.3038 66.203 < 2e-16 ***
## USEDEXA -0.5650 0.0996 1894.0174 -5.673 1.62e-08 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## USEDEXA -0.111
## do number of weekdays vs weekends differ between conditions?
xtabs(~ WKND + condition, data = ds2)
## condition
## WKND Relaxation CBT+
## 0 980 1075
## 1 386 428
round(prop.table(xtabs(~ WKND + condition, data = ds2), 2)*100, 1)
## condition
## WKND Relaxation CBT+
## 0 71.7 71.5
## 1 28.3 28.5
summary(lme4::glmer(WKND ~ condition + (1 | ID),
data = ds2, family = binomial(), nAGQ = 100))
## boundary (singular) fit: see ?isSingular
## Generalized linear mixed model fit by maximum likelihood (Adaptive
## Gauss-Hermite Quadrature, nAGQ = 100) [glmerMod]
## Family: binomial ( logit )
## Formula: WKND ~ condition + (1 | ID)
## Data: ds2
##
## AIC BIC logLik deviance df.resid
## 3428.3 3446.2 -1711.2 3422.3 2866
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -0.6310 -0.6310 -0.6276 1.5848 1.5934
##
## Random effects:
## Groups Name Variance Std.Dev.
## ID (Intercept) 0 0
## Number of obs: 2869, groups: ID, 76
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -0.93172 0.06009 -15.51 <2e-16 ***
## conditionCBT+ 0.01076 0.08293 0.13 0.897
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## conditnCBT+ -0.725
## optimizer (Nelder_Mead) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
## does sleep differ on weekdays vs weekends?
summary(lmerTest::lmer(SEstrans ~ WKND + (1 | ID), data = ds2))
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: SEstrans ~ WKND + (1 | ID)
## Data: ds2
##
## REML criterion at convergence: 20702.4
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.9079 -0.5912 0.0828 0.6177 4.2418
##
## Random effects:
## Groups Name Variance Std.Dev.
## ID (Intercept) 173.8 13.19
## Residual 284.9 16.88
## Number of obs: 2414, groups: ID, 73
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 49.1251 1.6168 73.1189 30.384 < 2e-16 ***
## WKND 3.0608 0.7642 2343.3850 4.005 6.38e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## WKND -0.131
summary(lmerTest::lmer(SOLstrans ~ WKND + (1 | ID), data = ds2))
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: SOLstrans ~ WKND + (1 | ID)
## Data: ds2
##
## REML criterion at convergence: 11054.9
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.4120 -0.5142 -0.1421 0.3333 5.8187
##
## Random effects:
## Groups Name Variance Std.Dev.
## ID (Intercept) 2.460 1.569
## Residual 4.238 2.059
## Number of obs: 2531, groups: ID, 74
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 4.22970 0.19154 70.69384 22.083 <2e-16 ***
## WKND -0.19949 0.09085 2455.69781 -2.196 0.0282 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## WKND -0.131
summary(lmerTest::lmer(WASOstrans ~ WKND + (1 | ID), data = ds2))
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: WASOstrans ~ WKND + (1 | ID)
## Data: ds2
##
## REML criterion at convergence: 12629.9
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.3832 -0.5948 -0.0995 0.4677 4.4803
##
## Random effects:
## Groups Name Variance Std.Dev.
## ID (Intercept) 6.11 2.472
## Residual 8.36 2.891
## Number of obs: 2499, groups: ID, 75
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 4.9373 0.2981 71.8861 16.57 < 2e-16 ***
## WKND -0.3620 0.1284 2423.3800 -2.82 0.00484 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## WKND -0.120
summary(lmerTest::lmer(TSTs ~ WKND + (1 | ID), data = ds2))
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: TSTs ~ WKND + (1 | ID)
## Data: ds2
##
## REML criterion at convergence: 8836.2
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -5.0153 -0.4785 0.0658 0.5840 4.6499
##
## Random effects:
## Groups Name Variance Std.Dev.
## ID (Intercept) 0.9653 0.9825
## Residual 2.0964 1.4479
## Number of obs: 2414, groups: ID, 73
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 6.998e+00 1.220e-01 7.265e+01 57.351 < 2e-16 ***
## WKND 3.931e-01 6.554e-02 2.343e+03 5.998 2.31e-09 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## WKND -0.149
summary(lmerTest::lmer(SEactitrans ~ WKND + (1 | ID), data = ds2))
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: SEactitrans ~ WKND + (1 | ID)
## Data: ds2
##
## REML criterion at convergence: 14855.6
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -4.3924 -0.5609 -0.0270 0.4563 5.4496
##
## Random effects:
## Groups Name Variance Std.Dev.
## ID (Intercept) 79.35 8.908
## Residual 124.99 11.180
## Number of obs: 1916, groups: ID, 58
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 45.7090 1.2224 60.0260 37.39 <2e-16 ***
## WKND 0.2657 0.5648 1862.3342 0.47 0.638
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## WKND -0.138
summary(lmerTest::lmer(SOLactitrans ~ WKND + (1 | ID), data = ds2))
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: SOLactitrans ~ WKND + (1 | ID)
## Data: ds2
##
## REML criterion at convergence: 6436.6
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.2736 -0.7567 -0.2084 0.5980 4.1768
##
## Random effects:
## Groups Name Variance Std.Dev.
## ID (Intercept) 0.3219 0.5673
## Residual 1.5837 1.2584
## Number of obs: 1916, groups: ID, 58
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 1.320e+00 8.368e-02 6.341e+01 15.770 <2e-16 ***
## WKND 4.436e-02 6.353e-02 1.865e+03 0.698 0.485
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## WKND -0.224
summary(lmerTest::lmer(WASOactitrans ~ WKND + (1 | ID), data = ds2))
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: WASOactitrans ~ WKND + (1 | ID)
## Data: ds2
##
## REML criterion at convergence: 8115.7
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -4.1144 -0.5380 -0.0004 0.5592 5.0794
##
## Random effects:
## Groups Name Variance Std.Dev.
## ID (Intercept) 1.947 1.395
## Residual 3.714 1.927
## Number of obs: 1916, groups: ID, 58
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 6.996e+00 1.930e-01 6.059e+01 36.242 <2e-16 ***
## WKND 1.789e-02 9.735e-02 1.863e+03 0.184 0.854
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## WKND -0.151
summary(lmerTest::lmer(TSTacti ~ WKND + (1 | ID), data = ds2))
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: TSTacti ~ WKND + (1 | ID)
## Data: ds2
##
## REML criterion at convergence: 6211.9
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -4.3935 -0.5606 0.0288 0.6021 3.8016
##
## Random effects:
## Groups Name Variance Std.Dev.
## ID (Intercept) 0.6038 0.7771
## Residual 1.3804 1.1749
## Number of obs: 1916, groups: ID, 58
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 7.053e+00 1.085e-01 5.956e+01 65.027 < 2e-16 ***
## WKND 1.590e-01 5.935e-02 1.862e+03 2.679 0.00746 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## WKND -0.163
Session Info for Documentation
sessionInfo()
## R version 4.1.0 (2021-05-18)
## Platform: x86_64-w64-mingw32/x64 (64-bit)
## Running under: Windows 10 x64 (build 19043)
##
## Matrix products: default
##
## locale:
## [1] LC_COLLATE=English_United States.1252
## [2] LC_CTYPE=English_United States.1252
## [3] LC_MONETARY=English_United States.1252
## [4] LC_NUMERIC=C
## [5] LC_TIME=English_United States.1252
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] MplusAutomation_0.8 rhdf5_2.36.0 data.table_1.14.0
## [4] reshape2_1.4.4 JWileymisc_1.2.1 ggpubr_0.4.0
## [7] ggplot2_3.3.3 rmarkdown_2.8 knitr_1.33
##
## loaded via a namespace (and not attached):
## [1] TH.data_1.0-10 VGAM_1.1-5 minqa_1.2.4
## [4] colorspace_2.0-1 ggsignif_0.6.1 ellipsis_0.3.2
## [7] rio_0.5.26 estimability_1.3 htmlTable_2.2.1
## [10] base64enc_0.1-3 rstudioapi_0.13 mice_3.13.0
## [13] farver_2.1.0 lavaan_0.6-8 MatrixModels_0.5-0
## [16] fansi_0.5.0 mvtnorm_1.1-1 codetools_0.2-18
## [19] splines_4.1.0 mnormt_2.0.2 robustbase_0.93-7
## [22] texreg_1.37.5 Formula_1.2-4 jsonlite_1.7.2
## [25] nloptr_1.2.2.2 broom_0.7.6 cluster_2.1.2
## [28] png_0.1-7 httr_1.4.2 compiler_4.1.0
## [31] emmeans_1.6.0 backports_1.2.1 assertthat_0.2.1
## [34] Matrix_1.3-3 htmltools_0.5.1.1 quantreg_5.85
## [37] tools_4.1.0 lmerTest_3.1-3 coda_0.19-4
## [40] gtable_0.3.0 glue_1.4.2 dplyr_1.0.6
## [43] ggthemes_4.2.4 Rcpp_1.0.6 carData_3.0-4
## [46] cellranger_1.1.0 jquerylib_0.1.4 rhdf5filters_1.4.0
## [49] vctrs_0.3.8 nlme_3.1-152 conquer_1.0.2
## [52] psych_2.1.3 xfun_0.23 stringr_1.4.0
## [55] proto_1.0.0 openxlsx_4.2.3 lme4_1.1-27
## [58] lifecycle_1.0.0 extraoperators_0.1.1 rstatix_0.7.0
## [61] polspline_1.1.19 DEoptimR_1.0-9 MASS_7.3-54
## [64] zoo_1.8-9 scales_1.1.1 hms_1.1.0
## [67] parallel_4.1.0 sandwich_3.0-1 SparseM_1.81
## [70] RColorBrewer_1.1-2 yaml_2.2.1 curl_4.3.1
## [73] gridExtra_2.3 pander_0.6.3 sass_0.4.0
## [76] rms_6.2-0 rpart_4.1-15 latticeExtra_0.6-29
## [79] stringi_1.6.2 highr_0.9 checkmate_2.0.0
## [82] boot_1.3-28 zip_2.1.1 rlang_0.4.11
## [85] pkgconfig_2.0.3 matrixStats_0.58.0 evaluate_0.14
## [88] lattice_0.20-44 Rhdf5lib_1.14.0 purrr_0.3.4
## [91] labeling_0.4.2 htmlwidgets_1.5.3 cowplot_1.1.1
## [94] tidyselect_1.1.1 ggsci_2.9 plyr_1.8.6
## [97] magrittr_2.0.1 R6_2.5.0 generics_0.1.0
## [100] multcompView_0.1-8 Hmisc_4.5-0 multcomp_1.4-17
## [103] DBI_1.1.1 gsubfn_0.7 pillar_1.6.1
## [106] haven_2.4.1 foreign_0.8-81 withr_2.4.2
## [109] mgcv_1.8-35 survival_3.2-11 abind_1.4-5
## [112] nnet_7.3-16 tibble_3.1.2 crayon_1.4.1
## [115] car_3.0-10 utf8_1.2.1 tmvnsim_1.0-2
## [118] jpeg_0.1-8.1 grid_4.1.0 readxl_1.3.1
## [121] pbivnorm_0.6.0 forcats_0.5.1 digest_0.6.27
## [124] xtable_1.8-4 numDeriv_2016.8-1.1 tidyr_1.1.3
## [127] stats4_4.1.0 munsell_0.5.0 bslib_0.2.5.1