Hi all,
Could you please recommend efficient ways of adding additional objective functions to OLS - or even better, LASSO - Stata programs?
Specifically, I have the firm-level regression:

where D is an indicator variable and X is a set of regressors. And instead of minimising the RSS, I would like to minimise:

where omega is a weight and the second term is the difference between actual and predicted country-level averages of the D indicator.
Thank you!
Could you please recommend efficient ways of adding additional objective functions to OLS - or even better, LASSO - Stata programs?
Specifically, I have the firm-level regression:
where D is an indicator variable and X is a set of regressors. And instead of minimising the RSS, I would like to minimise:
where omega is a weight and the second term is the difference between actual and predicted country-level averages of the D indicator.
Thank you!