How to do moderation / mediation anaylsis in a binary logistic regression? For my master thesis, I am trying to find a way to test my moderation and mediation but it is getting to complex and I have not found anything adequate yet.
During my study, I would like to address the following research questions:

*

*What is the impact of perceived control over own body shape (body mobility) on self-control in terms of healthy food consumption?

*To what extent is perceived control over own body shape (body mobility) related to self-control in terms of healthy food consumption and is this relation moderated by the level of consumer’s self-esteem?

*Is the relation between perceived control over own body shape (body mobility) and self-control in terms of healthy food consumption mediated by goal attainability?

These are my variables in the study:

*

*My independent variable is "Perception of Body mobility" and is
categorical (Either High or low body mobility condition)


*The dependent variable is "Self-control" which is dichotomous (Either
healthy food choice or unhealthy food choice).


*The moderator I choose is "Self-Esteem" and it was measured on a
likert scale so it is continuous.


*My mediator is "Goal attainability" and is also continuous and
is measured on a likert scale.
For my main effect I have decided to use a binary logistic regression as I have a dichotomous dependent variable.
But I am struggling to find a way to test my moderation and mediation which are both continuous variables.
What would the easiest way to do so?
Thanks a lot in advance.
 A: There's no fundamental problem here. It's simplest to explain for the moderator, which is equivalent to an interaction term between predictors in a regression. The interaction coefficient between a dichotomous IV and a continuous moderator will estimate how much the association of the IV with outcome changes as the value of the continuous moderator changes. With a dichotomous outcome and logistic regression that interaction coefficient will just be in a log-odds scale.
For mediation, you need to have a model of the association of the mediator with the IV as well as models of associations with outcome. With a continuous mediator and a dichotomous IV, the association of the mediator with the IV is equivalent to a t-test. The uncertainty in the estimation of the mediator given the value of the IV will be taken into account in the full model. Standard methods for evaluating mediation and moderation, like the mediation package in R, should be able to do what you need.
That said, do think about how you are modeling your moderator and mediator. Although a true Likert scale based  on multiple Likert items can have enough levels to be considered continuous, even a truly continuous predictor might not have a strictly linear association with log-odds in logistic regression. It's often good to model continuous predictors flexibly, as with regression splines.
If your Likert-scale variables have only a few levels, you might be better off modeling them as ordered categorical predictors instead of as continuous. Otherwise you are assuming that each step up in the Likert scale has the same change in association with outcome, which might be a risky assumption.
