if (FALSE) {
# Note: In the following examples, M1, M2, and M3 are true mediators.
# Example 1 (continuous outcome - linear HIMA):
head(ContinuousOutcome$PhenoData)
e1 <- hima(Outcome ~ Treatment + Sex + Age,
data.pheno = ContinuousOutcome$PhenoData,
data.M = ContinuousOutcome$Mediator,
mediator.type = "gaussian",
penalty = "MCP", # Can be "DBlasso" for hima_dblasso
scale = FALSE
) # Disabled only for simulation data
summary(e1)
# Efficient HIMA (only applicable to mediators and outcomes that are
# both continuous and normally distributed.)
e1e <- hima(Outcome ~ Treatment + Sex + Age,
data.pheno = ContinuousOutcome$PhenoData,
data.M = ContinuousOutcome$Mediator,
mediator.type = "gaussian",
efficient = TRUE,
penalty = "MCP", # Efficient HIMA does not support DBlasso
scale = FALSE
) # Disabled only for simulation data
summary(e1e)
# Example 2 (binary outcome - logistic HIMA):
head(BinaryOutcome$PhenoData)
e2 <- hima(Disease ~ Treatment + Sex + Age,
data.pheno = BinaryOutcome$PhenoData,
data.M = BinaryOutcome$Mediator,
mediator.type = "gaussian",
penalty = "MCP",
scale = FALSE
) # Disabled only for simulation data
summary(e2)
# Example 3 (time-to-event outcome - survival HIMA):
head(SurvivalData$PhenoData)
e3 <- hima(Surv(Time, Status) ~ Treatment + Sex + Age,
data.pheno = SurvivalData$PhenoData,
data.M = SurvivalData$Mediator,
mediator.type = "gaussian",
penalty = "DBlasso",
scale = FALSE
) # Disabled only for simulation data
summary(e3)
# Example 4 (compositional data as mediator, e.g., microbiome):
head(MicrobiomeData$PhenoData)
e4 <- hima(Outcome ~ Treatment + Sex + Age,
data.pheno = MicrobiomeData$PhenoData,
data.M = MicrobiomeData$Mediator,
mediator.type = "compositional",
penalty = "DBlasso"
) # Scaling is always enabled internally for hima_microbiome
summary(e4)
#' # Example 5 (quantile mediation anlaysis - quantile HIMA):
head(QuantileData$PhenoData)
# Note that the function will prompt input for quantile level.
e5 <- hima(Outcome ~ Treatment + Sex + Age,
data.pheno = QuantileData$PhenoData,
data.M = QuantileData$Mediator,
mediator.type = "gaussian",
quantile = TRUE,
penalty = "MCP", # Quantile HIMA does not support DBlasso
scale = FALSE, # Disabled only for simulation data
tau = c(0.3, 0.5, 0.7)
) # Specify multiple quantile level
summary(e5)
}
Run the code above in your browser using DataLab