Skip to content

Instantly share code, notes, and snippets.

@puterleat
Last active December 23, 2015 10:49
Show Gist options
  • Save puterleat/6624298 to your computer and use it in GitHub Desktop.
Save puterleat/6624298 to your computer and use it in GitHub Desktop.
updated analysis for ipod study
title make
Analysis for ipod craving study
worksheet

Analysis for ipod craving study

Data structure

Craving strength data were structured such that each measurement represented a row in the dataset. For participants in the tetris condition, two measurements were taken after each prompt---before and after the game task. Control participants provided a single measure. Indulgence was also measured at each prompt for both groups,i.e. whether the participant had indulged a craving reported at the previous prompt.

Statistical methods

Craving strength data were analysed by mixed-effects regression, where craving scores were nested within individuals. In our primary analyses of data from the tetris group, fixed effects estimated the difference in craving strength before and after game completion. Secondary analyses i) included random effects for the game completion parameter, ii) explicitly modelled the covariance between the random intercept and this random slope; iii) stratified the effect of game completion as a function of craving type. In a final analysis we used multilevel growth curve models to estimate changes in baseline craving strength during the week as a function of group allocation: We compared craving strength immediately after each prompt between participants in the tetris and control conditions, estimating the effect of group allocation at day 1 and day 7.

Indulgence data---a binary variable indicating whether or not the participant had indulged their last-reported craving---were also analysed by mixed-effects regression, but using a logit-link function. All analyses were conditioned on current alcohol state self reports. Probability of indulgence was modelled as a function of game group assigment and, as before, growth-curve models estimated changes indulgence as a function of group over the week of treatment. For all analyses, marginal means and group-differences were computed using the delta-method; for logit models marginal probabilities were computed from the fixed effects only.

Results

Did playing tetris reduce momentary craving strength?

Multilevel regression of occasions where participants indicated they were craving indicated that game completion reduced craving strength by 12.4 points (95% CI = -20.125 to -4.724; see model 1 output). Followup analyses (see model 2) included a random slope for the effect of game completion, and the covariance of this variation in the treatment effect and participant-level residuals. The fixed effect of game completion was unchanged but we found significant variation in the effect of game completion between individuals (SD=12.516, 95% CI= 7.827 to 20.015) but no relationship between random slopes and intercepts (r=-0.327, 95% CI = -0.752 to 0.290). This indicates that the effect of game completion on craving strength did differ significantly between participants, and this variation is unlikely to be due to floor-effects whereby participants, whereby those with low mean craving strength experience diminishing returns from the intervention.

cap: use for_analysis.dta
keep if wasnt_craving==0 & started_extra_craving==0
xtmixed strength_ i.after if tetris==1   || person: ,
cap: use for_analysis.dta
keep if wasnt_craving==0 & started_extra_craving==0
xtmixed strength_ i.after if tetris==1  || person: after , cov(uns)

\clearpage

Did playing tetris reduce the propensity to indulge cravings?

Multilevel logistic regression (see model 3) did not indicate that those in the teris group craved less often than those in the control group. However current alcohol state was a significant risk for increased indulgence in this analysis (OR=3.260, 95% CI = 1.242 to 8.553).

cap: use for_analysis.dta
xtmelogit indulgednextime i.tetris alcohol || person: , or
margins, dydx(tetris) predict(mu fixedonly)
margins tetris,  predict(mu fixedonly)

\clearpage

Was completing the game equally effective at reducing all craving types?

Adding indicators for which type of craving the participant was experiencing on each occasion to model one brought only a marginal improvement in model fit ($\chi^2(2) = 5.53$, $p = 0.0631$), but a post-hoc comparison indicated that cravings for addictive substances (nicotine, alcohol, caffeine) were reported as significantly stronger than cravings for food or drink ($\delta=6.245$, $p = 0.039$); however addictive cravings were stronger than cravings for the 'other' category ($\delta=0.650$, $p = 0.864$).

Interacting craving type with the indicator for game completion did not sifgnificantly improve the model, $\chi^2(4)=6.51$, $p = 0.1642$, indicating that the effect of game completion did not differ between cravings for addictive substances, food and drink, or other cravings (e.g. sex or exercise).

cap: use for_analysis.dta
cap: keep if wasnt_craving==0 & started_extra_craving==0
cap: keep if tetris == 1
* run a baseline model and store the estimates
xtmixed strength_  i.after  || person: ,
est store base

* add the main effect
xtmixed strength_  i.after i.cravingcats  || person: ,
est store maineffect
* run the pairwise comparisons of interest
contrast r.cravingcats
contrast a.cravingcats

* add the interaction and store again
xtmixed strength_  i.after##i.cravingcats  || person: ,
est store inter

* run the likelihood ratio tests to check for changes in model fit
lrtest base maineffect
lrtest base inter
lrtest maineffect inter

\clearpage

Did playing tetris reduce pre-game craving strength during the week of treatment?

Selecting only initial observations from each measurment occasion, for participants in both the tetris and control group, we compared strength of cravings across the week between groups. Results are plotted in Figure \ref{effectoftetrisonbaselinecravingsbyday}, and indicate that the groups did not differ in the strength of their initial craving ratings across the week.

Changes in strength of initial craving ratings across the study week, by group.\label{effectoftetrisonbaselinecravingsbyday}

cap: use for_analysis.dta, replace
keep if after == 0
xtmixed strength_  i.tetris i.day  || person: ,
est store maineffect
xtmixed strength_  i.tetris##i.day  || person: ,
lrtest maineffect .
margins day#tetris
marginsplot
graph export effectoftetrisonbaselinecravingsbyday.eps, replace
* we don't see an improvement adding categorical interactions

\clearpage

Did the of the effect of game completion remain constant across the week of treatment?

Yes, although the SE for the estimate on day 7 was larger and the treatment efect failed to reach significance on this day; see Figure \ref{effectofgamecompletionacrosstheweek}.

Effect of game completion across the week.\label{effectofgamecompletionacrosstheweek}

cap: use for_analysis.dta, replace
cap: keep if wasnt_craving==0 & started_extra_craving==0
keep if tetris == 1
xtmixed strength_  i.after i.day  || person: ,
est store maineffect
xtmixed strength_  i.after##i.day  || person: ,
lrtest maineffect .

margins day, dydx(after)
marginsplot, yline(0)
graph export effectofgamecompletionacrosstheweek.eps, replace
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment