# NOT RUN {
set.seed(919)
n <- 200
X <- rbinom(n, 1, 0.5)
Y <- rnorm(n, X, 0.8)
control <- list(iter = 200, warmup = 150, thin = 1)
fit <- SPQR(X = X, Y = Y, method = "MCMC", control = control,
normalize = TRUE, verbose = FALSE)
## compute the estimated PDF of Y conditioned on X = 0
pdf <- predict(fit, type = "PDF", X = 0, Y = seq(0, 1, 0.01))
plot(seq(0, 1, 0.01), pdf, xlab = "Y", ylab = "Density")
# }
Run the code above in your browser using DataLab