Initialization

rm(list=ls())
library(relativeVariability)
library(rsurveyutils)
library(here)
library(tidyverse)
library(corrplot)
# library(ggthemr)
# theme_set(theme_bw())
# ggthemr("fresh")

library(lmerTest)
library(sjPlot)

# library(aTSA)
library(tidylog)

Preprocessing

Read data

filepath <- here("data/ESM_W2_WITH_MISSING_V1_no exclusions.csv")
df_raw <- read_csv(filepath) 
## Warning: One or more parsing issues, call `problems()` on your data frame for details,
## e.g.:
##   dat <- vroom(...)
##   problems(dat)

Process data

df_emos <- df_raw %>% 
  select(ID, timeStampSent, matches("panas.*scale.*beep"), -matches("new")) %>% 
  # TODO: what is panas scale new
  rename(
    panas_neg = PANAS_negativescale_beep,
    panas_pos = PANAS_positivescale_beep
  )

df_er <- df_raw %>% 
  select(ID, timeStampSent, matches("Emotionregulation_[a-z]+$"),
         -Emotionregulation_selfcompassion1,
         -Emotionregulation_selfcompassion2,
         -Emotionregulation_selfcompassion,
         -Emotionregulation_engagement) %>% 
  rename_all(~str_replace(., "Emotionregulation_", "er_"))

df_indiff <- df_raw %>% 
  select(ID, Sex, Birth_year, Birth_month, Ethnicity, 
         matches("SCARED.*scale"), matches("SMFQ.*scale"),
         # matches("panas"),
         -matches("omit")) %>% 
  rename_all(~str_remove(., "_scale_w2")) %>% 
  distinct() %>%
  left_join(
    df_emos %>% 
      filter(!is.na(panas_neg) & !is.na(panas_pos)) %>% 
      group_by(ID) %>% 
      summarize(
        panas_neg = mean(panas_neg, na.rm=T),
        panas_pos = mean(panas_pos, na.rm=T),
        n_beeps = n()
      )
  ) %>% 
  mutate_at(vars(SCARED, SMFQ, panas_neg, panas_pos), list(z=scale)) 
# confirm 1 row per person
df_indiff %>% 
  count(ID) %>% 
  arrange(desc(n))
## # A tibble: 265 × 2
##    ID        n
##    <chr> <int>
##  1 10015     1
##  2 10016     1
##  3 10017     1
##  4 10018     1
##  5 10020     1
##  6 10021     1
##  7 10022     1
##  8 10026     1
##  9 10027     1
## 10 10028     1
## # ℹ 255 more rows
df_indiff_2 <- df_raw %>% 
  select(ID, Sex, Birth_year, Birth_month, Ethnicity, 
         matches("SCARED.*scale"), matches("SMFQ.*scale"),
         # matches("panas"),
         -matches("omit")) %>% 
  rename_all(~str_remove(., "_scale_w2")) %>% 
  distinct() %>%
  left_join(
    df_emos # %>% 
      # filter(!is.na(panas_neg) & !is.na(panas_pos)) %>% 
  ) %>% 
  mutate_at(vars(SCARED, SMFQ, panas_neg, panas_pos), list(z=scale)) 

Calculate Metrics

Mean ER

df_mean_er_strat <- df_er %>% 
  pivot_longer(cols=starts_with("er_"), 
               names_to="strat", 
               values_to="rating") %>% 
  drop_na(rating) %>% 
  group_by(ID, strat) %>%
  summarize(
    mean_er = mean(rating)
  ) %>%
  ungroup

Relative Within SD

d <- df_er %>% 
  pivot_longer(cols=starts_with("er_"), 
               names_to="strat", 
               values_to="rating") %>% 
  drop_na(rating)

d %>% 
  group_by(ID, strat) %>% 
  summarize(
    n = n()
  ) %>%
  # arrange(desc(n))
  arrange(n)
## # A tibble: 1,325 × 3
## # Groups:   ID [265]
##    ID    strat                n
##    <chr> <chr>            <int>
##  1 1029  er_distraction       1
##  2 1029  er_reappraisal       1
##  3 1029  er_rumination        1
##  4 1029  er_socialsupport     1
##  5 1029  er_suppresion        1
##  6 8048  er_distraction       1
##  7 8048  er_reappraisal       1
##  8 8048  er_rumination        1
##  9 8048  er_socialsupport     1
## 10 8048  er_suppresion        1
## # ℹ 1,315 more rows
df_rwsd <- d %>% 
  group_by(ID, strat) %>% 
  mutate(n = n()) %>% 
  filter(n > 1) %>% 
  filter(mean(rating) < 7) %>%
  filter(mean(rating) > 1) %>%
  summarize(
    rwsd = relativeSD(rating, 1, 7),
    n = n()
  ) %>% 
  summarize(
    rwsd = mean(rwsd),
    n = mean(n)
  ) %>% 
  ungroup

hist(df_rwsd$rwsd)

# rwsd for each ER strat
df_rwsd_st <- d %>% 
  group_by(ID, strat) %>% 
  mutate(n = n()) %>% 
  filter(n > 1) %>% 
  filter(mean(rating) < 7) %>%
  filter(mean(rating) > 1) %>%
  summarize(
    rwsd = relativeSD(rating, 1, 7),
    n = n()
  )

Relative Between SD

d <- df_er %>% 
  pivot_longer(cols=starts_with("er_"), 
               names_to="strat", 
               values_to="rating") %>% 
  drop_na(rating)

d %>% 
  group_by(ID, timeStampSent) %>% 
  summarize(
    n = n()
  ) %>%
  # arrange(desc(n))
  arrange(n)
## # A tibble: 12,590 × 3
## # Groups:   ID [265]
##    ID    timeStampSent     n
##    <chr>         <dbl> <int>
##  1 7034     1652955304     2
##  2 11187    1653992106     3
##  3 11143    1653768014     4
##  4 11143    1653940813     4
##  5 11143    1654027212     4
##  6 11143    1654157103     4
##  7 11143    1654449309     4
##  8 11170    1653768014     4
##  9 2026     1650967206     4
## 10 2026     1651782618     4
## # ℹ 12,580 more rows
df_rbsd <- d %>% 
  group_by(ID, timeStampSent) %>% 
  mutate(n = n()) %>% 
  filter(n > 1) %>% 
  filter(mean(rating) > 1) %>%
  filter(mean(rating) < 7) %>%
  summarize(
    rbsd = relativeSD(rating, 1, 7),
    n = n()
  ) %>% 
  summarize(
    rbsd = mean(rbsd),
    n = mean(n)
  )

hist(df_rbsd$rbsd)

# rbsd across moments
df_rbsd_st <- d %>% 
  group_by(ID, timeStampSent) %>% 
  mutate(n = n()) %>% 
  filter(n > 1) %>% 
  filter(mean(rating) > 1) %>%
  filter(mean(rating) < 7) %>%
  summarize(
    rbsd = relativeSD(rating, 1, 7),
    n = n()
  )

Successive Difference

d <- df_er %>% 
  pivot_longer(cols=starts_with("er_"), 
               names_to="strat", 
               values_to="rating") %>% 
  drop_na(rating)

d %>% 
  group_by(ID, strat) %>% 
  summarize(
    n = n()
  ) %>%
  # arrange(desc(n))
  arrange(n)
## # A tibble: 1,325 × 3
## # Groups:   ID [265]
##    ID    strat                n
##    <chr> <chr>            <int>
##  1 1029  er_distraction       1
##  2 1029  er_reappraisal       1
##  3 1029  er_rumination        1
##  4 1029  er_socialsupport     1
##  5 1029  er_suppresion        1
##  6 8048  er_distraction       1
##  7 8048  er_reappraisal       1
##  8 8048  er_rumination        1
##  9 8048  er_socialsupport     1
## 10 8048  er_suppresion        1
## # ℹ 1,315 more rows
df_rwrmssd <- d %>% 
  group_by(ID, strat) %>% 
  mutate(n = n()) %>% 
  filter(n > 1) %>% 
  filter(mean(rating) < 7) %>%
  filter(mean(rating) > 1) %>%
  summarize(
    rwrmssd = relativeRMSSD(rating, 1, 7),
    n = n()
  ) %>% 
  summarize(
    rwrmssd = mean(rwrmssd),
    n = mean(n)
  ) %>% 
  ungroup

hist(df_rwrmssd$rwrmssd)

# rwrmssd for each ER strat
df_rwrmssd_st <- d %>% 
  group_by(ID, strat) %>% 
  mutate(n = n()) %>% 
  filter(n > 1) %>% 
  filter(mean(rating) < 7) %>%
  filter(mean(rating) > 1) %>%
  summarize(
    rwrmssd = relativeRMSSD(rating, 1, 7),
    n = n()
  ) %>%
  ungroup

Bray-Curtis

d <- df_er %>% 
  pivot_longer(cols=starts_with("er_"), 
               names_to="strat", 
               values_to="rating") %>% 
  group_by(ID, strat) %>% 
  arrange(timeStampSent) %>% 
  mutate(
    rating_abs_diff = abs(rating - lag(rating)),
    rating_sum = rating + lag(rating),
  ) %>%
  ungroup %>% 
  drop_na(rating_abs_diff)

# momentary level (state)
df_bc_st <- d %>% 
  group_by(ID, timeStampSent) %>%
  summarize(
    bc = sum(rating_abs_diff, na.rm=T)/sum(rating_sum, na.rm=T)
  )

hist(df_bc_st$bc)

# individual level (trait)
df_bc_tr <- d %>%
  group_by(ID) %>%
  summarize(
    bc = sum(rating_abs_diff, na.rm=T)/sum(rating_sum, na.rm=T),
    n = n()
  ) 

hist(df_bc_tr$bc)

# checking for a relationship between number of observations and bc
df_bc_tr %>% 
  ggplot(aes(x = n, y = bc)) +
  geom_smooth(se=F, size=.4, color="red") + 
  geom_smooth(method="lm") + 
  geom_point()
## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.

Wentropy (Emotion Regulation Diversity)

# momentary (state)
df_wentropy_st <- df_er %>% 
  pivot_longer(cols=starts_with("er_"), 
               names_to="strat", 
               values_to="rating") %>% 
  drop_na(rating) %>% 
  group_by(ID, timeStampSent) %>% 
  mutate(
    pr = rating/7,
    ln_pr = log(pr),
    pr_ln_pr = pr*ln_pr
    ) %>%
  summarize(
    wentropy = -sum(pr_ln_pr)
  ) %>% 
  ungroup

hist(df_wentropy_st$wentropy)

# individual (trait)
df_wentropy_tr <- df_er %>% 
  pivot_longer(cols=starts_with("er_"), 
               names_to="strat", 
               values_to="rating") %>% 
  drop_na(rating) %>% 
  group_by(ID, strat) %>% 
  summarize(
    pr = sum(rating)/(7*n()),
    ln_pr = log(pr),
    pr_ln_pr = pr*ln_pr
    ) %>%
  summarize(
    wentropy = -sum(pr_ln_pr)
  ) %>% 
  ungroup

hist(df_wentropy_tr$wentropy)

Entropy

# momentary (state)
df_entropy_st <- df_er %>% 
  pivot_longer(cols=starts_with("er_"), 
               names_to="strat", 
               values_to="rating") %>% 
  drop_na(rating) %>% 
  group_by(ID, timeStampSent) %>% 
  mutate(
    pr = rating/sum(rating),
    ln_pr = log(pr),
    pr_ln_pr = pr*ln_pr
    ) %>%
  summarize(
    entropy = -sum(pr_ln_pr)
  ) %>% 
  ungroup

hist(df_entropy_st$entropy, 50)

# individual (trait)
df_entropy_tr <- df_er %>% 
  pivot_longer(cols=starts_with("er_"), 
               names_to="strat", 
               values_to="rating") %>% 
  drop_na(rating) %>% 
  group_by(ID, strat) %>% 
  summarize(
    sum_strategy_rating = sum(rating),
    ) %>%
  mutate(
    pr = sum_strategy_rating/sum(sum_strategy_rating),
    ln_pr = log(pr),
    pr_ln_pr = pr*ln_pr
    ) %>%
  summarize(
    entropy = -sum(pr_ln_pr)
  ) %>% 
  ungroup

hist(df_entropy_tr$entropy, breaks=30)

Trait (between-person analysis)

Cor Between Metrics

d <- df_rwsd %>% 
  select(-n) %>% 
  full_join(df_rbsd %>% select(-n), by="ID") %>%
  full_join(df_rwrmssd %>% select(-n), by="ID") %>%
  full_join(df_bc_tr %>% select(-n), by="ID") %>%
  full_join(df_wentropy_tr, by="ID") %>%
  full_join(df_entropy_tr, by="ID") %>% 
  full_join(df_mean_er_strat, by="ID") %>%
  select(-ID) %>% 
  select(-strat)
