Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

estimates post: matrix has missing values r(504); #24

Open
CClapp opened this issue Oct 15, 2019 · 6 comments
Open

estimates post: matrix has missing values r(504); #24

CClapp opened this issue Oct 15, 2019 · 6 comments

Comments

@CClapp
Copy link

CClapp commented Oct 15, 2019

IVREGHDFE returns a "estimates post: matrix has missing values r(504);" error when a perfectly collinear variable is dropped from a model.

REGHDFE, OLD works fine when this happens.

Thanks for producing such a valuable public good!

@tofihau8
Copy link

I'm having the same issue on Stata 15.1. Did you ever find a solution? - thanks!

@CClapp
Copy link
Author

CClapp commented Dec 16, 2019

Just a workaround: I dropped the colinear variables from the regressions manually. I know this sounds like a solution, but it was an issue because I was looping over subsamples, so I didn't know what would be colinear before running.

@sergiocorreia
Copy link
Owner

Sorry I missed the initial post. I tried to reproduce this issue on my end and I can't. I would need a MWE, preferably using the "sysuse auto" dataset, in order to see what's the problem and debug it.

@glennmagerman
Copy link

glennmagerman commented Sep 16, 2020

I got the same error after using reghdfe and estfe to esttab results.
After running some model batches, I get the error when estfe model*, restore. But others on the same dataset work fine.
I tried reconstructing the issue in the "sysuse auto" dataset by introducing a fully collinear regressor, but I cannot reproduce the error there... Here's the minimal non-working example:

* Setup
sysuse auto, clear

* Run and store regressions
gen length2 = length*2

reghdfe price weight length length2, a(turn) 
estimates store model1
reghdfe price weight length length2, a(turn trunk) 
estimates store model2
reghdfe price weight length length2, a(turn foreign) 
estimates store model3

* Prepare estimates for -estout-
	estfe  model*, labels(turn "Turn FE" turn#trunk "Turn-Trunk FE")
	return list

* Run estout/esttab
	esttab model* , indicate("Length Controls=length" `r(indicate_fe)')
		
* Return stored estimates to their previous state
	estfe m*, restore

@mariamdimou
Copy link

Dear Sergio,

Thanks a million, and loads of sincere gratitude also from me for these great packages, and for making our lives so much easier with them!

It has been my turn to encounter this issue today.
Wanted to do "eststo: ivreghdfe...,first savefirst savefprefix(abc)" and then export with "esttab", but I received the error "estimates post: matrix has missing values", which seems to stem from the fact that one of the variables is identified by Stata as being collinear with the FE.

So I was also wondering whether in the end there has been any solution or workaround?

In the meantime, I tried to run the same regression using "reghdfe..., ... old", which instead of dropping the collinear variable keeps it in the equation (thereby producing an implausibly high coefficient). I then get the first-stages estimates I have been after.

Thank you so much in advance for any guidance you could provide, and best,
Maria

@matteovacca
Copy link

Just a workaround: I dropped the colinear variables from the regressions manually. I know this sounds like a solution, but it was an issue because I was looping over subsamples, so I didn't know what would be colinear before running.

This worked for me as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants