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

Vectorize povline #403

Open
wants to merge 29 commits into
base: DEV
Choose a base branch
from
Open

Vectorize povline #403

wants to merge 29 commits into from

Conversation

shahronak47
Copy link
Contributor

@shahronak47 shahronak47 commented May 23, 2024

Hi Andres,

This is the first draft of vectorize povline. I just want to confirm the expected output. To test this install vectorize-povline branch in wbpip using -

metapip::install_branch("wbpip", "vectorize-povline")

You can then test -

devtools::load_all()

out1 <- pip(country = "AGO",
     year = 2000,
     povline = 1.9,
     lkup = lkups$versions_paths$`20220810_2017_01_02_TEST`)

out2 <- pip(country = "AGO",
            year = 2000,
            povline = 1.675,
            lkup = lkups$versions_paths$`20220810_2017_01_02_TEST`)         

out3 <- pip(country = "AGO",
            year = 2000,
            povline = c(1.675, 1.9),
            lkup = lkups$versions_paths$`20220810_2017_01_02_TEST`)

identical(rbind(out2, out1), out3)

@randrescastaneda
Copy link
Member

Hi @shahronak47 ,

I tested the output and it is looking very nice. Yes, this is what I had in mind. Thank you.

So, These would be the next steps

  1. Vectorize properly prod_md_compute_pip_stats() and prod_gd_compute_pip_stats() in prod_compute_pip_stats to avoid the lapply() function.
  2. make sure it is also implemented in fillgaps, (fg_pip())
  3. Make sure it is implemented in aggregate data, in (pip_grp_logic)
  4. Add tests.

Copy link
Member

@randrescastaneda randrescastaneda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @shahronak47 ,

There seems to be a problem when more than one poverty line is requested for the case of CHN. See code below

  out <- pip(country = "CHN",
              year = c(2010, 2018),
              povline = c(1.675, 1.9),
              lkup = lkup)

Thanks.

@shahronak47
Copy link
Contributor Author

Hi @randrescastaneda , I have pushed the fixes and now all the test cases from #413 pass. You can do some more round of testing if you have time or else we will wait till mid-September before merging this PR. Thank you for providing with the test file, it was very helpful.

@randrescastaneda
Copy link
Member

hi @shahronak47 ,
Thank you so much, the tests at the country level are passing. However, I added a few tests at the aggregate level (using pip_grp_logic()) and they are not passing yet. I added the tests in #421. could you please make sure those tests pass too? Thank you so much!
Best,

@shahronak47
Copy link
Contributor Author

Thanks @randrescastaneda for catching that and adding the test. I have done the necessary changes and now the tests should pass.

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

Successfully merging this pull request may close these issues.

3 participants