I want to use brms package to perform the structural equation model.
The generic model code used was:
a_mod<-bf(a~b+c+d+e+f+g)
b_mod<-bf(b~c+d+e)
c_mod<-bf(c~d)
I want to add the correlation between g and c (g~~c).
- When I add the reference in set_rescor(TRUE) in brms, like this,
mod1<-brms(a_mod+ b_mod+ c_mod+set_rescor(T))
I can get residual correlation among all endogenous variables, not the correlation between g and c. And the residual correlation and the correlation are not same, right?
- When I use the code,
mod2<-brms(bf(mdbing(g,c)~0+ a_mod+ b_mod +c_mod+ set_rescor(TRUE)))
It reminds me:
error: Don’t know how to add a mvbrmsformulabform object without the response variable name. See help(‘brmsformula-helpers’) for more details.
Is there a way to obtain the correlation between a specified endogenous variable and exogenous variable (i.e., the correlation between g and c ) OR specified endogenous variables ( i.e., the correlation between a and b )?