## select: dropped one variable (n)
## select: dropped one variable (n)
## full_join: added one column (rbsd)
##            > rows only in x                         0
##            > rows only in df_rbsd %>% select(-n)    1
##            > matched rows                         253
##            >                                     =====
##            > rows total                           254
## select: dropped one variable (n)
## full_join: added one column (rwrmssd)
##            > rows only in x                            1
##            > rows only in df_rwrmssd %>% select(-n)    0
##            > matched rows                            253
##            >                                        =====
##            > rows total                              254
## select: dropped one variable (n)
## full_join: added one column (bc)
##            > rows only in x                          6
##            > rows only in df_bc_tr %>% select(-n)    9
##            > matched rows                          248
##            >                                      =====
##            > rows total                            263
## full_join: added one column (wentropy)
##            > rows only in x                 0
##            > rows only in df_wentropy_tr    2
##            > matched rows                 263
##            >                             =====
##            > rows total                   265
## full_join: added one column (entropy)
##            > rows only in x                0
##            > rows only in df_entropy_tr    0
##            > matched rows                265
##            >                            =====
##            > rows total                  265
## full_join: added 2 columns (strat, mean_er)
##            > rows only in x                     0
##            > rows only in df_mean_er_strat      0
##            > matched rows                   1,325    (includes duplicates)
##            >                               =======
##            > rows total                     1,325
## select: dropped one variable (ID)
## select: dropped one variable (strat)
corrplot::corrplot(cor(d, use="pairwise.complete.obs"))

cor(d, use="pairwise.complete.obs")
##                 rwsd        rbsd     rwrmssd          bc   wentropy     entropy
## rwsd      1.00000000  0.69307528  0.90168342 -0.01388751 -0.1229160 -0.05263748
## rbsd      0.69307528  1.00000000  0.64130309 -0.03940082 -0.2611491 -0.29040009
## rwrmssd   0.90168342  0.64130309  1.00000000 -0.11901781 -0.1643954  0.02033524
## bc       -0.01388751 -0.03940082 -0.11901781  1.00000000  0.5667578  0.01220801
## wentropy -0.12291598 -0.26114908 -0.16439543  0.56675784  1.0000000  0.21150563
## entropy  -0.05263748 -0.29040009  0.02033524  0.01220801  0.2115056  1.00000000
## mean_er  -0.44514455 -0.20574042 -0.55858523  0.21007821 -0.2679604 -0.16430195
##             mean_er
## rwsd     -0.4451445
## rbsd     -0.2057404
## rwrmssd  -0.5585852
## bc        0.2100782
## wentropy -0.2679604
## entropy  -0.1643019
## mean_er   1.0000000

Relative Within SD

df_rwsd_outcomes <- df_rwsd %>% 
  left_join(df_indiff) 
## Joining with `by = join_by(ID)`
## left_join: added 13 columns (Sex, Birth_year, Birth_month, Ethnicity, SCARED,
## …)
## > rows only in x 0
## > rows only in df_indiff ( 12)
## > matched rows 253
## > =====
## > rows total 253

Depression

fit <- lm(SMFQ ~ rwsd, data=df_rwsd_outcomes)
tab_model(fit)
  SMFQ
Predictors Estimates CI p
(Intercept) 1.66 1.45 – 1.88 <0.001
rwsd -0.29 -0.57 – -0.01 0.039
Observations 245
R2 / R2 adjusted 0.017 / 0.013
plot_model(fit, type="slope")
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'

Anxiety

fit <- lm(SCARED ~ rwsd, data=df_rwsd_outcomes)
tab_model(fit)
  SCARED
Predictors Estimates CI p
(Intercept) 2.19 1.98 – 2.41 <0.001
rwsd -0.35 -0.63 – -0.06 0.017
Observations 244
R2 / R2 adjusted 0.023 / 0.019
plot_model(fit, type="slope")
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'

Neg Affect

fit <- lm(panas_neg ~ rwsd, data=df_rwsd_outcomes)
tab_model(fit)
  panas_neg
Predictors Estimates CI p
(Intercept) 2.84 2.45 – 3.22 <0.001
rwsd -1.37 -1.88 – -0.87 <0.001
Observations 253
R2 / R2 adjusted 0.103 / 0.100
plot_model(fit, type="slope")
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'

Pos Affect

fit <- lm(panas_pos ~ rwsd, data=df_rwsd_outcomes)
tab_model(fit)
  panas_pos
Predictors Estimates CI p
(Intercept) 3.97 3.40 – 4.55 <0.001
rwsd 1.56 0.81 – 2.31 <0.001
Observations 253
R2 / R2 adjusted 0.062 / 0.059
plot_model(fit, type="slope")
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'

Relative Between SD

df_rbsd_outcomes <- df_rbsd %>% 
  left_join(df_indiff) 
## Joining with `by = join_by(ID)`
## left_join: added 13 columns (Sex, Birth_year, Birth_month, Ethnicity, SCARED,
## …)
## > rows only in x 0
## > rows only in df_indiff ( 11)
## > matched rows 254
## > =====
## > rows total 254

Depression

fit <- lm(SMFQ ~ rbsd, data=df_rbsd_outcomes)
tab_model(fit)
  SMFQ
Predictors Estimates CI p
(Intercept) 1.55 1.40 – 1.70 <0.001
rbsd -0.16 -0.38 – 0.05 0.141
Observations 246
R2 / R2 adjusted 0.009 / 0.005
plot_model(fit, type="slope")
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'

Anxiety

fit <- lm(SCARED ~ rbsd, data=df_rbsd_outcomes)
tab_model(fit)
  SCARED
Predictors Estimates CI p
(Intercept) 2.03 1.87 – 2.19 <0.001
rbsd -0.14 -0.36 – 0.08 0.212
Observations 245
R2 / R2 adjusted 0.006 / 0.002
plot_model(fit, type="slope")
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'

Neg Affect

fit <- lm(panas_neg ~ rbsd, data=df_rbsd_outcomes)
tab_model(fit)
  panas_neg
Predictors Estimates CI p
(Intercept) 2.23 1.94 – 2.51 <0.001
rbsd -0.61 -1.01 – -0.21 0.003
Observations 254
R2 / R2 adjusted 0.034 / 0.030
plot_model(fit, type="slope")
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'

Pos Affect

fit <- lm(panas_pos ~ rbsd, data=df_rbsd_outcomes)
tab_model(fit)
  panas_pos
Predictors Estimates CI p
(Intercept) 4.69 4.27 – 5.11 <0.001
rbsd 0.66 0.07 – 1.26 0.028
Observations 254
R2 / R2 adjusted 0.019 / 0.015
plot_model(fit, type="slope")
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'

Successive Difference

df_rwrmssd_outcomes <- df_rwrmssd %>% 
  left_join(df_indiff) 
## Joining with `by = join_by(ID)`
## left_join: added 13 columns (Sex, Birth_year, Birth_month, Ethnicity, SCARED,
## …)
## > rows only in x 0
## > rows only in df_indiff ( 12)
## > matched rows 253
## > =====
## > rows total 253

Depression

fit <- lm(SMFQ ~ rwrmssd, data=df_rwrmssd_outcomes)
tab_model(fit)
  SMFQ
Predictors Estimates CI p
(Intercept) 1.68 1.51 – 1.85 <0.001
rwrmssd -0.39 -0.65 – -0.13 0.004
Observations 245
R2 / R2 adjusted 0.034 / 0.030
plot_model(fit, type="slope")
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'

