clear set obs 50 generate zi = rnormal(0,2) // this is a random intercept generate zs = rnormal() // this is a random slope generate id = _n expand 5 generate res = rnormal() // residual generate x = runiform(-5,5) generate y = 3 + 2*x + zi + zs*x + res // Here, y=3+2*x is the fixed effect, // y = zi + zx*x are random effects, // and y = res is the residual/error term. // In total we have y = fixed + random + residual. regress y x estimates store under mixed y x || id: estimates store rint mixed y x || id: x estimates store rslope estimates table under rint rslope, stats(ll) lrtest rslope rint mixed y x || id: x, cov(uns) lrtest . rslope summarize x display _b[_cons] + _b[x]*r(mean) display _b[x]*r(sd) display (_se[x]*r(sd)) egen xstd = std(x) mixed y xstd || id: xstd, cov(uns)