mmeierer / REndo

REndo - A R package to control for endogeneity by using internal instrumental variable models
15 stars 4 forks source link

Allow users access to the Pstar vectors in copulaCorrection so users can use panel data methods with them #82

Open usmana7med opened 10 months ago

usmana7med commented 10 months ago

(1) Please export the functions copulaCorrectionDiscrete_pstar and copulaCorrectionContinuous_pstar so users can call them to generate Pstar vectors.

(2) Please return the pstar vectors with the return object of the copulaCorrection() function (summary function does not need to show them by default)

(3) Also please return the generated moments (g, gp, gy, etc) for the higherMomentsIV() function with the return object or provide access to functions to that generate them.

This will allow users to use pstar vectors with further panel data analysis using the plm package, or conduct further tests that may require the pstar vector that was used in the copula regression.

Thank you!

mmeierer commented 9 months ago

Thanks for your suggestion.

Would you please provide references for the mentioned application cases that detail that this information can indeed be used. Also, please provide the exact page number for each reference where this information is used.

After you have provided this information, we are happy to look into this.

pschil commented 9 months ago

(1) The methods copulaCorrectionDiscrete_pstar and copulaCorrectionContinuous_pstarare currently not exported from the the package but users can still access them by calling them directly using :::. Like: REndo:::copulaCorrectionDiscrete_pstar() and REndo:::copulaCorrectionContinuous_pstar().

(2) The generated pstar vectors are part of the model data that is stored in the returned object. Access it using either result$model or model.frame(result). With the example data:

c2 <- copulaCorrection(y~X1+X2+P1+P2|continuous(P1, P2), num.boots=10, data=dataCopCont2)
model.frame(c2)[, c("PStar.P1", "PStar.P2")]

The pstar vectors are not available for the LL optimization approach used in the case of a single continuous endogenous regressor.

(3) In the same fashion as in (2), the generated moments can be accessed in the results from higherMomentsIV().