Anxiety

fit <- lm(SCARED ~ rwrmssd, data=df_rwrmssd_outcomes)
tab_model(fit)
  SCARED
Predictors Estimates CI p
(Intercept) 2.24 2.07 – 2.40 <0.001
rwrmssd -0.49 -0.76 – -0.23 <0.001
Observations 244
R2 / R2 adjusted 0.053 / 0.049
plot_model(fit, type="slope")
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'

Neg Affect

fit <- lm(panas_neg ~ rwrmssd, data=df_rwrmssd_outcomes)
tab_model(fit)
  panas_neg
Predictors Estimates CI p
(Intercept) 2.78 2.49 – 3.08 <0.001
rwrmssd -1.58 -2.03 – -1.12 <0.001
Observations 253
R2 / R2 adjusted 0.156 / 0.153
plot_model(fit, type="slope")
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'

Pos Affect

fit <- lm(panas_pos ~ rwrmssd, data=df_rwrmssd_outcomes)
tab_model(fit)
  panas_pos
Predictors Estimates CI p
(Intercept) 4.23 3.78 – 4.68 <0.001
rwrmssd 1.47 0.77 – 2.18 <0.001
Observations 253
R2 / R2 adjusted 0.064 / 0.060
plot_model(fit, type="slope")
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'

Bray-Curtis

df_bc_tr_outcomes <- df_bc_tr %>% 
  left_join(df_indiff) 
## Joining with `by = join_by(ID)`
## left_join: added 13 columns (Sex, Birth_year, Birth_month, Ethnicity, SCARED,
## …)
## > rows only in x 0
## > rows only in df_indiff ( 8)
## > matched rows 257
## > =====
## > rows total 257

Depression

fit <- lm(SMFQ ~ bc, data=df_bc_tr_outcomes)
tab_model(fit)
  SMFQ
Predictors Estimates CI p
(Intercept) 1.37 1.27 – 1.47 <0.001
bc 0.45 -0.04 – 0.95 0.074
Observations 249
R2 / R2 adjusted 0.013 / 0.009
plot_model(fit, type="slope")
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'

Anxiety

fit <- lm(SCARED ~ bc, data=df_bc_tr_outcomes)
tab_model(fit)
  SCARED
Predictors Estimates CI p
(Intercept) 1.79 1.68 – 1.89 <0.001
bc 0.84 0.33 – 1.34 0.001
Observations 249
R2 / R2 adjusted 0.041 / 0.038
plot_model(fit, type="slope")
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'

Neg Affect

fit <- lm(panas_neg ~ bc, data=df_bc_tr_outcomes)
tab_model(fit)
  panas_neg
Predictors Estimates CI p
(Intercept) 1.38 1.20 – 1.56 <0.001
bc 2.51 1.62 – 3.40 <0.001
Observations 257
R2 / R2 adjusted 0.108 / 0.105
plot_model(fit, type="slope")
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'

Pos Affect

fit <- lm(panas_pos ~ bc, data=df_bc_tr_outcomes)
tab_model(fit)
  panas_pos
Predictors Estimates CI p
(Intercept) 5.66 5.39 – 5.93 <0.001
bc -2.97 -4.31 – -1.64 <0.001
Observations 257
R2 / R2 adjusted 0.070 / 0.066
plot_model(fit, type="slope")
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'

Wentropy (Emotion Regulation Diversity)

df_wentropy_tr_outcomes <- df_wentropy_tr %>% 
  left_join(df_indiff) 
## Joining with `by = join_by(ID)`
## left_join: added 13 columns (Sex, Birth_year, Birth_month, Ethnicity, SCARED,
## …)
## > rows only in x 0
## > rows only in df_indiff ( 0)
## > matched rows 265
## > =====
## > rows total 265

Depression

fit <- lm(SMFQ ~ wentropy, data=df_wentropy_tr_outcomes)
tab_model(fit)
  SMFQ
Predictors Estimates CI p
(Intercept) 1.31 0.95 – 1.67 <0.001
wentropy 0.08 -0.15 – 0.32 0.497
Observations 257
R2 / R2 adjusted 0.002 / -0.002
plot_model(fit, type="slope")
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'

Anxiety

fit <- lm(SCARED ~ wentropy, data=df_wentropy_tr_outcomes)
tab_model(fit)
  SCARED
Predictors Estimates CI p
(Intercept) 1.71 1.33 – 2.09 <0.001
wentropy 0.13 -0.11 – 0.38 0.284
Observations 256
R2 / R2 adjusted 0.005 / 0.001
plot_model(fit, type="slope")
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'

Neg Affect

fit <- lm(panas_neg ~ wentropy, data=df_wentropy_tr_outcomes)
tab_model(fit)
  panas_neg
Predictors Estimates CI p
(Intercept) 0.89 0.21 – 1.57 0.010
wentropy 0.59 0.15 – 1.03 0.008
Observations 265
R2 / R2 adjusted 0.026 / 0.022
plot_model(fit, type="slope")
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'

Pos Affect

fit <- lm(panas_pos ~ wentropy, data=df_wentropy_tr_outcomes)
tab_model(fit)
  panas_pos
Predictors Estimates CI p
(Intercept) 7.08 6.09 – 8.06 <0.001
wentropy -1.25 -1.88 – -0.61 <0.001
Observations 265
R2 / R2 adjusted 0.053 / 0.049
plot_model(fit, type="slope")
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'

Entropy

df_entropy_tr_outcomes <- df_entropy_tr %>% 
  left_join(df_indiff) 
## Joining with `by = join_by(ID)`
## left_join: added 13 columns (Sex, Birth_year, Birth_month, Ethnicity, SCARED,
## …)
## > rows only in x 0
## > rows only in df_indiff ( 0)
## > matched rows 265
## > =====
## > rows total 265

Depression

fit <- lm(SMFQ ~ entropy, data=df_entropy_tr_outcomes)
tab_model(fit)
  SMFQ
Predictors Estimates CI p
(Intercept) 3.78 2.13 – 5.42 <0.001
entropy -1.47 -2.51 – -0.44 0.005
Observations 257
R2 / R2 adjusted 0.030 / 0.026
plot_model(fit, type="slope")
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'

Anxiety

fit <- lm(SCARED ~ entropy, data=df_entropy_tr_outcomes)
tab_model(fit)
  SCARED
Predictors Estimates CI p
(Intercept) 4.25 2.54 – 5.97 <0.001
entropy -1.47 -2.55 – -0.39 0.008
Observations 256
R2 / R2 adjusted 0.028 / 0.024
plot_model(fit, type="slope")
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'

Neg Affect

fit <- lm(panas_neg ~ entropy, data=df_entropy_tr_outcomes)
tab_model(fit)
  panas_neg
Predictors Estimates CI p
(Intercept) 3.82 0.69 – 6.96 0.017
entropy -1.28 -3.25 – 0.70 0.204
Observations 265
R2 / R2 adjusted 0.006 / 0.002
plot_model(fit, type="slope")
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'

Pos Affect

fit <- lm(panas_pos ~ entropy, data=df_entropy_tr_outcomes)
tab_model(fit)
  panas_pos
Predictors Estimates CI p
(Intercept) 2.60 -2.02 – 7.23 0.268
entropy 1.62 -1.29 – 4.53 0.274
Observations 265
R2 / R2 adjusted 0.005 / 0.001
plot_model(fit, type="slope")
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'

Momentary (within-person analysis)

Cor Between Metrics

df_bc_st_mean <- df_bc_st %>% 
  group_by(ID) %>% 
  summarize(mean_bc = mean(bc, na.rm = TRUE))
## group_by: one grouping variable (ID)
## summarize: now 257 rows and 2 columns, ungrouped
df_wentropy_st_mean <- df_wentropy_st %>% 
  group_by(ID) %>% 
  summarize(mean_wentropy = mean(wentropy, na.rm = TRUE))
## group_by: one grouping variable (ID)
## summarize: now 265 rows and 2 columns, ungrouped
df_entropy_st_mean <- df_entropy_st %>% 
  group_by(ID) %>% 
  summarize(mean_entropy = mean(entropy, na.rm = TRUE))
## group_by: one grouping variable (ID)
## summarize: now 265 rows and 2 columns, ungrouped
d <- df_rwsd %>% 
  select(-n) %>% 
  full_join(df_rbsd %>% select(-n), by="ID") %>%
  full_join(df_rwrmssd %>% select(-n), by="ID") %>%
  full_join(df_bc_st_mean, by="ID") %>%
  full_join(df_wentropy_st_mean, by="ID") %>%
  full_join(df_entropy_st_mean, by="ID") %>% 
  full_join(df_mean_er_strat, by="ID") %>%
  select(-ID) %>% 
  select(-strat)
## select: dropped one variable (n)
## select: dropped one variable (n)
## full_join: added one column (rbsd)
##            > rows only in x                         0
##            > rows only in df_rbsd %>% select(-n)    1
##            > matched rows                         253
##            >                                     =====
##            > rows total                           254
## select: dropped one variable (n)
## full_join: added one column (rwrmssd)
##            > rows only in x                            1
##            > rows only in df_rwrmssd %>% select(-n)    0
##            > matched rows                            253
##            >                                        =====
##            > rows total                              254
## full_join: added one column (mean_bc)
##            > rows only in x                6
##            > rows only in df_bc_st_mean    9
##            > matched rows                248
##            >                            =====
##            > rows total                  263
## full_join: added one column (mean_wentropy)
##            > rows only in x                      0
##            > rows only in df_wentropy_st_mean    2
##            > matched rows                      263
##            >                                  =====
##            > rows total                        265
## full_join: added one column (mean_entropy)
##            > rows only in x                     0
##            > rows only in df_entropy_st_mean    0
##            > matched rows                     265
##            >                                 =====
##            > rows total                       265
## full_join: added 2 columns (strat, mean_er)
##            > rows only in x                     0
##            > rows only in df_mean_er_strat      0
##            > matched rows                   1,325    (includes duplicates)
##            >                               =======
##            > rows total                     1,325
## select: dropped one variable (ID)
## select: dropped one variable (strat)
corrplot::corrplot(cor(d, use="pairwise.complete.obs"))

cor(d, use="pairwise.complete.obs")
##                     rwsd        rbsd     rwrmssd     mean_bc mean_wentropy
## rwsd           1.0000000  0.69307528  0.90168342 -0.14082009   -0.23403019
## rbsd           0.6930753  1.00000000  0.64130309 -0.06915301   -0.36418921
## rwrmssd        0.9016834  0.64130309  1.00000000 -0.27621472   -0.05835954
## mean_bc       -0.1408201 -0.06915301 -0.27621472  1.00000000   -0.16626100
## mean_wentropy -0.2340302 -0.36418921 -0.05835954 -0.16626100    1.00000000
## mean_entropy  -0.0435414 -0.33794978  0.12736986 -0.48980349    0.43857187
## mean_er       -0.4451445 -0.20574042 -0.55858523  0.38774922   -0.57420085
##               mean_entropy    mean_er
## rwsd            -0.0435414 -0.4451445
## rbsd            -0.3379498 -0.2057404
## rwrmssd          0.1273699 -0.5585852
## mean_bc         -0.4898035  0.3877492
## mean_wentropy    0.4385719 -0.5742008
## mean_entropy     1.0000000 -0.3772359
## mean_er         -0.3772359  1.0000000

Relative Within SD

# all ER strategies
df_rwsd_outcomes <- df_rwsd %>% 
  left_join(df_indiff_2) %>% 
  left_join(
    df_mean_er_strat %>%
      group_by(ID) %>%
      summarize(mean_ID_er = mean(mean_er, na.rm = TRUE)) %>%
      select(ID, mean_ID_er) %>% 
      ungroup() 
    )
## Joining with `by = join_by(ID)`
## left_join: added 13 columns (Sex, Birth_year, Birth_month, Ethnicity, SCARED,
## …)
## > rows only in x 0
## > rows only in df_indiff_2 ( 836)
## > matched rows 17,573 (includes duplicates)
## > ========
## > rows total 17,573
## group_by: one grouping variable (ID)
## summarize: now 265 rows and 2 columns, ungrouped
## select: no changes
## ungroup: no grouping variables remain
## Joining with `by = join_by(ID)`
## left_join: added one column (mean_ID_er)
## > rows only in x 0
## > rows only in df_mean_er_strat %>% gr.. ( 12)
## > matched rows 17,573
## > ========
## > rows total 17,573

Neg Affect

fit <- df_rwsd_outcomes %>% 
  lmer(panas_neg_z ~ rwsd + (1|ID), data = .)
tab_model(fit)
  panas_neg_z
Predictors Estimates CI p
(Intercept) 0.95 0.61 – 1.30 <0.001
rwsd -1.24 -1.69 – -0.79 <0.001
Random Effects
σ2 0.45
τ00 ID 0.51
ICC 0.53
N ID 253
Observations 12099
Marginal R2 / Conditional R2 0.060 / 0.561
# controlling for mean ER
df_rwsd_outcomes %>% 
  lmer(panas_neg_z ~ rwsd + mean_ID_er + (1|ID), data = .) %>% 
  tab_model()
  panas_neg_z
Predictors Estimates CI p
(Intercept) 0.05 -0.44 – 0.55 0.828
rwsd -0.63 -1.13 – -0.13 0.013
mean ID er 0.18 0.11 – 0.25 <0.001
Random Effects
σ2 0.45
τ00 ID 0.47
ICC 0.51
N ID 253
Observations 12099
Marginal R2 / Conditional R2 0.106 / 0.563

