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
0 Response to Loop mixed model over a least of predictors and store the coefficients and P values
Post a Comment