-
Notifications
You must be signed in to change notification settings - Fork 21
Description
Hello,
I am a contributor for clubSandwich, and I have been working on making lm_robust objects compatible with clubSandwich. While my primary goal has been enabling lm_robust objects to be used with clubSandwich whenever lm objects can be used, I believe this also presents an opportunity to address some issues. #201 is the closest example to what we are trying to fix for clubSandwich.
As of right now, we have several S3 methods that work for lm_robust objects created by calling lm_robust(), and are making progress on these same methods for lm_robust objects created by lm_lin().
Question of Separate Classes
Firstly, I was wondering if it would make sense to make lm_robust and lm_lin separate classes. Although they are similar, their differences require that they are treated differently in many situations, and they do different preprocessing.
For example, in our model_matrix.lm_robust method, we check whether this is a regular lm_robust object or an lm_lin object using the call as follows:
if ("lm_lin" %in% as.character(obj$call[[1]])) { ... }
It would be preferable to do this by checking the class instead, so we were wondering if you would be open to adding lm_lin as a sub-class of lm_robust. .
S3 Methods
With this all being said, we would also like to contribute any S3 methods that would be appropriate to incorporate into estimatr. We believe this would benefit both estimatr and clubSandwich. The S3 methods we would like to contribute are:
residuals, mentioned in Catalog and discuss S3 methods that lm has #123, residuals #345, and predict and residuals have odd behavior #403model.frame, mentioned in Catalog and discuss S3 methods that lm has #123 andmodel.frame()gives unexpected results withiv_robust()#397model_matrix, mentioned in Catalog and discuss S3 methods that lm has #123breadna.action
If any of these are of interest, let me know and one of the clubSandwich contributors will open a pull request.