Created
November 18, 2015 21:43
-
-
Save puterleat/2f831bd499cb8ad7f26f to your computer and use it in GitHub Desktop.
This file contains 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 | |
gen d0 = rnormal(0,1) | |
* generate probability of relapse note - no interaction term here | |
gen p = max(min(.5*d0 + .3*mbct, .99), 0.01) | |
gen y = rbinomial(1,p) | |
summ y | |
* ns interaction term in the logistic regression | |
logistic y mbct##c.d0 | |
* but get ES estimates in probability domainfo 1 SD above and below mean baseline | |
margins, dydx(mbct) at(d0=(-1(1)1)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment