Dear Stata experts,

I'm trying to fit a random slope model for longitudinal dataset. My dependent variable is continous variable and my independent variable was continous but I've converted into tertiles. I need a random slope for each tertile. Also, I've a time variable to adjust for which is continous as well. When I prefix R for the Y variable in random slope part, it doesn't run appropriately. Can you pleaes guide on how to get a slope for each tertiles? Also, I need to add in interaction between time and Y varible (tertile).

Thank you!

Here's my code: [mixed X i.Y time || ptid: R.Y]