# Inclusion of a squared independent variable in a Distributed Lag model

I am interested in regressing monthly temperature data on an individual's self-evaluated wellbeing in a panel survey, of the form:

lm(wellbeing ~ temperature + factor(month) + factor(individualID), df)

I know that the relationship is likely to be non-linear, so need to include a quadratic term:

lm(wellbeing ~ temperature + I(temperature factor^2) + (month) + factor(individualID), df)

However, I also know that an individual's wellbeing at any given moment is likely to reflect temperature during the observed month as well as months prior. Therefore I'd like to run a distributed lag model (say with one month's lag) to measure this cumulative effect. In theory, I would simply add last month's value into the regression, though I am unsure if it's feasible to do so if the independent variable is quadratic in nature? Would it simply be:

lm(wellbeing ~ temperature + I(temperature factor^2) + dplyr::lag(temperature) + (month) + factor(individualID), df)

I could also use dLagM to make life easier, though am mainly curious as to whether this type of setup is reasonable? Every reference guide that I've come across deals only with independent variables as non-quadratic terms.

Any help is much appreciated.

I don't think your line of reasoning justifies the inclusion of the lagged term. We don't actually require that $$X_t \perp X_{t-1}$$ to obtain unbiased and efficient estimates of the model effects. Rather, distributed lag models test a different hypothesis: to estimate the cumulative effect of a regressor on an outcome. That is not the hypothesis you stated at the top of the question.

Something to be cautious of, you need to exercise careful management to estimate lagged effects in panel data. Note, for instance, if you look at the lagged effects you would estimate in the 3rd model, you would get

id mon tmp lagtmp
1   ja   0     NA
1   fe   5      0
1   ma  10      5
2   ja   0  ***10***
2   fe   5      0
2   ma  10      5


where the *** shows an incorrect term. You need to use the tapply statement instead.

in general: there is nothing stopping you from having both linear and quadratic of the concurrent regressor and a linear term for the lagged regressor(s). If the model actually follows;

$$E[Y_t|X_t, X_{t-1}] = \alpha + \beta_1 X_t + \beta_2 X_t^2 + \beta_3 X_{t-1}$$

then the estimates will be efficient and unbiased. With such a peculiar setup, most reviewers will want to know that you used some sensitivity analysis to actually verify that this prespecified model has some objectively favorable fit conditions.

• Thanks, this is really useful. And yes, you're right, as far as I understand the lagged term would instead be picking up on the cumulative effect of temperature (during the present month and one month prior) on wellbeing. Something that is indeed useful to know in this context. Thanks also for flagging the need to be careful when calculating the lagged term. Commented Sep 14, 2019 at 14:06