I am having trouble getting the mediation package in R to work with what I am trying to do.
My mediator is continuous and numeric ( range is between 92-430). My predictor is also continuous and ranges from ( 0.2834 to 1) My response/dependent variable which is disease status is binary (0 for control and 1 for disease).
Via the mediation package in R, my treatment would be gene expression levels (predictor). My mediator is diversity. The below doesn't work because either my mediator or predictor needs to be an integer where there are either 0 or 1 values.
model.x <-lm(Diversity ~ Gene, data=df)
model.y <-glm(Disease ~ Diversity + Gene, data=df, family=binomial)
res <- mediate(model.x, model.y, treat="Gene", mediator="Diversity", robustSE=T, sims=100)
I have only seen examples whereby the response is binary and the predictor is also binary. Like in the example documented here https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5124624/. Where they wanted to assess the effect of c-reactive protein (mediator, continous, numeric) on the association between mortality ( response, logical, TRUE/FALSE) and medication (0=not consuming, 1=consuming, integer).
Please could anybody suggest an alternative method that may work? Or suggestions as to how I could change my predictor ( gene expression values) into a binary variable with either 0 or 1 values ( not exactly sure how to arbitrarily set a threshold, whereby values below which are 0 and values above which are 1 without losing the association between this predictor and the response).