if (FALSE) {
# Note: In the following examples, M1, M2, and M3 are true mediators.
data(himaDat)
# When Y is continuous and normally distributed
# Example 1 (continuous outcome):
head(himaDat$Example1$PhenoData)
hima.fit <- hima(X = himaDat$Example1$PhenoData$Treatment,
Y = himaDat$Example1$PhenoData$Outcome,
M = himaDat$Example1$Mediator,
COV.XM = himaDat$Example1$PhenoData[, c("Sex", "Age")],
Y.family = 'gaussian',
scale = FALSE, # Disabled only for simulation data
verbose = TRUE)
hima.fit
# When Y is binary (should specify Y.family)
# Example 2 (binary outcome):
head(himaDat$Example2$PhenoData)
hima.logistic.fit <- hima(X = himaDat$Example2$PhenoData$Treatment,
Y = himaDat$Example2$PhenoData$Disease,
M = himaDat$Example2$Mediator,
COV.XM = himaDat$Example2$PhenoData[, c("Sex", "Age")],
Y.family = 'binomial',
scale = FALSE, # Disabled only for simulation data
verbose = TRUE)
hima.logistic.fit
}
Run the code above in your browser using DataLab