I am trying to run a multilevel mediation model in lavaan with a categorical independent variable, but am running into convergence issues. There are three dummy-coded independent variables (d1, d2, d3), one continuous mediator (admiration), and one continuous dependent variable (activefac). Observations are clustered within participants.
Warning messages:
1: In lav_data_full(data = data, group = group, cluster = cluster, :
lavaan WARNING:
Level-1 variable “activefac” has no variance within some clusters.
The cluster ids with zero within variance are: 102 123 160 166
2: In lav_data_full(data = data, group = group, cluster = cluster, :
lavaan WARNING:
Level-1 variable “admiration” has no variance within some
clusters. The cluster ids with zero within variance are: 2 5 6 7
18 32 37 38 45 57 59 61 63 64 66 67 70 76 93 97 98 108 129 134 145
162 163 166 167 168 169 170 173 174 176 35
3: In lav_data_full(data = data, group = group, cluster = cluster, :
lavaan WARNING:
Level-1 variable “d1” has no variance within some clusters. The
cluster ids with zero within variance are: 101
4: In lav_data_full(data = data, group = group, cluster = cluster, :
lavaan WARNING:
Level-1 variable “d2” has no variance within some clusters. The
cluster ids with zero within variance are: 85 88 94 117 141 148
179 65 101
5: In lav_data_full(data = data, group = group, cluster = cluster, :
lavaan WARNING:
Level-1 variable “d3” has no variance within some clusters. The
cluster ids with zero within variance are: 123 35 101
6: In lavaan::lavaan(model = mediation1, data = datalong, cluster = "participantID", :
lavaan WARNING:
the optimizer warns that a solution has NOT been found!
7: In lavaan::lavaan(model = mediation1, data = datalong, cluster = "participantID", :
lavaan WARNING: estimation of the baseline model failed.