Imagine predicting salary of some professors from their years of experience (time) controlling for/holding constant their number of publications (pubs).
Question: Is the following regarding the meaning of holding constant their number of
pubscorrect, and demonstrable via simulation inR?
Imagine we had countless professors, then take a sample of them with the exact same number of pubs (e.g., $1$).
- Fit a regression model with only
timeas predictor, get the regression coef oftime. - Take another sample with
pubsof $2$, Fit the regression model again, get the regression coef oftime. - Keep changing
pubsto $3, 4,…$ and each time get the regression coef oftime.
At the end, average of our regression coefs of time will be a partial regression coefficient that has controlled for the pubs of professors while predicting salary from time.
p.s. Is controlling for a predictor similar to integrating it out?
salary ~ time + pubsalready a partial regression coefficient that has controlled forpubs(that is 435.3 in your code above)? Are you concerned with controlling for nonlinear effects inpubs? – Dex Groves Aug 16 '20 at 07:06pubsis introduced as a categorical variable rather than as a numerical count. Concerning your PS, see https://stats.stackexchange.com/questions/17336/how-exactly-does-one-control-for-other-variables – whuber Aug 16 '20 at 19:17