# Can I use calculated data for regression

Can I use calculated data for regression analysis.

case 1: first run OLS $y = \alpha+\beta x$, and get $\hat\beta$, then calculate $z = h^\hat\beta$, at last run $m = \gamma + \mu z$.

case 2: follow the same settings as case 1, run $z = \zeta + \rho p$.

case 3: use matlab solve equation $k_i = \sum_j d_{ij} k_j$ for $k_i$, then run $w = \theta + \pi k$.

where $\alpha$,$\beta$,$\gamma$,$\mu$,$\zeta$,$\rho$,$\theta$,and $\pi$are coefficients, the other letters denote the variables.I have the variables y,x,h,m,p,$d_{ij}$,w. All the relationships between variables are from the models.

They are independent cases that I ran into.

I am going to estimate the coefficients $\mu$,$\rho$,and $\pi$.

• Yes you can, but do you want someone to show you how to estimate these parameters? – london Aug 5 '16 at 16:15
• @london No. I just want to know the method I use to prepare the data for regression is right. I thought it should use those observable data rather than calculated data. – XJ.C Aug 5 '16 at 17:05
• In that case, you should explain the background to the problem. – london Aug 5 '16 at 17:53
• @london They are independent problems that I ran into – XJ.C Aug 6 '16 at 1:07
• Then, it is fine go ahead with what you described. – london Aug 6 '16 at 19:35

I'm afraid the accepted answer is not precise enough, and can be deeply misleading.

This issue is formally called the Generated Regression problem which arises when we use "generated" regressors in a regression. This is a very common feature of estimations like Heckman Selection Model, where we use the predicted Inverse Mills Ratio from the selection equation in the structural equation. We need to divide the issue in two:

• Consistency: there is usually no problem of consistency when using generated regressors in an estimation. A formal proof can be found in Wooldridge (2010), page 123.

• Statistical inference: here there might be problems. Under the null that generated regressors are zero, then standard errors and all tests are valid (you might still need to correct for heteroscedasticity and serial correlation as usual, using robust standard errors). However, if the generated regressor is statistically significant, then the standard errors and in consequence any test are invalid. What you need is a correct estimation of the asymptotic variance. The formulas depend on each case (more information in Newey and McFadden ). However, a general solution to calculate the consistent standard errors is to use bootstrapping. As an aside, for example, if you use Stata, just run your normal command with the following code before:

bootstrap, reps(400) seed(10101): regres ...


reps is the number of repetitions and seed is for reproducibility.

TL;DR

If your generated regressor is statistically significant in your regression, then you need to estimate the standard errors using boostrapping because they are invalid. If they are insignificant, you are safe.

• Two questions: 1. What is Wooldridge (2010)? 2. Should you not bootstrap the generation of regressors, too, to account for the "measurement error" due to using generated regressors in place of "real" ones? I do not see how simply bootstrapping the errors of the final model would address the problem of generated regressors. – Richard Hardy Feb 23 '17 at 19:39

Case 1: There is an estimation error in beta_hat. So Z should be really named Z_hat, which is different from the true Z defined as exp(beta_0). The estimation error translates into the error-in-variable problem in the second regression. The OLS estimator of mu will suffer from attenuation bias in finite samples. However, in large samples, when the variance of the estimation error in beta_hat goes to zero, the attenuation bias disappears. So you can run the regression as usual.

Case 2: Not a problem. Just run the regression as usual.

Case 3: No a problem, as long as you can estimate the k's precisely. That is, the numerical errors have to be very small. Otherwise, you will have the same problem as in Case 1.

luchonacho's answer is good to keep in mind but it doesn't mean you can't do what you are proposing, only that you should have a good reason for doing so.

Since you are only using your estimated variable in case 1 and case 2 I'm going to focus on those.

In both case 1 and case 2 you are estimating a simple linear regression with X as the regressor and y as the dependent variable. This implies that you believe X and Y are related in a strictly linear sense. So your beta hat is telling you the slope of the line between X and Y.

You then raise h to a power of beta hat. I assume h is another variable. Essentially this is just a transformation of h. You are raising every single value stored in h to a power of beta hat.

If that's what you want to do it seems to be a valid way to do it but I'm struggling to interpret what z would mean without knowing how your variables are related.

I'm also struggling to see why you need to do the transformation in the first place. With a few details on how the variables are related, or perhaps a link to the some of the literature your work is citing I might be able to be of more assistance.

As it stands right now, I would say that your regressions using the variable z are meaningless economically and have significant statistical issues as well. I strongly recommend taking a step back and thinking about your specifications again.