Covariance structures in brms?

Hello,

I am trying to estimate one Bayesian mixed effect model using ‘brms’ in R.

I am able to estimate a non-Bayesian version of my model using “lme”,
Here is part of code for this model (basically, I am trying to estimate one spline model using mixed effect models framework):

K.firm <- max(5,min(floor(length(unique(time))/4),40))
knots.firm <- quantile(unique(time),seq(0,1,length=K.firm+2)
)[-c(1,K.firm+2)]
Z.firm <- outer(time,knots.firm,"-")
Z.firm <- Z.firm*(Z.firm>0)


Z.block<-list(list(firm=pdSymm(~time)),
list(firm=pdIdent(~Z.firm-1)))
Z.block<-unlist(Z.block,recursive=FALSE)
data.fr <- groupedData( Y ~ X[,-1] |rep(1,length=length(Y)),
data = data.frame(Y,X,Z,Z.firm,firm))
fit <- lme(Y~-1+X[,-1],data=data.fr,random=Z.block)

As you see, in ‘lme’ we can use pdSym to make a positive definite symmetric matrix for part of covariance matrix of random effects. My understanding is that by using the following code and using ‘brms’:

brm1<-brm(Y~x1+x2 + (1+time|firm),data=data)

We impose (pdSym) positive definite symmetric condition on the covariance matrix of random intercept and random slope, subject to firm.

Now assume, we need to impose positive definite identical condition on some part of Z matrix (as we do using pdIdent in ‘lme’).

I was wondering if could anyone tell if it is possible to do the same thing in ‘brms’?

Many thanks,

P.S. In the link below Ben Bolker proposed some hacking covariance structures for ‘lmer’.

https://bbolker.github.io/mixedmodels-misc/notes/varmats.html

I am trying to find a way doing the same but using ‘brms’.