I am looking to run a regression following using panel data in which the same individuals are observed across time. I have tried running it on R, but I get errors, probably because of colinearity issues.

My model is such that I have two time periods, lets say T = 0 and T = 1 and two groups, lets say Control and Treatment.

My main independent variable X is such that on T = 1 it is equal to 0 for all observations. On T = 0, it is equal to 0 for the Control groups and greater than 0 for the Treatment units.

Is there perfect colinearity? How can I fix this?

Edit: I apologize for not giving more details of my issue.

I am studying the effects of a change of campaign finance legislation on Brazilian local elections. In 2015 the law was changed, so that companies could not make any more donations to candidates. What I intend to do is to check whether candidates who once had greater proportion of their funds coming from corporate money were significantly more affected on the elections after the change in Legislation in comparison to other candidates.

To do this I run regressions like this:

$$ Vote\_Percentage = a_0 + a_1*Time_t + a_2*Campaign\_Proportion_{it} + a_3*Time_t*Corporate\_Proportion_{it} + \delta*X'_{it} + \epsilon_{it} $$

$X$ is a vector with controls, such as the candidate's personal characteristics. As you can notice, on t = 1, $Campaign\_Proportion$ will be 0 for all candidates.

Running a regression like this on R, I could not obtain a value for the interaction coefficient, getting an NA as a response. On the other hand, I do not get any of these errors when running this regression on first-differences.

Why do I have this NA thing?

  • $\begingroup$ Have you considered using the differences in responses between T=1 and T=0 for the response variable? The independent variable would be the value of X at T=0. It's difficult to provide any definite answer due to the vagueness of your description: are there other independent variables? Other observation times? What model are you "running on R"? Exactly what error messages are produced? $\endgroup$
    – whuber
    Sep 8, 2017 at 12:41
  • $\begingroup$ @whuber please refer to the edit above $\endgroup$ Sep 9, 2017 at 2:57

2 Answers 2


It's not colinearity since you have only one IV. Ordinarily, with two time points, you'd have to deal with the fact that the data is not independent. However, if everyone has the same value at time = 1, then you can just drop that without losing anything.

You also state that, at T = 0, X is 0 for all people in the control group. So, you can do a one sample t test to see if X = 0 at T = 0 in the treatment group.

However, your design clearly has some problems. Without details about what X is, what Y is, who the subjects are, what your hypotheses are and so on, it's hard to say how it could be improved, but it would surely involve getting more data.

EDIT IN RESPONSE TO UPDATED QUESTION: You cannot estimate the interaction because it will always be 0. At time 0, it will be 0 because time = 0 and at time 1 it will be 0 because contribution = 0.

  • $\begingroup$ please refer to the eddited question above for more details $\endgroup$ Sep 9, 2017 at 1:01
  • $\begingroup$ OK, I added to my answer. $\endgroup$
    – Peter Flom
    Sep 9, 2017 at 11:33

Although in your case the two variables are not collinear but it has a same problem as collinearity. The problem is that your design matrix $X$ is not full rank in columns because you have one column that all elements are 0. Then $X'X$ is not invertible if $X$ is not full rank in columns. The OLS estimator $\beta = (X'X)^{-1} (X'Y)$ cannot be calculated.

  • $\begingroup$ But then wouldn't I be changing my data? And my X variable is not binary...Although on T = 1 it is 0, in T = 0 it is continuous. $\endgroup$ Sep 8, 2017 at 5:09
  • $\begingroup$ @ArthurCarvalhoBrito then just abandon the data at T=0 $\endgroup$
    – Jason
    Sep 8, 2017 at 5:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.