For my master thesis is am looking at mediation btw greenspaces/Physical activity and wellbeing, this is a bit wordy but this is just to give you an idea.
In my model i have 1 predicator separated into 2 dummy variables(coded with 1 and 0), one mediator (physical activity - numerical variable) and one dependent variable for the wellbeing (numerical).
In addition i have 4 covariates, age/gender/health condition/ employement (this last one is also seprated into 2 dummy variable)
i tested my model first with the lm() function from the simpleboot package.
But i wanted to confirm and do the sobel test using the function bmem.sobel() from the bmem package.
i followed these steps :
to precise pa3 is the mediator ;
w3.subjective.wellbeing is my dependent variable (outcome) ;
and GS_5_to_10, GS_10_more are my dummy variables for the independent variable.
the rest are my covariates.
working dataset is my dataset containing my variables.
library(bmem) library(sem) med.model <- specifyEquations(exog.variances = T) ## to precise the model to work with 1: w3.subjective.wellbeing = b*pa3 + cp1*GS_5_to_10 + cp2*GS_10_more + Age_18to60 + Condition + Employed + part.time+ Gender 2: pa3 = a1*GS_5_to_10 + a2*GS_10_more + Age_18to60 + Condition + Employed + part.time+ Gender effects <- c('a1*b', 'cp1 + a1*b', 'a2*b', 'cp2+a2*b') med.res<- bmem.sobel(working_dataset,med.model, effects)
When i try to use the bmem.sobel i get the following message:
Error in summary.objectiveML(sem.object) :
coefficient covariances cannot be computed
My guess is it doesn't like the 2 dummy variables for my independent variable but i don't know how i should introduce it for it to be ok
if anyone as an idea ?