# Random Explanatory / Independent Variables [duplicate]

Are explanatory variables in regression always considered non-stochastic? If the explanatory variables are random or stochastic will the regression be still valid? What are the implications on the coefficients or issues with hypothesis testing one would face ?

## 1 Answer

It depends on the context. In classical regression analysis, explanatory variables are measured variables, and hence deterministic (the randomness in the dependent variables thus stems from the randomness of the error term, which can be thought of as measurement error). In econometric regression analysis or linear structural causal models, explanatory variables are to-be-measured variables, and hence stochastic.

If the explanatory variables are stochastic, you can still compute the OLS estimator, the OLS estimator is random, and its distribution is determined by the joint distribution of the dependent variable together with the explanatory variables. Thus, in hypothesis testing, one must consider this joint distribution when deriving standard errors. In the classical case one only has to consider the distribution of the error term.