if (FALSE) {
# Example with data from Riksstroke (the Swedish stroke register)
data(RSdata)
# Probit mediator and outcome models:
m.model <- glm(lowered.consc ~ AF + age.cat + sex, data = RSdata,
family = binomial(link = 'probit'))
o.model <- glm(cf.3mo ~ AF + lowered.consc + age.cat + sex, data = RSdata,
family = binomial(link = 'probit'))
# Estimation of regression coefficients under different values of Rho
# Rho = correlation between error terms in mediator and outcome model:
coefs.MY <- coefs.sensmed(model.expl = m.model, model.resp = o.model, Rho = seq(0, 0.5, 0.1))
# Outcome model regression coefficients:
coefs.MY$coef
}
Run the code above in your browser using DataLab