| title: “PainAnalyses” |
| author: “Jennie Min” |
| date: “2023-11-30” |
| output: html_document |
Analyses were completed with n=70 with average 17.85 days of responses (range 5-30).
ICC revealed that 58.6% of alcohol
urge variation can be explained between people
vs. 41.5% being explained within people.
ICC revealed that 51.9 of cigarette
urge variation can be explained between people
vs. 48.1% being explained within people.
ICC revealed that 52.7 of cannabis
urge variation can be explained between people
vs. 47.3% being explained within people.
ICC revealed that 65.5 of sweets urge variation can be explained between people vs. 34.5% being explained within people.
These ICCs indicate that running multilevel analyses make sense given the amount of the within-person variation.
alc_pain <- readRDS("alc_pain.rds")
summary(alc_pain)
## Loading required package: lmerTest
## Loading required package: lme4
## Loading required package: Matrix
##
## Attaching package: 'lmerTest'
## The following object is masked from 'package:lme4':
##
## lmer
## The following object is masked from 'package:stats':
##
## step
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: alc_urge_today ~ 1 + paintoday_w + pain_b + (1 + paintoday_w |
## id)
## Data: df
##
## REML criterion at convergence: 4270.4
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.3478 -0.3856 -0.1362 0.2160 5.3161
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## id (Intercept) 1.83866 1.3560
## paintoday_w 0.01436 0.1198 -0.27
## Residual 1.46143 1.2089
## Number of obs: 1250, groups: id, 70
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 1.35399 0.16666 67.08327 8.124 1.43e-11 ***
## paintoday_w -0.03158 0.02564 44.22492 -1.232 0.22458
## pain_b 0.26663 0.08070 66.55897 3.304 0.00154 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) pntdy_
## paintoday_w -0.145
## pain_b -0.040 -0.035
alc_na <- readRDS("alc_na.rds")
summary(alc_na)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: alc_urge_today ~ 1 + na_w + na_b + (1 | id)
## Data: df
##
## REML criterion at convergence: 4126
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.9738 -0.4434 -0.1305 0.2648 4.9499
##
## Random effects:
## Groups Name Variance Std.Dev.
## id (Intercept) 1.413 1.189
## Residual 1.339 1.157
## Number of obs: 1250, groups: id, 70
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 1.432e+00 1.470e-01 6.577e+01 9.740 2.23e-14 ***
## na_w 1.340e-01 1.104e-02 1.182e+03 12.138 < 2e-16 ***
## na_b 2.074e-01 3.554e-02 6.643e+01 5.837 1.74e-07 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) na_w
## na_w 0.000
## na_b 0.068 0.002
alc_na_pain <- readRDS("alc_na_pain_brm.rds")
summary(alc_na_pain)
## Family: gaussian
## Links: mu = identity; sigma = identity
## Formula: alc_urge_today ~ 1 + paintoday_w + na_w + pain_b + na_b + (1 + paintoday_w + na_w | id)
## Data: df (Number of observations: 1250)
## Draws: 2 chains, each with iter = 10000; warmup = 1000; thin = 1;
## total post-warmup draws = 18000
##
## Group-Level Effects:
## ~id (Number of levels: 70)
## Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS
## sd(Intercept) 1.22 0.11 1.02 1.46 1.00 5121
## sd(paintoday_w) 0.15 0.03 0.10 0.21 1.00 7296
## sd(na_w) 0.12 0.02 0.08 0.17 1.00 8329
## cor(Intercept,paintoday_w) -0.12 0.19 -0.48 0.26 1.00 12092
## cor(Intercept,na_w) 0.49 0.13 0.21 0.71 1.00 12038
## cor(paintoday_w,na_w) 0.04 0.24 -0.42 0.52 1.00 4984
## Tail_ESS
## sd(Intercept) 9210
## sd(paintoday_w) 9280
## sd(na_w) 13078
## cor(Intercept,paintoday_w) 13692
## cor(Intercept,na_w) 13830
## cor(paintoday_w,na_w) 8282
##
## Population-Level Effects:
## Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
## Intercept 1.42 0.15 1.12 1.72 1.00 2718 5822
## paintoday_w -0.05 0.03 -0.10 0.01 1.00 15706 14383
## na_w 0.16 0.02 0.12 0.20 1.00 9932 12165
## pain_b 0.11 0.07 -0.04 0.25 1.00 4428 6979
## na_b 0.19 0.04 0.12 0.26 1.00 4014 7640
##
## Family Specific Parameters:
## Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
## sigma 1.08 0.02 1.04 1.13 1.00 21237 13550
##
## Draws were sampled using sampling(NUTS). For each parameter, Bulk_ESS
## and Tail_ESS are effective sample size measures, and Rhat is the potential
## scale reduction factor on split chains (at convergence, Rhat = 1).