cd "C:\Users\chkim\The University of Kansas\OneDrive - The University of Kansas\Lectures\Soc910_AdvStat\examples" use soc910_data_5_ind2_REM.dta, clear keep if year>=1983 gen time = year-1983 * --- * RCM: without other independent variables except time variable. * --- * RCM with two-level random intercept mixed lnwage time || ind: * RCM with two-level random intercept & slope mixed lnwage time || ind: time * RCM with two-level random intercept & slope mixed lnwage time || ind: time, covariance(unstructured) * --- * RCM: with other independent variables to account for the random effects * --- * RCM with two-level random intercept: covariates only for intercept mixed lnwage time union part || ind: * RCM with two-level random intercept & slope: covariates only for intercept mixed lnwage time union part || ind: time * RCM with two-level random intercept: covariates only for intercept mixed lnwage time union part || ind: time, covariance(unstructured) * RCM with two-level random intercept: covariates only for both intercept and slope mixed lnwage time union part c.time##c.union c.time##c.part || ind: time, covariance(unstructured) * --- * REM vs. RCM-random intercept * --- xtset ind time * REM xtreg lnwage time union part, re mle * RCM with two-level random intercept mixed lnwage time union part || ind: * --- * Hybrid Model * --- egen mtime = mean(time), by(ind) egen munion = mean(union), by(ind) egen mpart = mean(part), by(ind) gen ctime = time - mtime gen cunion = union - munion gen cpart = part - mpart reg lnwage ctime cunion cpart mtime munion mpart * --- * Hybrid Model * --- gen t0wage1 = 0 replace t0wage1 = lnwage if year==1983 gen t0union1 = 0 replace t0union1 = union if year==1983 gen t0part1 = 0 replace t0part1 = part if year==1983 egen t0wage = max(t0wage), by(ind) egen t0union = max(t0union1), by(ind) egen t0part = max(t0part1), by(ind) gen clnwaget0 = lnwage - t0wage gen cuniont0 = union - t0union gen cpartt0 = part - t0part reg clnwaget0 time cuniont0 cpartt0 reg t0wage t0union t0part