This is R code for simulations in the paper: Tianchen Qian, Predrag Klasnja, Susan A. Murphy. Linear mixed models under endogeneity: modeling sequential treatment effects with application to a mobile health study.
Please refer to simulation.R for the simulation code.