Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

appendix parallel process: add brms and correlations #15

Open
m-clark opened this issue May 19, 2020 · 0 comments
Open

appendix parallel process: add brms and correlations #15

m-clark opened this issue May 19, 2020 · 0 comments

Comments

@m-clark
Copy link
Owner

m-clark commented May 19, 2020

The parallel process depiction leaves out intercept/slope correlations that would probably be included in models. Also would be good to show the equivalence as multivariate random effect model via brms.

For example, update the main model as:

mainModel = "
i1 =~ 1*y11 + 1*y12 + 1*y13 + 1*y14
s1 =~ 0*y11 + 1*y12 + 2*y13 + 3*y14


i2 =~ 1*y21 + 1*y22 + 1*y23 + 1*y24
s2 =~ 0*y21 + 1*y22 + 2*y23 + 3*y24

s1 ~ i2
s2 ~ i1

i1 ~~ s1
i2 ~~ s2
"

And for brms

library(tidyverse)

library(brms)

head(d2)
d = left_join(d1, d2)

form = bf(y1 ~ time + (1 + time | p | Subject)) +
  bf(y2 ~ time + (1 + time | p | Subject))

mod = brm(form, data = d, cores=4)      

summary(mod)

For identity you will have to fix variances in lavaan or model sigma by time for brms.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant