penppml

Penalized Poisson Pseudo Maximum Likelihood

https://github.com/tomzylkin/penppml

Science Score: 23.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    2 of 5 committers (40.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (16.5%) to scientific vocabulary
Last synced: 11 months ago · JSON representation

Repository

Penalized Poisson Pseudo Maximum Likelihood

Basic Info
  • Host: GitHub
  • Owner: tomzylkin
  • License: other
  • Language: R
  • Default Branch: master
  • Size: 9.38 MB
Statistics
  • Stars: 12
  • Watchers: 5
  • Forks: 6
  • Open Issues: 2
  • Releases: 1
Created almost 5 years ago · Last pushed over 1 year ago
Metadata Files
Readme Changelog License

README.Rmd

---
output: github_document
---



```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)
```

# penppml




The `penppml` package is a set of tools that enables efficient estimation of penalized Poisson Pseudo Maximum Likelihood (PPML) regressions, using lasso or ridge penalties, for models that feature one or more sets of high-dimensional fixed effects (HDFE). The methodology is based on Breinlich, Corradi, Rocha, Ruta, Santos Silva, and Zylkin (2021) and takes advantage of the method of alternating projections of Gaure (2013) for dealing with HDFE, as well as the coordinate descent algorithm of Friedman, Hastie and Tibshirani (2010) for fitting lasso regressions. The package is also able to carry out cross-validation and to implement the plugin lasso of Belloni, Chernozhukov, Hansen and Kozbur (2016).

## Installation

You can install the released version of penppml from [CRAN](https://CRAN.R-project.org) with:

``` r
install.packages("penppml")
```

And the development version from [GitHub](https://github.com/) with:

``` r
# install.packages("devtools")
devtools::install_github("diegoferrerasg/penppml")
```
## Example

This is a basic example which demonstrate how to estimate a gravity model of international trade with three sets of HDFE using the package:

```{r example}
# Setup:
library(penppml)
selected <- countries$iso[countries$region %in% c("Americas")]
trade2 <- trade[(trade$exp %in% selected) & (trade$imp %in% selected), -(5:6)] 
lambdas <- c(0.05, 0.025, 0.01, 0.0075, 0.005, 0.0025, 0.001, 0.00075, 0.0005, 0.00025, 0.0001, 0)
```

```{r try mlfitpenppml lasso, results = FALSE}
# Main command:
reg <- mlfitppml(data = trade2,
                 dep = "export",
                 fixed = list(c("exp", "time"), 
                              c("imp", "time"),
                              c("exp", "imp")),
                 penalty = "lasso",
                 lambdas = lambdas)
```

For more examples and details on how to use the package, see the vignette.

## References

Breinlich, H., Corradi, V., Rocha, N., Ruta, M., Santos Silva, J.M.C. and T. Zylkin, T. (2021). "Machine Learning in International Trade Research: Evaluating the Impact of Trade Agreements", Policy Research Working Paper; No. 9629. World Bank, Washington, DC.

Correia, S., P. Guimaraes and T. Zylkin (2020). "Fast Poisson estimation with high dimensional fixed effects", *STATA Journal*, 20, 90-115.

Gaure, S (2013). "OLS with multiple high dimensional category variables", *Computational Statistics & Data Analysis*, 66, 8-18.

Friedman, J., T. Hastie, and R. Tibshirani (2010). "Regularization paths for generalized linear models via coordinate descent", *Journal of Statistical Software*, 33, 1-22.

Belloni, A., V. Chernozhukov, C. Hansen and D. Kozbur (2016). "Inference in high dimensional panel models with an application to gun control", *Journal of Business & Economic Statistics*, 34, 590-605.

GitHub Events

Total
  • Watch event: 1
  • Push event: 2
  • Fork event: 1
Last Year
  • Watch event: 1
  • Push event: 2
  • Fork event: 1

Committers

Last synced: over 2 years ago

All Time
  • Total Commits: 140
  • Total Committers: 5
  • Avg Commits per committer: 28.0
  • Development Distribution Score (DDS): 0.464
Past Year
  • Commits: 21
  • Committers: 3
  • Avg Commits per committer: 7.0
  • Development Distribution Score (DDS): 0.524
Top Committers
Name Email Commits
Diego Ferreras Garrucho d****o@l****k 75
nicolasapfel n****l@g****m 39
tomzylkin t****n@g****m 10
jm01780 j****0@s****k 10
nicolasapfel 7****l 6
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 11 months ago

All Time
  • Total issues: 2
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 2
  • Total pull request authors: 0
  • Average comments per issue: 0.5
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • tdhock (1)
  • philipocalito (1)
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • cran 351 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 7
  • Total maintainers: 1
cran.r-project.org: penppml

Penalized Poisson Pseudo Maximum Likelihood Regression

  • Versions: 7
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 351 Last month
Rankings
Forks count: 9.1%
Stargazers count: 19.8%
Average: 29.0%
Dependent packages count: 29.8%
Dependent repos count: 35.5%
Downloads: 50.9%
Maintainers (1)
Last synced: 11 months ago

Dependencies

DESCRIPTION cran
  • R >= 2.10 depends
  • Rcpp * imports
  • collapse * imports
  • fixest * imports
  • glmnet * imports
  • magrittr * imports
  • rlang * imports
  • MASS * suggests
  • directlabels * suggests
  • ggplot2 * suggests
  • knitr * suggests
  • reshape2 * suggests
  • rmarkdown * suggests
  • testthat >= 3.0.0 suggests