Read daily data

Intake data

Clean up intake file

Visualize intake data

Tables

Characteristic N = 601
complete_pings_eligible 60 (100%)
reenroll_eligible 60 (100%)
comp 52 (87%)
eligible 52 (87%)
1 n (%)

Trait sum tables

Summary tables with rstatix

variable n min max median iqr mean sd se ci
hcs_sum 45 60 87 72 7.00 72.200 5.945 0.886 1.786
ius_sum 46 15 49 34 9.75 33.652 8.078 1.191 2.399
paq_sum 49 24 116 70 32.00 73.020 24.200 3.457 6.951

Correlations

intake_clean %>%
  dplyr::select(c(ius_sum, hcs_sum, paq_sum)) %>%
  correlate()
## Correlation computed with
## • Method: 'pearson'
## • Missing treated using: 'pairwise.complete.obs'
## # A tibble: 3 × 4
##   term    ius_sum hcs_sum paq_sum
##   <chr>     <dbl>   <dbl>   <dbl>
## 1 ius_sum  NA      -0.109   0.363
## 2 hcs_sum  -0.109  NA      -0.174
## 3 paq_sum   0.363  -0.174  NA
trait_corr_matrix <- intake_clean %>%
  dplyr::select(c(ius_sum, hcs_sum, paq_sum)) %>%
  as.matrix() %>%
  rcorr() 

print(trait_corr_matrix)
##         ius_sum hcs_sum paq_sum
## ius_sum    1.00   -0.11    0.36
## hcs_sum   -0.11    1.00   -0.17
## paq_sum    0.36   -0.17    1.00
## 
## n
##         ius_sum hcs_sum paq_sum
## ius_sum      46      43      46
## hcs_sum      43      45      45
## paq_sum      46      45      49
## 
## P
##         ius_sum hcs_sum paq_sum
## ius_sum         0.4883  0.0130 
## hcs_sum 0.4883          0.2535 
## paq_sum 0.0130  0.2535

Charts

# age visualization
age_hist <- ggplot(intake_clean, 
       aes(x=age, fill=gender))+
  geom_histogram() +
  ggtitle("Age distribution")

# helper paq df
intake_longer <- intake_clean %>%
  dplyr::select(matches("hcs|ius|paq|pid")) %>%
  pivot_longer(-pid, names_to = "scale", values_to = "value")

# paq distribution (histogram)
paq_main_subs <- c("paq_g_eot", "paq_g_dif", "paq_g_ddf")

paq_main_hist <- intake_longer %>%
  filter(scale %in% paq_main_subs) %>%
ggplot(aes(x=value, color=scale, fill=scale)) +
  geom_histogram()+
  facet_grid(~scale)  

# better paq distribution: violin
paq_violin <- intake_longer %>%
  filter(scale %in% paq_main_subs) %>%
ggplot(aes(x=scale, y=value, fill=scale)) +
  geom_violin() +
  ggtitle("Main PAQ subscale distributions")

# paq vs ius
paq_ius <- ggplot(intake_clean,
       aes(x=paq_sum, y=ius_sum))+
  geom_point() +
  geom_smooth(method=lm, color="purple", se=TRUE)+
  stat_cor(label.y=8)+
  stat_regline_equation(formula=y~x, label.y=3) +
  ggtitle("PAQ total vs. Intolerance of Uncertainty Scale total")


# paq vs hcs
paq_hcs <- ggplot(intake_clean,
       aes(x=paq_sum, y=hcs_sum))+
  geom_point() +
  geom_smooth(method=lm, color="purple", se=TRUE)+
  stat_cor(label.y=8)+
  stat_regline_equation(formula=y~x, label.y=3)+
  ggtitle("PAQ total vs. Holistic Cognition Scale total")


# hcs vs ius
hcs_ius <- ggplot(intake_clean,
       aes(x=hcs_sum, y=ius_sum))+
  geom_point() +
  geom_smooth(method=lm, color="purple", se=TRUE)+
  stat_cor(label.y=8)+
  stat_regline_equation(formula=y~x, label.y=3) +
  ggtitle("Holistic Cognition Scale total vs. Intolerance of Uncertainty Scale total")