relative within SD predicts less neg affect

Pos Affect

fit <- df_rwsd_outcomes %>% 
  lmer(panas_pos_z ~ rwsd + (1|ID), data = .)
tab_model(fit)
  panas_pos_z
Predictors Estimates CI p
(Intercept) -0.73 -1.08 – -0.39 <0.001
rwsd 0.95 0.49 – 1.40 <0.001
Random Effects
σ2 0.47
τ00 ID 0.51
ICC 0.52
N ID 253
Observations 12096
Marginal R2 / Conditional R2 0.035 / 0.538
# controlling for mean ER
df_rwsd_outcomes %>% 
  lmer(panas_pos_z ~ rwsd + mean_ID_er + (1|ID), data = .) %>% 
  tab_model()
  panas_pos_z
Predictors Estimates CI p
(Intercept) -0.80 -1.32 – -0.29 0.002
rwsd 0.99 0.47 – 1.51 <0.001
mean ID er 0.01 -0.06 – 0.09 0.717
Random Effects
σ2 0.47
τ00 ID 0.51
ICC 0.52
N ID 253
Observations 12096
Marginal R2 / Conditional R2 0.035 / 0.538

relative within SD predicts more pos affect

Relative Between SD

df_rbsd_outcomes <- df_rbsd_st %>% 
  left_join(df_indiff_2) %>% 
  left_join(
    df_mean_er_strat %>%
      group_by(ID) %>%
      summarize(mean_ID_er = mean(mean_er, na.rm = TRUE)) %>%
      select(ID, mean_ID_er) %>% 
      ungroup() 
    ) %>% 
  mutate(across(rbsd, ~scale(., scale = F), .names = "{.col}_pc")) %>% 
  mutate(across(rbsd_pc, ~scale(., scale = T), .names = "{.col}_z"))
## Joining with `by = join_by(ID, timeStampSent)`
## left_join: added 12 columns (Sex, Birth_year, Birth_month, Ethnicity, SCARED,
## …)
## > rows only in x 0
## > rows only in df_indiff_2 (11,761)
## > matched rows 6,648
## > ========
## > rows total 6,648
## group_by: one grouping variable (ID)
## summarize: now 265 rows and 2 columns, ungrouped
## select: no changes
## ungroup: no grouping variables remain
## Joining with `by = join_by(ID)`
## left_join: added one column (mean_ID_er)
## > rows only in x 0
## > rows only in df_mean_er_strat %>% gr.. ( 11)
## > matched rows 6,648
## > =======
## > rows total 6,648
## mutate (grouped): new variable 'rbsd_pc' (double) with 3,128 unique values and
## 0% NA
## mutate (grouped): new variable 'rbsd_pc_z' (double) with 3,107 unique values
## and 1% NA

Neg Affect

fit <- df_rbsd_outcomes %>% 
  lmer(panas_neg_z ~ rbsd_pc_z + (1|ID), data = .)
tab_model(fit)
  panas_neg_z
Predictors Estimates CI p
(Intercept) 0.33 0.23 – 0.44 <0.001
rbsd pc z -0.04 -0.06 – -0.03 <0.001
Random Effects
σ2 0.54
τ00 ID 0.60
ICC 0.53
N ID 231
Observations 6612
Marginal R2 / Conditional R2 0.002 / 0.528
# controlling for mean ER
df_rbsd_outcomes %>% 
  lmer(panas_neg_z ~ rbsd_pc_z + mean_ID_er + (1|ID), data = .) %>% 
  tab_model()
  panas_neg_z
Predictors Estimates CI p
(Intercept) 0.18 -0.05 – 0.42 0.130
rbsd pc z -0.04 -0.06 – -0.03 <0.001
mean ID er 0.05 -0.02 – 0.13 0.167
Random Effects
σ2 0.54
τ00 ID 0.60
ICC 0.53
N ID 231
Observations 6612
Marginal R2 / Conditional R2 0.005 / 0.529

relative between SD predicts less neg affect (but effect size is really small)

Pos Affect

fit <- df_rbsd_outcomes %>% 
  lmer(panas_pos_z ~ rbsd_pc_z + (1|ID), data = .)
tab_model(fit)
  panas_pos_z
Predictors Estimates CI p
(Intercept) -0.18 -0.27 – -0.09 <0.001
rbsd pc z 0.04 0.02 – 0.05 <0.001
Random Effects
σ2 0.49
τ00 ID 0.48
ICC 0.49
N ID 231
Observations 6610
Marginal R2 / Conditional R2 0.001 / 0.495
# controlling for mean ER
df_rbsd_outcomes %>% 
  lmer(panas_pos_z ~ rbsd_pc_z + mean_ID_er + (1|ID), data = .) %>% 
  tab_model()
  panas_pos_z
Predictors Estimates CI p
(Intercept) -0.28 -0.49 – -0.06 0.011
rbsd pc z 0.04 0.02 – 0.05 <0.001
mean ID er 0.04 -0.03 – 0.10 0.322
Random Effects
σ2 0.49
τ00 ID 0.48
ICC 0.49
N ID 231
Observations 6610
Marginal R2 / Conditional R2 0.003 / 0.495

relative between SD predicts more pos affect (but effect size is really small)

Successive Difference

df_rwrmssd_outcomes <- df_rwrmssd %>% 
  left_join(df_indiff_2) %>% 
  left_join(
    df_mean_er_strat %>%
      group_by(ID) %>%
      summarize(mean_ID_er = mean(mean_er, na.rm = TRUE)) %>%
      select(ID, mean_ID_er) %>% 
      ungroup() 
    )
## Joining with `by = join_by(ID)`
## left_join: added 13 columns (Sex, Birth_year, Birth_month, Ethnicity, SCARED,
## …)
## > rows only in x 0
## > rows only in df_indiff_2 ( 836)
## > matched rows 17,573 (includes duplicates)
## > ========
## > rows total 17,573
## group_by: one grouping variable (ID)
## summarize: now 265 rows and 2 columns, ungrouped
## select: no changes
## ungroup: no grouping variables remain
## Joining with `by = join_by(ID)`
## left_join: added one column (mean_ID_er)
## > rows only in x 0
## > rows only in df_mean_er_strat %>% gr.. ( 12)
## > matched rows 17,573
## > ========
## > rows total 17,573

Neg Affect

fit <- df_rwrmssd_outcomes %>% 
  lmer(panas_neg_z ~ rwrmssd + (1|ID), data = .)
tab_model(fit)
  panas_neg_z
Predictors Estimates CI p
(Intercept) 0.90 0.64 – 1.17 <0.001
rwrmssd -1.42 -1.83 – -1.02 <0.001
Random Effects
σ2 0.45
τ00 ID 0.48
ICC 0.52
N ID 253
Observations 12099
Marginal R2 / Conditional R2 0.092 / 0.562
# controlling for mean ER
df_rwrmssd_outcomes %>% 
  lmer(panas_neg_z ~ rwrmssd + mean_ID_er + (1|ID), data = .) %>% 
  tab_model()
  panas_neg_z
Predictors Estimates CI p
(Intercept) 0.21 -0.26 – 0.68 0.378
rwrmssd -0.86 -1.37 – -0.35 0.001
mean ID er 0.14 0.06 – 0.22 0.001
Random Effects
σ2 0.45
τ00 ID 0.46
ICC 0.51
N ID 253
Observations 12099
Marginal R2 / Conditional R2 0.116 / 0.564

successive differences predicts less neg affect

Pos Affect

fit <- df_rwrmssd_outcomes %>% 
  lmer(panas_pos_z ~ rwrmssd + (1|ID), data = .)
tab_model(fit)
  panas_pos_z
Predictors Estimates CI p
(Intercept) -0.58 -0.85 – -0.31 <0.001
rwrmssd 0.89 0.47 – 1.31 <0.001
Random Effects
σ2 0.47
τ00 ID 0.51
ICC 0.52
N ID 253
Observations 12096
Marginal R2 / Conditional R2 0.036 / 0.538
# controlling for mean ER
df_rwrmssd_outcomes %>% 
  lmer(panas_pos_z ~ rwrmssd + mean_ID_er + (1|ID), data = .) %>% 
  tab_model()
  panas_pos_z
Predictors Estimates CI p
(Intercept) -0.81 -1.31 – -0.32 0.001
rwrmssd 1.08 0.54 – 1.62 <0.001
mean ID er 0.05 -0.04 – 0.13 0.268
Random Effects
σ2 0.47
τ00 ID 0.51
ICC 0.52
N ID 253
Observations 12096
Marginal R2 / Conditional R2 0.038 / 0.539

successive differences predicts more pos affect (large effect size)

Bray-Curtis

df_bc_outcomes <- df_bc_st %>% 
  left_join(df_indiff_2) %>% 
  left_join(
    df_mean_er_strat %>%
      group_by(ID) %>%
      summarize(mean_ID_er = mean(mean_er, na.rm = TRUE)) %>%
      select(ID, mean_ID_er) %>% 
      ungroup() 
    ) %>% 
  mutate(across(bc, ~scale(., scale = F), .names = "{.col}_pc")) %>% 
  mutate(across(bc_pc, ~scale(., scale = T), .names = "{.col}_z"))
## Joining with `by = join_by(ID, timeStampSent)`
## left_join: added 12 columns (Sex, Birth_year, Birth_month, Ethnicity, SCARED,
## …)
## > rows only in x 0
## > rows only in df_indiff_2 (8,410)
## > matched rows 9,999
## > =======
## > rows total 9,999
## group_by: one grouping variable (ID)
## summarize: now 265 rows and 2 columns, ungrouped
## select: no changes
## ungroup: no grouping variables remain
## Joining with `by = join_by(ID)`
## left_join: added one column (mean_ID_er)
## > rows only in x 0
## > rows only in df_mean_er_strat %>% gr.. ( 8)
## > matched rows 9,999
## > =======
## > rows total 9,999
## mutate (grouped): new variable 'bc_pc' (double) with 3,901 unique values and 0%
## NA
## mutate (grouped): new variable 'bc_pc_z' (double) with 3,901 unique values and
## 4% NA

Neg Affect

fit <- df_bc_outcomes %>% 
  lmer(panas_neg_z ~ bc_pc_z + (1|ID), data = .)
tab_model(fit)
  panas_neg_z
Predictors Estimates CI p
(Intercept) 0.04 -0.06 – 0.14 0.421
bc pc z 0.10 0.09 – 0.11 <0.001
Random Effects
σ2 0.44
τ00 ID 0.59
ICC 0.58
N ID 244
Observations 9578
Marginal R2 / Conditional R2 0.009 / 0.580
# controlling for mean ER
df_bc_outcomes %>% 
  lmer(panas_neg_z ~ bc_pc_z + mean_ID_er + (1|ID), data = .) %>% 
  tab_model()
  panas_neg_z
Predictors Estimates CI p
(Intercept) -0.51 -0.70 – -0.32 <0.001
bc pc z 0.10 0.09 – 0.11 <0.001
mean ID er 0.22 0.15 – 0.28 <0.001
Random Effects
σ2 0.44
τ00 ID 0.50
ICC 0.54
N ID 244
Observations 9578
Marginal R2 / Conditional R2 0.101 / 0.583

BC predicts MORE neg affect (effect size does not change when controlling for mean ER; small effect size)

Pos Affect

fit <- df_bc_outcomes %>% 
  lmer(panas_pos_z ~ bc_pc_z + (1|ID), data = .)
tab_model(fit)
  panas_pos_z
Predictors Estimates CI p
(Intercept) -0.04 -0.14 – 0.05 0.381
bc pc z -0.05 -0.06 – -0.04 <0.001
Random Effects
σ2 0.46
τ00 ID 0.56
ICC 0.55
N ID 244
Observations 9575
Marginal R2 / Conditional R2 0.002 / 0.547
# controlling for mean ER
df_bc_outcomes %>% 
  lmer(panas_pos_z ~ bc_pc_z + mean_ID_er + (1|ID), data = .) %>% 
  tab_model()
  panas_pos_z
Predictors Estimates CI p
(Intercept) 0.09 -0.11 – 0.29 0.382
bc pc z -0.05 -0.06 – -0.04 <0.001
mean ID er -0.05 -0.12 – 0.02 0.141
Random Effects
σ2 0.46
τ00 ID 0.55
ICC 0.54
N ID 244
Observations 9575
Marginal R2 / Conditional R2 0.008 / 0.548

BC predicts LESS pos affect (effect size does not change when controlling for mean ER; small effect size)

Wentropy (Emotion Regulation Diversity)

df_wentropy_outcomes <- df_wentropy_st %>% 
  left_join(df_indiff_2) %>% 
  left_join(
    df_mean_er_strat %>%
      group_by(ID) %>%
      summarize(mean_ID_er = mean(mean_er, na.rm = TRUE)) %>%
      select(ID, mean_ID_er) %>% 
      ungroup() 
    ) %>% 
  mutate(across(wentropy, ~scale(., scale = F), .names = "{.col}_pc")) %>% 
  mutate(across(wentropy_pc, ~scale(., scale = T), .names = "{.col}_z"))
