jacob-long / panelr

Regression models and utilities for repeated measures and panel data
Other
98 stars 21 forks source link

Double-demeaned interaction estimator with only two waves #31

Open jogrue opened 4 years ago

jogrue commented 4 years ago

Hi Jacob!

First of all, thank you for your great work on the panelr package.

I was just running some models as robustness checks. In one of these models, I included an interaction term but only had two waves of data available.

I received this error (I think from lme4): Some predictor variables are on very different scales: consider rescaling. Also the interaction term's coefficient was far off (like a quadrillion times larger than the main effects).

At first, I was looking at my data because I was working with mean-centred variables. But the error was not connected to that. However, since the Giesselmann & Schmidt-Catran paper mentions that the "double-demean" approach only works with T>2 in the abstract, I switched to the conventional "demean". This worked. Also, the interactions (with the default setting) worked in multi-wave panels.

I have now had a short look at the approach and if I am not mistaken, with only two waves of data no within-subject variation remains in the computed interaction term. So differences in my data might only have been there due to floating point arithmetics (i.e., very [!] small differences or as the error message said, indeed a very different scale). I don't know if my explanation is correct because I did not look into the double-demean approach in detail. But I guess, what I saw was due to this approach being applied to only two waves?

Thus, I would suggest to output a meaningful warning in such cases, mention this fact for "interaction.style" in the documentation, or even switch the default in cases of only two waves of data.

Best regards, Johann