context("Testing reference based continuous outcome imputation") expit <- function(x) { exp(x)/(1+exp(x)) } test_that("Monotone missingness MAR imputation with M=2 runs", { expect_error({ set.seed(1234) n <- 500 #we will make correlation with baseline the same to visit 1 and visit 2 corr <- matrix(1, nrow=4, ncol=4) + diag(0.5, nrow=4) corr data <- MASS::mvrnorm(n, mu=c(0,0,0,0), Sigma=corr) trt <- 1*(runif(n)<0.5) y0 <- data[,1] y1 <- data[,2] y2 <- data[,3] y3 <- data[,4] #add in effect of treatment y1 <- y1+trt*0.5 y2 <- y2+trt*1 y3 <- y3+trt*1.5 #now make some patients dropout before visit 1 #r1=1 indicates visit 1 observed r1 <- 1*(runif(n)