Hello,

I am running a mediation model using the r mediation package, but I am not getting the correct output for my variable types. I have a continuous predictor, but the output is treating my predictor as a categorical variable.

In short:

**Predictor** = cognitive test score [Composite_Z] (continuous)

**Mediator** = self-awareness [Awareness] (dichotomous; variable type = numerical in order to run mediation)

**Outcome** = driving frequency [DRFRQ] (dichotomous)

**10 Covariates** = Age (continuous), Sex (dichotomous), Race (dichotomous), Education (dichotomous), Severity (continuous), Time (continuous), Seizures (dichotomous), Income (ordinal), Motor (continuous), UrbanRural (ordinal)

I have two models that are going into my mediation analysis (both of these run fine without issues)--

* Model #1* : binary logistic regression examining the relationship between cognition (predictor) and self-awareness, while accounting for the covariates.

*R code:*

```
fit.a.A3H1 <- glm(Awareness ~ Composite_Z + Age + Sex + Race +
Education + Severity + Time + Seizures + Income + Motor
+ UrbanRural, family=binomial(link="logit"), data=A3H1.df)
```

* Model #2* : binary logistic regression examining the relationship between cognition (predictor) and driving frequency (outcome), while accounting for self-awareness (mediator) and the covariates.

*R code:*

```
fit.total.A3H1 <- glm(DRFRQ ~ Composite_Z + Awareness + Age + Sex
+ Race + Education + Severity + Time + Seizures + Income
+ Motor + UrbanRural, family=binomial(link="logit"), data = A3H1.df)
```

* Mediation model* : Then, I put those models (outlined above) into my mediation analysis. I am using the R

*mediation*package to run the analysis.

*R code:*

```
fitMed.A3H1 <- mediate(fit.a.A3H1, fit.total.A3H1, sims=1000, boot=FALSE,
treat="Composite_Z", mediator="Awareness",
covariates = NULL, use_speed = FALSE)
```

*Output:*

```
Causal Mediation Analysis
Quasi-Bayesian Confidence Intervals
Estimate 95% CI Lower 95% CI Upper p-value
ACME (control) -0.001007 -0.004191 0.00 0.27
ACME (treated) -0.000686 -0.002933 0.00 0.27
ADE (control) 0.031882 0.003696 0.06 0.03 *
ADE (treated) 0.032203 0.003727 0.06 0.03 *
Total Effect 0.031196 0.004744 0.05 0.03 *
Prop. Mediated (control) -0.024010 -0.134304 0.08 0.25
Prop. Mediated (treated) -0.016399 -0.113058 0.07 0.25
ACME (average) -0.000846 -0.003507 0.00 0.27
ADE (average) 0.032042 0.003711 0.06 0.03 *
Prop. Mediated (average) -0.020204 -0.124782 0.08 0.25
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Sample Size Used: 350
Simulations: 1000
```

The output gives the results in groups, even though my predictor is a continuous variable. **Does anyone know why I'm running into this problem and ways I could fix it?** Any suggestions would be greatly appreciated!

What's also strange is that I do not have this problem when I run a separate mediation analysis with the same predictor/mediator/covariates (but a different outcome variable that is continuous instead of dichotomous). This separate mediation analysis is made up of a (1) binary logistic regression model and (2) linear regression model, and the output shows only the overall ACME/ADE/etc (i.e., there are not groups).