ergm icon indicating copy to clipboard operation
ergm copied to clipboard

Covariance methods for MPLE III

Open schmid86 opened this issue 3 years ago • 7 comments

I added code to estimate MPLE covariance matrices. If a user requests the MPLE of a dyad-dependent model, standard errors are obtained from the glm()-function, which uses the inverse Hessian matrix to calculate the covariance matrix. However, MPLE standard errors obtained from the logistic regression output lead to MPLE-based confidence intervals with coverage rates far below the nominal confidence level (see for example van Duijn, Gile and Handcock (2009)) and are therefore suspect.

I added two new methods in the code that are simulation based approximation of standard errors. One uses the Godambe matrix (sometimes also referred to as the Sandwich estimator), the other one approximates standard errors using parametric bootstrapping. Simulation studies have shown that these standard errors are more reliable than MPLE s.e from the logistic regression output. See Schmid and Desmarais (2017) and Schmid and Hunter (working paper). The file ergm_mplecov.R contains the code for these two methods.

Sample code: data(florentine) m1 <- ergm(flomarriage~ edges+triangles, estimate="MPLE", control=control.ergm(MPLE.covariance.method="Godambe")

m2 <- ergm(flomarriage~ edges+triangles, estimate="MPLE", control=control.ergm(MPLE.covariance.method="Bootstrap")

References: Schmid, C. S. and Desmarais B. A., Exponential Random Graph Models with Big Networks: Maximum pseudolikelihood estimation and the parametric bootstrap, IEEE International Conference on Big Data, 2017.

Schmid, C. S. and Hunter D. R., Accounting for Model Misspecification When Using Pseudolikelihood for ERGMs, Working Paper, 2020.

Commit message: added code for MPLE covariance methods MPLE se using Godambe matrix or parametric bootstrap *added code to estimate MPLE covariance matrix using a Godambe matrix approximation or parametric bootstrap. The calculation of these methods is done in the new file ergm_mplecov. *added MPLE.covariance.method and MPLE.covariance.samplesize to control.ergm. Covariance methods to choose from are invHess, Godambe, and bootstrap *in summary.ergm extended the warning message if estimate=MPLE and invHess standard errors are used to indicate that Godambe method is more appropriate.

  • new methods are only possible if estimate=MPLE

schmid86 avatar Mar 10 '21 14:03 schmid86

This seems to be failing checks. Does it depend on merging #234 first?

krivit avatar Mar 12 '21 08:03 krivit

No, it shouldn't depend on the other PR. I will try to figure out the next days, why it is failing these checks.

schmid86 avatar Mar 13 '21 08:03 schmid86

Fixed the reason the previous code failed all the checks. The reason was MPLE.covariance.method=c("invHess","Godambe", "bootstrap") in control.ergm. In ergm.mple there is an if-statement control$MPLE.covariance.method == "Godambe", which returns FALSE TRUE FALSE if MPLE.covariance.method is not specified by the user. It is supposed to return just FALSE or TRUE. Therefore, I changed it to MPLE.covariance.method="invHess" in control.ergm.

schmid86 avatar Mar 14 '21 21:03 schmid86

Also, it needs to be updated for The Great Merge (which supports MPLE for curved ERGMs). You don't have to support it in this PR, but it needs to handle the scenario gracefully.

krivit avatar Mar 17 '21 20:03 krivit

More generally, can I ask you to add some tests? (An example might also be worth adding somewhere.)

krivit avatar Mar 17 '21 22:03 krivit

I added control parameters for MCMC.interval and MCMC.burnin for ergm_mplecov. The function can now also handle sample space constraints.

I can also add some tests the next days.

And yes, I can also add an example. Where do you suggest I add this example? in the ergm R documentation?

schmid86 avatar Mar 31 '21 18:03 schmid86

And yes, I can also add an example. Where do you suggest I add this example? in the ergm R documentation?

Good question. The vignette is one possible place. But, if the example is not too time consuming, it might be worth putting into the function documentation.

krivit avatar Mar 31 '21 21:03 krivit