tilburgsciencehub / website

Learn to work more efficiently on empirical research projects.
https://tilburgsciencehub.com
38 stars 47 forks source link

Suggest change to: topics/Analyze/causal-inference/panel-data/system-gmm.md #1262

Open marinho1000 opened 2 months ago

marinho1000 commented 2 months ago

Hi Thank you for the great post. Could you add a section on how to display the instrument count? Roodman 2009 (p. 128) recommend to report the instrument count and unfortunately, I do not know how to display the number of instruments with the pgmm package.

Best regards

srosh2000 commented 2 months ago

@valerievossen This is regarding the GMM article you wrote (https://tilburgsciencehub.com/topics/analyze/causal-inference/panel-data/system-gmm/) -- would be great if you could look into this addition?

valerievossen commented 2 months ago

Hi @marinho1000,

Thank you for the suggestion!

I added a section on how to find the total number of instruments (last section).

The changes still have to merged, but this can already help: W contains a list with the instruments used per cross-sectional observation (Found in the pgmm documentation: https://www.rdocumentation.org/packages/plm/versions/2.6-4/topics/pgmm). So, summing up these values will result in the total instrument count.

This is the code I used (building further upon the example model in the article):

W_list <- dyn_model$W
total_instruments <- sum(sapply(W_list, function(x) ncol(x)))

Please let me know if this answers your question.