## Joining with `by = join_by(ID, timeStampSent)`
## left_join: added 12 columns (Sex, Birth_year, Birth_month, Ethnicity, SCARED,
## …)
## > rows only in x 0
## > rows only in df_indiff_2 ( 5,819)
## > matched rows 12,590
## > ========
## > rows total 12,590
## group_by: one grouping variable (ID)
## summarize: now 265 rows and 2 columns, ungrouped
## select: no changes
## ungroup: no grouping variables remain
## Joining with `by = join_by(ID)`
## left_join: added one column (mean_ID_er)
## > rows only in x 0
## > rows only in df_mean_er_strat %>% gr.. ( 0)
## > matched rows 12,590
## > ========
## > rows total 12,590
## mutate: new variable 'wentropy_pc' (double) with 436 unique values and 0% NA
## mutate: new variable 'wentropy_pc_z' (double) with 436 unique values and 0% NA

Neg Affect

fit <- df_wentropy_outcomes %>% 
  lmer(panas_neg_z ~ wentropy_pc_z + (1|ID), data = .)
tab_model(fit)
  panas_neg_z
Predictors Estimates CI p
(Intercept) 0.02 -0.07 – 0.11 0.724
wentropy pc z -0.05 -0.07 – -0.03 <0.001
Random Effects
σ2 0.43
τ00 ID 0.56
ICC 0.56
N ID 265
Observations 12590
Marginal R2 / Conditional R2 0.003 / 0.566
# controlling for mean ER
df_wentropy_outcomes %>% 
  lmer(panas_neg_z ~ wentropy_pc_z + mean_ID_er + (1|ID), data = .) %>% 
  tab_model()
  panas_neg_z
Predictors Estimates CI p
(Intercept) -0.52 -0.69 – -0.35 <0.001
wentropy pc z -0.05 -0.06 – -0.03 <0.001
mean ID er 0.22 0.16 – 0.28 <0.001
Random Effects
σ2 0.43
τ00 ID 0.47
ICC 0.52
N ID 265
Observations 12590
Marginal R2 / Conditional R2 0.107 / 0.574

Wentropy predicts less neg affect (but small effect size)

Pos Affect

fit <- df_wentropy_outcomes %>% 
  lmer(panas_pos_z ~ wentropy_pc_z + (1|ID), data = .)
tab_model(fit)
  panas_pos_z
Predictors Estimates CI p
(Intercept) -0.00 -0.09 – 0.09 0.929
wentropy pc z -0.04 -0.06 – -0.02 <0.001
Random Effects
σ2 0.46
τ00 ID 0.54
ICC 0.54
N ID 265
Observations 12587
Marginal R2 / Conditional R2 0.002 / 0.542
# controlling for mean ER
df_wentropy_outcomes %>% 
  lmer(panas_pos_z ~ wentropy_pc_z + mean_ID_er + (1|ID), data = .) %>% 
  tab_model()
  panas_pos_z
Predictors Estimates CI p
(Intercept) 0.23 0.04 – 0.41 0.016
wentropy pc z -0.04 -0.06 – -0.02 <0.001
mean ID er -0.09 -0.16 – -0.03 0.005
Random Effects
σ2 0.46
τ00 ID 0.53
ICC 0.53
N ID 265
Observations 12587
Marginal R2 / Conditional R2 0.013 / 0.541

Wentropy predicts LESS pos affecr (but small effect size)

Entropy

df_entropy_outcomes <- df_entropy_st %>% 
  left_join(df_indiff_2) %>% 
  left_join(
    df_mean_er_strat %>%
      group_by(ID) %>%
      summarize(mean_ID_er = mean(mean_er, na.rm = TRUE)) %>%
      select(ID, mean_ID_er) %>% 
      ungroup() 
    ) %>% 
  mutate(across(entropy, ~scale(., scale = F), .names = "{.col}_pc")) %>% 
  mutate(across(entropy_pc, ~scale(., scale = T), .names = "{.col}_z"))
## Joining with `by = join_by(ID, timeStampSent)`
## left_join: added 12 columns (Sex, Birth_year, Birth_month, Ethnicity, SCARED,
## …)
## > rows only in x 0
## > rows only in df_indiff_2 ( 5,819)
## > matched rows 12,590
## > ========
## > rows total 12,590
## group_by: one grouping variable (ID)
## summarize: now 265 rows and 2 columns, ungrouped
## select: no changes
## ungroup: no grouping variables remain
## Joining with `by = join_by(ID)`
## left_join: added one column (mean_ID_er)
## > rows only in x 0
## > rows only in df_mean_er_strat %>% gr.. ( 0)
## > matched rows 12,590
## > ========
## > rows total 12,590
## mutate: new variable 'entropy_pc' (double) with 416 unique values and 0% NA
## mutate: new variable 'entropy_pc_z' (double) with 416 unique values and 0% NA

Neg Affect

fit <- df_entropy_outcomes %>% 
  lmer(panas_neg_z ~ entropy_pc_z + (1|ID), data = .)
tab_model(fit)
  panas_neg_z
Predictors Estimates CI p
(Intercept) 0.01 -0.08 – 0.10 0.748
entropy pc z -0.09 -0.11 – -0.07 <0.001
Random Effects
σ2 0.43
τ00 ID 0.54
ICC 0.56
N ID 265
Observations 12590
Marginal R2 / Conditional R2 0.008 / 0.562
# controlling for mean ER
df_entropy_outcomes %>% 
  lmer(panas_neg_z ~ entropy_pc_z + mean_ID_er + (1|ID), data = .) %>% 
  tab_model()
  panas_neg_z
Predictors Estimates CI p
(Intercept) -0.51 -0.68 – -0.34 <0.001
entropy pc z -0.09 -0.10 – -0.07 <0.001
mean ID er 0.21 0.15 – 0.27 <0.001
Random Effects
σ2 0.43
τ00 ID 0.46
ICC 0.52
N ID 265
Observations 12590
Marginal R2 / Conditional R2 0.114 / 0.571

Entropy predicts less neg affect (but small effect size)

Pos Affect

fit <- df_entropy_outcomes %>% 
  lmer(panas_pos_z ~ entropy_pc_z + (1|ID), data = .)
tab_model(fit)
  panas_pos_z
Predictors Estimates CI p
(Intercept) -0.00 -0.09 – 0.08 0.918
entropy pc z 0.05 0.03 – 0.06 <0.001
Random Effects
σ2 0.46
τ00 ID 0.54
ICC 0.54
N ID 265
Observations 12587
Marginal R2 / Conditional R2 0.002 / 0.541
# controlling for mean ER
df_entropy_outcomes %>% 
  lmer(panas_pos_z ~ entropy_pc_z + mean_ID_er + (1|ID), data = .) %>% 
  tab_model()
  panas_pos_z
Predictors Estimates CI p
(Intercept) 0.17 -0.02 – 0.35 0.077
entropy pc z 0.05 0.03 – 0.06 <0.001
mean ID er -0.07 -0.13 – -0.00 0.037
Random Effects
σ2 0.46
τ00 ID 0.53
ICC 0.54
N ID 265
Observations 12587
Marginal R2 / Conditional R2 0.014 / 0.543

Entropy predicts more pos affect (but small effect size)