# How to generate data with prespecified autocorrelation and random crosscorrelation in a growth model?

I would like to simulate data from an unconditional growth model with one fixed (level 2) covariate $$x_{i}$$, cross-correlation $$\rho_c$$ and autocorrelation $$\rho_a$$.

The model should have a random intercept $$\beta_{0i}$$ with fixed effect $$\beta_{0}$$ and variance $$u_{0i} \sim N(0,U_{0})$$ and a random slope $$\beta_{1i}$$ with variance $$u_{1i} \sim N(0,U_{1})$$. The value of the fixed effect ($$\beta_{1}$$) should follow from $$\rho_{c}$$. Hence, the model is: $$y_{it} = \beta_{0} + u_{0i} + (\beta_{1i} + u_{1i}) x_{i} + e_{it}$$

I tried to simulate via time-series data (following this answer), which controls the auto- and cross-correlations pretty well for the fixed effect of the correlation. However, given that I have random slopes, I have to sample such time series data with a random cross-correlation coefficient, which I call $$\rho_{ci} = \rho_{c} + u_{ri}$$.

Given random slope variance $$U_1$$ and autocorrelation $$\rho_{a}$$, is there a way to simulate data from a growth model with random cross-correlation $$\rho_{ci}$$? And how do I find the true value of fixed $$\beta_{1}$$? Or is there a way to transform a sample of random slopes $$\beta_{1i} \sim N(\beta_{1}, U_{1})$$ to a sample of $$\rho_{ci}$$ with the correct variance of $$\rho_{c}$$? Alternatively, can I sample directly from some distribution $$\rho_{ci}$$ with mean $$\rho_{c}$$ and variance $$U_{c}$$? If so, how do I find $$U_{c}$$ given $$U_{1}$$ and what should the distributional form be?

To add: I should be able to find the unbiased fixed and random effects via a linear mixed effects model (via lmer() in the lme4-package for example).