Hello,
I am running longitudinal analyses on a time-varying ordinal outcome with time-varying ordinal predictors.
Description:
1-In univariate analyses there was not much difference in LOO between polynomial monotonic variables, therefore, for simplicity, I keep the predictor as a polynomial.
2-I use time and id as levels.
My question is about how to write “lkj” prior and I am not sure if my model as shown below is correct.
-Thanks
pbmulti1<-get_prior (rec_n_r_bodn ~ rec_comb_sevchf+rec_comb_sevhid+rec_comb_sevhypertension+rec_comb_sevarrythmia+rec_sevhyperlipid+rec_comb_sevpad+rec_comb_sevstroke+rec_comb_sevckd+rec_comb_sevdm+rec_comb_sevgi+rec_comb_sevcopd+rec_asthma+comb_plt+rec_comb_cancer+comb_hyperth+rec_comb_sevhypoth+rec_comb_sevanemia+rec_comb_sevoral+rec_comb_sevjd+rec_comb_sevosteoporosis+rec_sevhearing+rec_comb_seveye+ rec_comb_sevdepression+ rec_comb_sevparkinson+rec_comb_sevci+(1+rec_comb_sevchf+rec_comb_sevhid+rec_comb_sevhypertension+rec_comb_sevarrythmia+rec_sevhyperlipid+rec_comb_sevpad+rec_comb_sevstroke+rec_comb_sevckd+rec_comb_sevdm+rec_comb_sevgi+rec_comb_sevcopd+rec_asthma+comb_plt+rec_comb_cancer+
comb_hyperth+rec_comb_sevhypoth+rec_comb_sevanemia+rec_comb_sevoral+rec_comb_sevjd+rec_comb_sevosteoporosis+rec_sevhearing+rec_comb_seveye+ rec_comb_sevdepression+ rec_comb_sevparkinson+rec_comb_sevci|new_time)+(1+rec_comb_sevchf+rec_comb_sevhid+rec_comb_sevhypertension+rec_comb_sevarrythmia+rec_sevhyperlipid+rec_comb_sevpad+rec_comb_sevstroke+rec_comb_sevckd+rec_comb_sevdm+rec_comb_sevgi+rec_comb_sevcopd+rec_asthma+comb_plt+rec_comb_cancer+
comb_hyperth+rec_comb_sevhypoth+rec_comb_sevanemia+rec_comb_sevoral+rec_comb_sevjd+rec_comb_sevosteoporosis+rec_sevhearing+rec_comb_seveye+ rec_comb_sevdepression+ rec_comb_sevparkinson+rec_comb_sevci|idno),family=cumulative(),data =bodn_long)
pbmulti1$prior[1]<-"normal(0,1)" #beta
pbmulti1$prior[27]<-"normal(0,10)" #intercept cut-point
pbmulti1$prior[30]<-"cholesky(10)" #new_time
pbmulti1$prior[45]<-"normal(0,2.5)" #sd
fit_bmulti1<-brm(
formula =rec_n_r_bodn ~ rec_comb_sevchf+rec_comb_sevhid+rec_comb_sevhypertension+rec_comb_sevarrythmia+rec_sevhyperlipid+rec_comb_sevpad+rec_comb_sevstroke+rec_comb_sevckd+rec_comb_sevdm+rec_comb_sevgi+rec_comb_sevcopd+rec_asthma+comb_plt+rec_comb_cancer+
comb_hyperth+rec_comb_sevhypoth+rec_comb_sevanemia+rec_comb_sevoral+rec_comb_sevjd+rec_comb_sevosteoporosis+rec_sevhearing+rec_comb_seveye+ rec_comb_sevdepression+ rec_comb_sevparkinson+rec_comb_sevci+(1+rec_comb_sevchf+rec_comb_sevhid+rec_comb_sevhypertension+rec_comb_sevarrythmia+rec_sevhyperlipid+rec_comb_sevpad+rec_comb_sevstroke+rec_comb_sevckd+rec_comb_sevdm+rec_comb_sevgi+rec_comb_sevcopd+rec_asthma+comb_plt+rec_comb_cancer+
comb_hyperth+rec_comb_sevhypoth+rec_comb_sevanemia+rec_comb_sevoral+rec_comb_sevjd+rec_comb_sevosteoporosis+rec_sevhearing+rec_comb_seveye+ rec_comb_sevdepression+ rec_comb_sevparkinson+rec_comb_sevci|new_time)+(1+rec_comb_sevchf+rec_comb_sevhid+rec_comb_sevhypertension+rec_comb_sevarrythmia+rec_sevhyperlipid+rec_comb_sevpad+rec_comb_sevstroke+rec_comb_sevckd+rec_comb_sevdm+rec_comb_sevgi+rec_comb_sevcopd+rec_asthma+comb_plt+rec_comb_cancer+
comb_hyperth+rec_comb_sevhypoth+rec_comb_sevanemia+rec_comb_sevoral+rec_comb_sevjd+rec_comb_sevosteoporosis+rec_sevhearing+rec_comb_seveye+ rec_comb_sevdepression+ rec_comb_sevparkinson+rec_comb_sevci|idno),family=cumulative(),data =bodn_long,prior=pbmulti1,chains=5,control=list(adapt_delta=0.99,max_treedepth=5),cores=future::availableCores())