Dear Statalist users,
I have data that resembles the following:
In the above, I have by year, different combinations of workers-supervisors, along with a worker specific variable, a supervisor specific variable, and a regressand. What I want to do is the following: First, I would like to generate the OLS coefficient of a regression of y on the worker specific variable, and supervisor specific variable across all observations. This is simply
. What I want to do afterwards, however, is to use the predicted values based on coefficients, to in fact generate imputations even for the worker supervisor pairs that don't exist in a specific year. So in the above example, this would include augmenting 1869 by observations such as 2-3, 3-1 etc, and then using their values of the regressors from other observations. So, in essence I would like to have for each year, each possible combination of worker-supervisor variables that dont exist as pairs, but exist in diifferent pairs. For example, for the missing 1-4 combination, there would be a new row with the value for supervisorvariable and workervariable equal to 12 and 2 respectively. Any suggestions would be much appreciated.
I have data that resembles the following:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float(year worker supervisor workervariable supervisorvariable y) 1869 1 2 12 23 45 1869 1 3 12 2 43 1869 2 1 322 32 4 1869 3 4 3 2 43 end
In the above, I have by year, different combinations of workers-supervisors, along with a worker specific variable, a supervisor specific variable, and a regressand. What I want to do is the following: First, I would like to generate the OLS coefficient of a regression of y on the worker specific variable, and supervisor specific variable across all observations. This is simply
Code:
regress y workervariable supervisorvarabile
Comment