This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mysim <- function(){ | |
| des <- expand.grid( | |
| congruence=c(1,0), | |
| cuedresp=c("L", "R", "None"), | |
| trial=1:5, | |
| block=1:10, | |
| participant=1:20 | |
| ) | |
| samp <- des %>% rowwise() %>% mutate(y=rbinom(1,1,.03*congruence)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // simulated data | |
| // y = depression, t=timepoint (1 to 3), therapist=therapistcluster, id=patient | |
| // 3 level model: observations nested in people in therapists | |
| mixed y t || therapist: t, nocons || id:, stddev | |
| // same model (???) using stata bayesian model fit | |
| bayesmh y i.id i.therapist i.therapist#c.t, likelihood(normal({var_residual})) noconstant /// | |
| prior({y:_cons}, normal(0,100)) /// | |
| prior({var_therapist}, igamma(.001, .001)) /// |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| participant__username | N | |
| ----------------------+---------- | |
| Alex_Fowke | 5 | |
| Carolyn_Hinds | 3 | |
| Donna_Rutherford | 4 | |
| Ellie_Campbell | 3 | |
| Hannah_Wilson | 0 | |
| Laura_Brummer | 5 | |
| Sandy_Waite | 5 | |
| Sara_Clark | 5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| clear all | |
| set seed 123 | |
| * recruit subjects (if only this easy...) | |
| set obs 2000 | |
| * assign to groups | |
| gen mbct = mod(_n, 2) | |
| * depression baseline score |
NewerOlder