I want to loop a mixed model over a list of predictors (fixed effects) and store the coefficients and P values in Stata v. 17.
Code:
sysuse auto, clear
xtmixed price mpg || foreign:, covariance(independent) vce(robust)
foreach var of varlist mpg-gear_ratio {
xtmixed price `var' || foreign:, covariance(exchangeable) vce(robust)
}Thanks in advance,
Sergio
No comments:
Post a Comment