Skip to content

Instantly share code, notes, and snippets.

View benwhalley's full-sized avatar

Ben Whalley benwhalley

  • Plymouth University
View GitHub Profile

Keybase proof

I hereby claim:

  • I am benwhalley on github.
  • I am benwhalley (https://keybase.io/benwhalley) on keybase.
  • I have a public key ASC19V1R0DG97deKeZwym3XYq0JBGYGSL4qscFyPL_bqXgo

To claim this, I am signing this object:

https://www.dropbox.com/s/76vg2ortmid2x6t/Session5.pptx?dl=0
https://www.dropbox.com/s/76vg2ortmid2x6t/Session5.pptx?dl=0
https://psy379-placebo.s3.amazonaws.com/index.html
https://transfer.sh/adEXM/6-sem.pdf
https://transfer.sh/FObPj/6-sem-extra.pdf
https://transfer.sh/B9DqM/5-cfa-part-2.pdf
require('dplyr')
require('rethinking')
dmode <- function(x) {
den <- density(x, kernel=c("gaussian"))
( den$x[den$y==max(den$y)] )
}
meanhpdi <- function(x, prob=.95) {
i <- rethinking::HPDI(x, prob=prob)
-----------------------------------------------------------------------------------------------------------
Participant BlockNo CueOrder Congruent auc auc.positive log.auc log.auc.positive Trial
------------- --------- ---------- ----------- -------- -------------- --------- ------------------ -------
1 1 1 FALSE 0 0 0 0 1
1 1 2 TRUE 0 0 0 0 2
1 1 3 FALSE 0 0 0 0 3
f.10 <- log.auc.positive ~ log(CueOrder)*Congruent + (1|Participant) + (0+log(CueOrder)*Congruent|Participant)
fit.10.stan <- stan_lmer(f.10, data=dftouse, iter=5000, chains=3)
summary(fit.10.stan)
fit.10.stan.preds <- posterior_linpred(fit.10.stan,
transform=F,
re.form=NA) %>%
| predictor| mediator| outcome|
|----------:|----------:|----------:|
| -1.2070657| -0.1890093| -0.9108483|
| 0.2774292| -0.3360039| 0.6381942|
| 1.0844412| 0.6082141| 1.8781692|
| -2.3456977| -1.6753266| -3.3202908|
| 0.4291247| -0.6114362| 0.1293695|
| 0.5060559| 0.4200172| 1.6865355|
| -0.5747400| -1.1836346| 0.0840891|
| -0.5466319| -0.1051305| 0.4606004|
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
| predictor| mediator| outcome|
|----------:|----------:|----------:|
| -1.2070657| -0.1890093| -0.9108483|
| 0.2774292| -0.3360039| 0.6381942|
| 1.0844412| 0.6082141| 1.8781692|
| -2.3456977| -1.6753266| -3.3202908|
| 0.4291247| -0.6114362| 0.1293695|
| 0.5060559| 0.4200172| 1.6865355|
| -0.5747400| -1.1836346| 0.0840891|
| -0.5466319| -0.1051305| 0.4606004|