Nothing
## ----include=FALSE------------------------------------------------------------
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
## ----setup--------------------------------------------------------------------
library(OneSampleMR)
## -----------------------------------------------------------------------------
set.seed(12345)
n <- 5000
psi0 <- 0.5
psi1 <- 0.2
Z <- rbinom(n, 1, 0.5)
X <- rbinom(n, 1, 0.7*Z + 0.2*(1 - Z))
m0 <- plogis(1 + 0.8*X - 0.39*Z)
Y <- rbinom(n, 1, plogis(psi0*X + log(m0/(1 - m0))))
dat <- data.frame(Z, X, Y)
## -----------------------------------------------------------------------------
fit02 <- msmm(Y ~ X | Z, data = dat)
summary(fit02)
## -----------------------------------------------------------------------------
fit03 <- msmm(Y ~ X | Z, data = dat, estmethod = "gmmalt")
summary(fit03)
## -----------------------------------------------------------------------------
fit04 <- msmm(Y ~ X | Z, data = dat, estmethod = "tsls")
summary(fit04)
## -----------------------------------------------------------------------------
fit05 <- msmm(Y ~ X | Z, data = dat, estmethod = "tslsalt")
summary(fit05)
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.