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

plm support #31

Open
tappek opened this issue Feb 26, 2022 · 11 comments
Open

plm support #31

tappek opened this issue Feb 26, 2022 · 11 comments
Labels
enhancement New feature or request

Comments

@tappek
Copy link

tappek commented Feb 26, 2022

Is there a specific reason why package plm is not supported by fwildclusterboot?
Shall there be questions about plm objects maybe I could help.

@s3alfisc
Copy link
Owner

Hi @tappek, thanks for raising this, adding a plm method is definitely on my to-do list!
The reason for why plm is not yet supported is a) that I am not too familiar with the package and would need some time to explore its functionalities and b) that onboarding a new method is quite labour intensive (I'll have to write a lot of tests).
Thanks for your kind offer to help, I will definitely get back to that :) As a timeline, I am currently integrating functionality of WildBootTests.jl into fwildclusterboot , which will approximately take two more weeks. I'll start looking into plm support right after.

@s3alfisc
Copy link
Owner

Hi @tappek, I have started to investigate plm objects - I think that all methods supported by plm::plm() except for the random effects model (which I am not too familiar with) are suitable for fwildclusterboot. So just to give you a heads up - plm support has now moved from "planned features" to "work in progress" :) .

I already have a first question: if I wanted to retain all "index" names from a plm object, what would be the best way to do so? Is it even possible based on the plm object only? With "index" names, I try to refer to a) all index values set in a pdata.frame or b) all variables not specified in the model formula, but implicitly used in the estimation.

Currently, I can only think of running something like

library(plm)
data("Grunfeld", package="plm")
Grunfeld2 <- pdata.frame(Grunfeld, index=c("firm","year"))

plm_object <- plm(inv~value+capital, data = Grunfeld2, model = "within")
names(index(Grunfeld2))

Is it possible to get these two names based on the plm_object without referring to the pdata.frame?

@tappek
Copy link
Author

tappek commented Mar 20, 2022

yes, it is simply names(index(plm_object$model))

@tappek
Copy link
Author

tappek commented Apr 6, 2022

Oh, I just realised, we even supply an index method for model objects. So you could also use the bit shorter version names(index(plm_object)).

@s3alfisc s3alfisc mentioned this issue Jun 7, 2022
3 tasks
@s3alfisc
Copy link
Owner

s3alfisc commented Jun 11, 2022

I have opened a development branch for plm support. So far, it is quite 'barebone' - boottest() works with plm() and "pooling".

@s3alfisc s3alfisc added the enhancement New feature or request label Jun 25, 2022
@tappek
Copy link
Author

tappek commented Apr 14, 2023

Hi there, I did not realized there is a branch for plm meanwhile. I have just checked and package build for the plm branch fails due to dependecy package Matrix.utils not being available anymore on CRAN (archived).

As we recently had some plm users asking us for fwildclustersupport, I thought I stop by with a motivating thumbs up for working on this!

@s3alfisc
Copy link
Owner

s3alfisc commented Apr 14, 2023

Hi @tappek - nice to hear that there are plm users with interest in fwildclusterboot! This is exactly the type of feedback I needed. I will get back to it =) The plm branch has been stale for quite a while now, and I will have to set up a new one. I cannot promise to get back to it tomorrow, but will try to open a proper PR by the end of next month.

@s3alfisc
Copy link
Owner

The key part to support plm is to implement a preprocess method customized to plm. Browsing the code, I have just recalled that I have reorganized this part a while back, and it should be actually fairly straightforward to add a boottest.plm method after I familiarize myself with plm post-processing tools =)

s3alfisc added a commit that referenced this issue Apr 14, 2023
s3alfisc added a commit that referenced this issue Apr 14, 2023
@s3alfisc
Copy link
Owner

I have opened a new branch and a new pull request. This is much less work than I had anticipated, so really, thanks for pinging me! =) I might actually be able to add support by tomorrow/the end of the weekend, minus unit tests.

s3alfisc added a commit that referenced this issue Apr 15, 2023
@s3alfisc
Copy link
Owner

I think I have finalized basic support for model = "within" and model = "pooling". If you have 10-20 minutes to spare, would you mind playing around with boottest.plm to spot any potential bugs I might have overseen @tappek?

@tappek
Copy link
Author

tappek commented Apr 15, 2023

Wow, that was quick! I gave it a quick test drive and it runs on my end.

I used this code, which also uses sandwich::vcovBS and is based on input from plm users with fwildclusterboot:
https://gist.github.com/tappek/4cb65ab25d64f019ec629df5d11bd2bc

The issue with dropped observations (discovered and reported by the plm users) in the gist seems to be a plm issue which I have not fully analysed yet, but registered here ycroissant/plm#44.

For others to replicate:

remotes::install_github(repo = "s3alfisc/fwildclusterboot", ref = "plm-new") # fwildclusterboot with initial plm support
remotes::install_github("ycroissant/plm") # recent development version of plm

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

No branches or pull requests

2 participants