print(list(hcs_ius, paq_hcs, paq_ius, paq_violin, paq_main_hist, age_hist))
## [[1]]
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 6 rows containing non-finite values (`stat_smooth()`).
## Warning: Removed 6 rows containing non-finite values (`stat_cor()`).
## Warning: Removed 6 rows containing non-finite values
## (`stat_regline_equation()`).
## Warning: Removed 6 rows containing missing values (`geom_point()`).

## 
## [[2]]
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 4 rows containing non-finite values (`stat_smooth()`).
## Warning: Removed 4 rows containing non-finite values (`stat_cor()`).
## Warning: Removed 4 rows containing non-finite values
## (`stat_regline_equation()`).
## Warning: Removed 4 rows containing missing values (`geom_point()`).

## 
## [[3]]
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## Warning: Removed 3 rows containing non-finite values (`stat_cor()`).
## Warning: Removed 3 rows containing non-finite values
## (`stat_regline_equation()`).
## Warning: Removed 3 rows containing missing values (`geom_point()`).

## 
## [[4]]

## 
## [[5]]
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

## 
## [[6]]
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 1 rows containing non-finite values (`stat_bin()`).

Daily data

Clean + process daily data

Visualize daily data

# person-center + divide paq scores by 10
daily_clean <- daily_clean %>%
  mutate(difc = state_dif - mean(state_dif, na.rm = TRUE),
         ddfc = state_ddf - mean(state_ddf, na.rm = TRUE),
         seuc = state_seu - mean(state_seu, na.rm = TRUE),
         ieuc = state_ieu - mean(state_ieu, na.rm = TRUE),
         paq_g_dif_st = paq_g_dif/10,
         paq_g_ddf_st = paq_g_ddf/10
         )

# table with mean values
## KATE: what to do with the NA values when summarizing?
## na.rm = TRUE
daily_clean %>%
  summarize(mean_stressed = mean(stressed),
            sd_stressed = sd(stressed),
            mean_angry = mean(angry),
            sd_angry = sd(angry),
            mean_sad = mean(sad),
            sd_sad = sd(sad),
            mean_anxious = mean(anxious),
            sd_anxious = sd(anxious),
            mean_depressed = mean(depressed),
            sd_depressed = sd(depressed),
            mean_lonely = mean(lonely),
            sd_lonely = sd(lonely),
            mean_state_dif = mean(state_dif),
            sd_state_dif = sd(state_dif),
            mean_state_ddf = mean(state_ddf),
            sd_state_ddf = sd(state_ddf),
            mean_state_ieu = mean(state_ieu),
            sd_state_ieu = sd(state_ieu),
            mean_state_seu = sd(state_seu)
  )
## # A tibble: 1 × 19
##   mean_stressed sd_stressed mean_angry sd_angry mean_sad sd_sad mean_anxious
##           <dbl>       <dbl>      <dbl>    <dbl>    <dbl>  <dbl>        <dbl>
## 1            NA          NA         NA       NA       NA     NA           NA
## # ℹ 12 more variables: sd_anxious <dbl>, mean_depressed <dbl>,
## #   sd_depressed <dbl>, mean_lonely <dbl>, sd_lonely <dbl>,
## #   mean_state_dif <dbl>, sd_state_dif <dbl>, mean_state_ddf <dbl>,
## #   sd_state_ddf <dbl>, mean_state_ieu <dbl>, sd_state_ieu <dbl>,
## #   mean_state_seu <dbl>
cols_to_piv <- c("stressed", "angry", "sad", "anxious", "depressed", "lonely",
                 "state_dif", "state_ddf", "state_ieu", "state_seu", "state_ddf",
                 "difc", "ddfc", "seuc", "ieuc", "paq_g_dif_st", 
                 "paq_g_ddf_st")

daily_long <- daily_clean %>%
  pivot_longer(all_of(cols_to_piv),names_to="var", values_to="value")

# state_dif/ddf histogram

st_difddf_hist <- daily_long %>%
  filter(!is.na(value)) %>%
  filter(var %in% c("state_dif", "state_ddf")) %>%
ggplot(aes(x=value, fill=var)) +
  geom_histogram(binwidth=1) +
  facet_grid(~var)

# look at 6 emotion distributions: violin
emo_violin <- daily_long%>%
  filter(var %in% c("stressed", "angry", "sad", "anxious", "depressed", "lonely"))%>%
  na.omit()%>%
ggplot(aes(x=var,y=value, fill=var)) +
  geom_violin() + 
  coord_flip() + 
  ggtitle("Distribution of negative emotion ratings for individual pings")

# look at 6 emotion distributions: boxplots
emo_box <- daily_long%>%
  filter(var %in% c("stressed", "angry", "sad", "anxious", "depressed", "lonely"))%>%
  na.omit()%>%
ggplot(aes(x=var,y=value, fill=var)) +
  geom_boxplot() + 
  geom_jitter(color="black", size=0.4, alpha=0.9) +
  coord_flip() + 
  ggtitle("Distribution of negative emotion ratings for individual pings")

# importance of understanding emotion + satisfaction with emotion understanding
sat_imp <- daily_long%>%
  filter(var %in% c("state_ieu", "state_seu"))%>%
  ggplot(aes(x=value, fill=var, color=var)) +
  geom_histogram(binwidth=1) +
  facet_wrap(~var) +
  ggtitle("Importance of emotion understanding and satisfaction 
          with emotion understanding distributions")

(list(st_difddf_hist, emo_violin, emo_box, sat_imp))
## [[1]]

## 
## [[2]]

## 
## [[3]]

## 
## [[4]]

import emodiff data + clean up

emodiff_filepath <- "/Users/lucywallace/Library/Mobile Documents/com~apple~CloudDocs/research/honors_thesis/ema23/ema23_emodiff.xlsx"
emodiff_file <- read_xlsx(here(emodiff_filepath))

daily_clean <- emodiff_file %>%
  dplyr::select(c(responseid, 25:34)) %>%
  right_join(daily_clean, by="responseid")

visualize emodiff

emodiff = daily_clean$L2_ED 

# basic histogram
emodiff_hist <- daily_clean %>%
  ggplot(aes(x=L2_nonED)) +
  geom_histogram() + 
  ggtitle("Distribution of emotion non-differentiation")

# correlation with paq_sum
emodiff_paq <- daily_clean %>%
  ggplot(aes(x=L2_nonED, y=paq_sum)) +
  geom_point() +
  geom_smooth(method=lm, color="purple", se=TRUE)+
  stat_cor(label.y=8)+
  stat_regline_equation(formula=y~x, label.y=3) +
  ggtitle("PAQ total vs. emotion non-differentiation")

# correlation with paq neg?

emodiff_paqndif <- daily_clean %>%
  # filter(emodiff > 0) %>%
  ggplot(aes(x=emodiff, y=paq_n_dif)) +
  geom_point() +
  geom_smooth(method=lm, color="purple", se=TRUE)+
  stat_cor(label.y=8)+
  stat_regline_equation(formula=y~x, label.y=3) +
  ggtitle("PAQ N DIF vs. emotion non-differentiation")

emodiff_paqnddf <- daily_clean %>%
  # filter(emodiff > 0) %>%
  ggplot(aes(x=emodiff, y=paq_n_ddf)) +
  geom_point() +
  geom_smooth(method=lm, color="purple", se=TRUE)+
  stat_cor(label.y=4)+
  stat_regline_equation(formula=y~x, label.y=2) +
  ggtitle("PAQ N DDF vs. emotion non-differentiation")


graphs = list(emodiff_hist, emodiff_paq, emodiff_paqndif, emodiff_paqnddf)

graphs
## [[1]]
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

## 
## [[2]]
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 3258 rows containing non-finite values (`stat_smooth()`).
## Warning: Removed 3258 rows containing non-finite values (`stat_cor()`).
## Warning: Removed 3258 rows containing non-finite values
## (`stat_regline_equation()`).
## Warning: Removed 3258 rows containing missing values (`geom_point()`).

## 
## [[3]]
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 3258 rows containing non-finite values (`stat_smooth()`).
## Warning: Removed 3258 rows containing non-finite values (`stat_cor()`).
## Warning: Removed 3258 rows containing non-finite values
## (`stat_regline_equation()`).
## Warning: Removed 3258 rows containing missing values (`geom_point()`).

## 
## [[4]]
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 3258 rows containing non-finite values (`stat_smooth()`).
## Warning: Removed 3258 rows containing non-finite values (`stat_cor()`).
## Warning: Removed 3258 rows containing non-finite values
## (`stat_regline_equation()`).
## Warning: Removed 3258 rows containing missing values (`geom_point()`).

mixed effect model 1: dif state vs trait

# Attempt to create function
  basic_plot1 <- ggplot(daily_clean, aes(x=paq_g_dif_st, y=difc)) +
  geom_point() +
  geom_jitter(height = 0.5,
              width = 0.5) +
  stat_smooth(method = "lm",
              formula = y~x,
              geom = "smooth")
  
  # model 0: random intercept only
  model0_fit1 <- lmer(difc ~ paq_g_dif_st + (1|pid),
                   data=daily_clean)
  
  model0_fit1_sum <- summary(model0_fit1)
  
  # Store random effect variances
  RandomEffects01 <- as.data.frame(VarCorr(model0_fit1))

  # compute ICC between
  ICC_between01 <- RandomEffects01[1,4]/(RandomEffects01[1,4]+RandomEffects01[2,4]) 


  plotREsim01 <- plotREsim(REsim(model0_fit1))
  
# model 1: random intercept and slope
  model1_fit1 = lmer(difc ~ paq_g_dif_st + (1 + paq_g_dif_st | pid),
                 data=daily_clean)
## boundary (singular) fit: see help('isSingular')
   model1_fit1_sum = summary(model1_fit1)
   
 # Store random effect variances
  RandomEffects11 <- as.data.frame(VarCorr(model1_fit1))

  # compute ICC between
  ICC_between11 <- RandomEffects11[1,4]/(RandomEffects11[1,4]+RandomEffects11[2,4])

  plotREsim11 <- plotREsim(REsim(model1_fit1))

list(model0_fit1_sum, ICC_between01, plotREsim01, model1_fit1_sum, ICC_between11, plotREsim11)  
## [[1]]
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: difc ~ paq_g_dif_st + (1 | pid)
##    Data: daily_clean
## 
## REML criterion at convergence: 52039.9
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.5581 -0.6195 -0.1084  0.5844  3.8643 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  pid      (Intercept) 1.126    1.061   
##  Residual             2.083    1.443   
## Number of obs: 14500, groups:  pid, 49
## 
## Fixed effects:
##              Estimate Std. Error      df t value Pr(>|t|)   
## (Intercept)   -1.4904     0.4426 47.0407  -3.367  0.00152 **
## paq_g_dif_st   0.5987     0.1749 46.9888   3.423  0.00129 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr)
## paq_g_df_st -0.939
## 
## [[2]]
## [1] 0.3509433
## 
## [[3]]

## 
## [[4]]
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: difc ~ paq_g_dif_st + (1 + paq_g_dif_st | pid)
##    Data: daily_clean
## 
## REML criterion at convergence: 52039.5
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.5576 -0.6195 -0.1086  0.5842  3.8649 
## 
## Random effects:
##  Groups   Name         Variance Std.Dev. Corr
##  pid      (Intercept)  0.731879 0.85550      
##           paq_g_dif_st 0.007391 0.08597  1.00
##  Residual              2.083268 1.44335      
## Number of obs: 14500, groups:  pid, 49
## 
## Fixed effects:
##              Estimate Std. Error      df t value Pr(>|t|)   
## (Intercept)   -1.5154     0.4263 35.3039  -3.555  0.00110 **
## paq_g_dif_st   0.6094     0.1767 45.4956   3.449  0.00122 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr)
## paq_g_df_st -0.935
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
## 
## 
## [[5]]
## [1] 0.9900024
## 
## [[6]]

lmer(difc ~ paq_g_dif_st + (1 + paq_g_dif_st|pid),
                   data=daily_clean)
## boundary (singular) fit: see help('isSingular')
## Linear mixed model fit by REML ['lmerModLmerTest']
## Formula: difc ~ paq_g_dif_st + (1 + paq_g_dif_st | pid)
##    Data: daily_clean
## REML criterion at convergence: 52039.53
## Random effects:
##  Groups   Name         Std.Dev. Corr
##  pid      (Intercept)  0.85550      
##           paq_g_dif_st 0.08597  1.00
##  Residual              1.44335      
## Number of obs: 14500, groups:  pid, 49
## Fixed Effects:
##  (Intercept)  paq_g_dif_st  
##      -1.5154        0.6094  
## optimizer (nloptwrap) convergence code: 0 (OK) ; 0 optimizer warnings; 1 lme4 warnings

mixed effect models: ddf state vs trait

Weird - why is correlation equal to -1?

  basic_plot <- ggplot(daily_clean, aes(x=paq_g_ddf_st, y=ddfc)) +
  geom_point() +
  geom_jitter(height = 0.5,
              width = 0.5) +
  stat_smooth(method = "lm",
              formula = y~x,
              geom = "smooth")
  
  # model 0: random intercept only
  Bmodel0_fit <- lmer(ddfc ~ paq_g_ddf_st + (1|pid),
                   data=daily_clean)
  # Store random effect variances
  BRandomEffects0 <- as.data.frame(VarCorr(Bmodel0_fit))

  # compute ICC between
  BICC_between0 <- BRandomEffects0[1,4]/(BRandomEffects0[1,4]+BRandomEffects0[2,4]) 

  BplotREsim0 <- plotREsim(REsim(Bmodel0_fit))
  
  # model 1: random intercept and slope
  Bmodel1_fit = lmer(ddfc ~ paq_g_ddf_st + (1 + paq_g_ddf_st | pid),
                 data=daily_clean)
## boundary (singular) fit: see help('isSingular')
 # Store random effect variances
  BRandomEffects1 <- as.data.frame(VarCorr(Bmodel1_fit))

  # compute ICC between
  BICC_between1 <- BRandomEffects1[1,4]/(BRandomEffects1[1,4]+BRandomEffects1[2,4]) 

  BplotREsim1 <- plotREsim(REsim(Bmodel1_fit))

list(Bmodel0_fit, BRandomEffects0, BICC_between0, BplotREsim0, Bmodel1_fit, BRandomEffects1, BICC_between1, BplotREsim1)  
## [[1]]
## Linear mixed model fit by REML ['lmerModLmerTest']
## Formula: ddfc ~ paq_g_ddf_st + (1 | pid)
##    Data: daily_clean
## REML criterion at convergence: 51947.58
## Random effects:
##  Groups   Name        Std.Dev.
##  pid      (Intercept) 1.058   
##  Residual             1.439   
## Number of obs: 14500, groups:  pid, 49
## Fixed Effects:
##  (Intercept)  paq_g_ddf_st  
##      -1.4997        0.5772  
## 
## [[2]]
##        grp        var1 var2     vcov    sdcor
## 1      pid (Intercept) <NA> 1.119772 1.058193
## 2 Residual        <NA> <NA> 2.070020 1.438757
## 
## [[3]]
## [1] 0.3510485
## 
## [[4]]

## 
## [[5]]
## Linear mixed model fit by REML ['lmerModLmerTest']
## Formula: ddfc ~ paq_g_ddf_st + (1 + paq_g_ddf_st | pid)
##    Data: daily_clean
## REML criterion at convergence: 51947.57
## Random effects:
##  Groups   Name         Std.Dev. Corr 
##  pid      (Intercept)  1.081174      
##           paq_g_ddf_st 0.009015 -1.00
##  Residual              1.438757      
## Number of obs: 14500, groups:  pid, 49
## Fixed Effects:
##  (Intercept)  paq_g_ddf_st  
##       -1.502         0.578  
## optimizer (nloptwrap) convergence code: 0 (OK) ; 0 optimizer warnings; 1 lme4 warnings 
## 
## [[6]]
##        grp         var1         var2          vcov        sdcor
## 1      pid  (Intercept)         <NA>  1.168937e+00  1.081174063
## 2      pid paq_g_ddf_st         <NA>  8.127817e-05  0.009015441
## 3      pid  (Intercept) paq_g_ddf_st -9.747261e-03 -1.000000000
## 4 Residual         <NA>         <NA>  2.070020e+00  1.438756515
## 
## [[7]]
## [1] 0.9999305
## 
## [[8]]

mixed effect models: paq sum vs state ieu

Something weird going on here: not sure why I have corr = 1?

daily_clean$paq_sum_st <- daily_clean$paq_sum /10

ggplot(daily_clean, aes(x=paq_sum_st, y=ieuc)) +
  geom_point() +
  geom_jitter(height = 0.5,
              width = 0.5) +
  stat_smooth(method = "lm",
              formula = y~x,
              geom = "smooth")
## Warning: Removed 3352 rows containing non-finite values (`stat_smooth()`).
## Warning: Removed 3352 rows containing missing values (`geom_point()`).
## Removed 3352 rows containing missing values (`geom_point()`).

  # model 0: random intercept only
  Cmodel0_fit <- lmer(ieuc ~ paq_sum_st + (1|pid),
                   data=daily_clean)
  # Store random effect variances
  CRandomEffects0 <- as.data.frame(VarCorr(Cmodel0_fit))

  # compute ICC between
  CICC_between0 <- CRandomEffects0[1,4]/(CRandomEffects0[1,4]+CRandomEffects0[2,4]) 

  CplotREsim0 <- plotREsim(REsim(Cmodel0_fit))
  
  # model 1: random intercept and slope
  Cmodel1_fit = lmer(ieuc ~ paq_sum_st + (1 + paq_sum_st | pid),
                 data=daily_clean)
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, :
## Model failed to converge with max|grad| = 0.0293982 (tol = 0.002, component 1)
 # Store random effect variances
  CRandomEffects1 <- as.data.frame(VarCorr(Cmodel1_fit))

  # compute ICC between
  CICC_between1 <- CRandomEffects1[1,4]/(CRandomEffects1[1,4]+CRandomEffects1[2,4]) 

  CplotREsim1 <- plotREsim(REsim(Cmodel1_fit))

list(Cmodel0_fit, CRandomEffects0, CICC_between0, CplotREsim0, Cmodel1_fit, CRandomEffects1, CICC_between1, CplotREsim1)   
## [[1]]
## Linear mixed model fit by REML ['lmerModLmerTest']
## Formula: ieuc ~ paq_sum_st + (1 | pid)
##    Data: daily_clean
## REML criterion at convergence: 49869.57
## Random effects:
##  Groups   Name        Std.Dev.
##  pid      (Intercept) 1.056   
##  Residual             1.342   
## Number of obs: 14483, groups:  pid, 49
## Fixed Effects:
## (Intercept)   paq_sum_st  
##      1.1482      -0.1558  
## 
## [[2]]
##        grp        var1 var2     vcov    sdcor
## 1      pid (Intercept) <NA> 1.115145 1.056004
## 2 Residual        <NA> <NA> 1.799810 1.341570
## 
## [[3]]
## [1] 0.3825599
## 
## [[4]]

## 
## [[5]]
## Linear mixed model fit by REML ['lmerModLmerTest']
## Formula: ieuc ~ paq_sum_st + (1 + paq_sum_st | pid)
##    Data: daily_clean
## REML criterion at convergence: 49868.9
## Random effects:
##  Groups   Name        Std.Dev. Corr 
##  pid      (Intercept) 1.35360       
##           paq_sum_st  0.04125  -1.00
##  Residual             1.34157       
## Number of obs: 14483, groups:  pid, 49
## Fixed Effects:
## (Intercept)   paq_sum_st  
##      1.2254      -0.1662  
## optimizer (nloptwrap) convergence code: 0 (OK) ; 0 optimizer warnings; 1 lme4 warnings 
## 
## [[6]]
##        grp        var1       var2         vcov       sdcor
## 1      pid (Intercept)       <NA>  1.832220075  1.35359524
## 2      pid  paq_sum_st       <NA>  0.001701954  0.04125475
## 3      pid (Intercept) paq_sum_st -0.055840221 -0.99996394
## 4 Residual        <NA>       <NA>  1.799812550  1.34157093
## 
## [[7]]
## [1] 0.999072
## 
## [[8]]

Interaction effects

m_emodiff * seuc = dif

inter1 <- lm(difc ~ m_ED*seuc,
             data=daily_clean)

summary(inter1)
## 
## Call:
## lm(formula = difc ~ m_ED * seuc, data = daily_clean)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -3.0886 -1.3465 -0.5555  1.3973  4.9672 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  0.0555055  0.0155746   3.564 0.000366 ***
## m_ED        -0.0091310  0.0032696  -2.793 0.005232 ** 
## seuc        -0.2613076  0.0089019 -29.354  < 2e-16 ***
## m_ED:seuc    0.0003029  0.0017937   0.169 0.865890    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.774 on 17754 degrees of freedom
##   (77 observations deleted due to missingness)
## Multiple R-squared:  0.0609, Adjusted R-squared:  0.06074 
## F-statistic: 383.8 on 3 and 17754 DF,  p-value: < 2.2e-16

m_emodiff * seuc = ddf

inter2 <- lm(ddfc ~ m_ED*seuc,
             data=daily_clean)

summary(inter2)
## 
## Call:
## lm(formula = ddfc ~ m_ED * seuc, data = daily_clean)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2.9424 -1.3119 -0.3162  1.6706  5.0161 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  0.080914   0.015187   5.328 1.01e-07 ***
## m_ED        -0.006283   0.003188  -1.971   0.0488 *  
## seuc        -0.326423   0.008680 -37.605  < 2e-16 ***
## m_ED:seuc   -0.002578   0.001749  -1.474   0.1405    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.73 on 17754 degrees of freedom
##   (77 observations deleted due to missingness)
## Multiple R-squared:  0.09187,    Adjusted R-squared:  0.09172 
## F-statistic: 598.7 on 3 and 17754 DF,  p-value: < 2.2e-16

m_emodiff * ieuc = dif

inter3 <- lm(difc ~ m_ED*ieuc,
             data=daily_clean)

summary(inter3)
## 
## Call:
## lm(formula = difc ~ m_ED * ieuc, data = daily_clean)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -2.423 -1.633 -0.568  1.322  4.569 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  0.055524   0.015917   3.488 0.000487 ***
## m_ED        -0.012011   0.003296  -3.645 0.000268 ***
## ieuc         0.123019   0.009098  13.522  < 2e-16 ***
## m_ED:ieuc    0.002622   0.001818   1.442 0.149255    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.818 on 17737 degrees of freedom
##   (94 observations deleted due to missingness)
## Multiple R-squared:  0.01288,    Adjusted R-squared:  0.01271 
## F-statistic: 77.14 on 3 and 17737 DF,  p-value: < 2.2e-16

m_emodiff * ieuc = ddf

inter4 <- lm(ddfc ~ m_ED*ieuc,
             data=daily_clean)

summary(inter4)
## 
## Call:
## lm(formula = ddfc ~ m_ED * ieuc, data = daily_clean)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -2.528 -1.514 -0.255  1.824  4.204 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  0.085538   0.015729   5.438 5.45e-08 ***
## m_ED        -0.008114   0.003257  -2.492   0.0127 *  
## ieuc         0.152117   0.008990  16.921  < 2e-16 ***
## m_ED:ieuc    0.002142   0.001796   1.193   0.2331    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.796 on 17737 degrees of freedom
##   (94 observations deleted due to missingness)
## Multiple R-squared:  0.01989,    Adjusted R-squared:  0.01973 
## F-statistic:   120 on 3 and 17737 DF,  p-value: < 2.2e-16