[Mediation-information] problem with multimed

Regan Bernhard regan.bernhard at gmail.com
Thu Jan 9 16:43:46 CET 2020


Hello!
I am trying to use multimed but keep getting the following error:

Error: variable 'cong_incong' was fitted with type "factor" but type
"numeric" was supplied

Here is the command I am using:
lab_force.multi_med<-multimed(outcome="force", med.main="norm",
med.alt="value", treat="cong_incong", data=labdata).

force, norm, and value are all continuous numeric variables.

cong_incong has  been made into a factor with two levels using the factor
function and every other function in my script seems to be treating it as a
factor, however, when I check its type using typeof(cong_incong) it tells
me it is an integer.

For what it's worth, I am able to run standard mediations for norm and
value separately with no issues.

I saw that this question came up here once before. The suggestion was to
make sure the treatment was a numeric variable with values 0 and 1. I tried
that and got this error:
In mean.default(data.b[, treat]) : argument is not numeric or logical :
returning NA

Again I used typeof to and the data is of type double.

I'm stumped and would love some suggestions!
Thanks!
Regan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/mediation-information/attachments/20200109/fa6b77b6/attachment.html>


More information about the Mediation-information mailing list