partialling.out
Science Score: 39.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
Found .zenodo.json file -
✓DOI references
Found 1 DOI reference(s) in README -
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (17.8%) to scientific vocabulary
Last synced: 10 months ago
·
JSON representation
Repository
Basic Info
- Host: GitHub
- Owner: marcboschmatas
- License: gpl-3.0
- Language: R
- Default Branch: main
- Homepage: https://marcboschmatas.github.io/partialling.out/
- Size: 2.29 MB
Statistics
- Stars: 2
- Watchers: 1
- Forks: 3
- Open Issues: 0
- Releases: 0
Created about 1 year ago
· Last pushed 10 months ago
Metadata Files
Readme
Changelog
Contributing
License
Codemeta
README.Rmd
---
output: github_document
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
warning = FALSE,
message = FALSE
)
```
# partialling.out
[](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[](https://CRAN.R-project.org/package=partialling.out)
[](https://app.codecov.io/gh/marcboschmatas/partialling.out)
[](https://github.com/marcboschmatas/partialling.out/actions/workflows/R-CMD-check.yaml)
[](https://github.com/ropensci/software-review/issues/703)
Partialling out is a package that allows to generate residualised variables of already existing linear or fixed effects models. So far it works with `lm`, `felm` (`lfe`package) and `feols` (`fixest` package) for applications of the Frisch-Waugh-Lovell theorem, as explained in Lovell ([2008](doi:10.3200/JECE.39.1.88-91)). Whereas this algorithm has already been implemented in [`fwlplot`](https://github.com/kylebutts/fwlplot), this package offers three new characteristics.
- It uses an already existing model instead of a formula.
- Works with `lm` and `felm` objects alongside `feols`.
- Returns a data.frame with residualised variables instead of a plot, thus offering more freedom of what to do with the results.
## Using the Frisch-Waugh-Lovell theorem
The Frisch-Waugh-Lovell theorem states that for a linear model
``` math
Y = X_1 \beta_1 + X_2 \beta_2 + u
```
The coefficient $\hat{\beta}_1$ will be equivalent to the coefficient, $\tilde{\beta}_1$, from the regression of
``` math
M_{X_2} Y = M_{X_2} X_1 \beta_1 + M_{X_1} u
```
Where $M_{X_2} Y$ are the residuals of the regression of $Y$ on $X_2$ and
$M_{X_2}X_1$ are the residuals of the regression of $X_1$ on $X_2$.
This theorem is designed to help simplifying linear and, particularly, fixed effects models for easier visualisation and interpretation, transforming a multiple regression into a simple one that can be easily visualised via a scatterplot or further used in other models.
## Installation
You can install the development version of partialling.out from [GitHub](https://github.com/) with:
``` r
# install.packages("pak")
pak::pak("marcboschmatas/partialling.out")
```
## Examples
The workflow for `partialling.out` is rather simple: first, create a linear or fixed effects model.
```{r}
library(partialling.out)
library(tinytable)
library(palmerpenguins)
model <- lm(bill_length_mm ~ bill_depth_mm + species, data = penguins)
summary(model)
```
Using the `partialling_out` function, you can get the residualised variable of interest (bill length) and of the first explanatory variable (bill_length), i.e. it would return the residuals of the following two regressions.
```{r eval = FALSE}
modely <- lm(bill_length_mm ~ species, data = penguins)
modelx <- lm(bill_depth_mm ~ species, data = penguins)
```
```{r}
res <- partialling_out(model, data = penguins)
tt(head(res)) |>
format_tt(digits = 2) |>
style_tt(align = "c")
```
## Checking the results
As stated above, if we follow following the Frisch-Waugh-Lovell theorem the coefficient of `res_bill_depth_mm` in the model `lm(res_bill_length_mm ~ res_bill_depth_mm)` will be the same of the coefficient of `bill_depth_mm` in the original model.
```{r}
resmodel <- lm(res_bill_length_mm ~ res_bill_depth_mm, data = res)
print(c(model$coefficients[2], resmodel$coefficients[2]))
```
## Contributing
Contributing instructions can be found [here](https://github.com/marcboschmatas/partialling.out/blob/main/.github/contributing.md)
## Acknowledgements
To the authors of the [fwlplot](https://github.com/kylebutts/fwlplot) package, Kyle Butts and Grant McDermott, which has provided inspiration and ideas for this project.
To my colleague Andreu Arenas-Jal for his insight and guiding.
Owner
- Name: Marc Bosch
- Login: marcboschmatas
- Kind: user
- Repositories: 3
- Profile: https://github.com/marcboschmatas
Political scientist with some geography and data stuff added in
CodeMeta (codemeta.json)
{
"@context": "https://doi.org/10.5063/schema/codemeta-2.0",
"@type": "SoftwareSourceCode",
"identifier": "partialling.out",
"description": "Creates a data frame with the residuals of partial regressions of the main explanatory variable and the variable of interest. This method follows the Frisch-Waugh-Lovell theorem, as explained in Lovell (2008) <doi:10.3200/JECE.39.1.88-91>.",
"name": "partialling.out: Residuals from partial regressions",
"relatedLink": "https://docs.ropensci.org/partialling.out",
"codeRepository": "https://github.com/ropensci/partialling.out",
"issueTracker": "https://github.com/ropensci/partialling.out/issues",
"license": "https://spdx.org/licenses/GPL-3.0",
"version": "0.1.1",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
"url": "https://r-project.org"
},
"runtimePlatform": "R version 4.5.1 (2025-06-13)",
"author": [
{
"@type": "Person",
"givenName": "Marc",
"familyName": "Bosch-Matas",
"email": "mboschmatas@gmail.com",
"@id": "https://orcid.org/0009-0008-8653-0577"
}
],
"maintainer": [
{
"@type": "Person",
"givenName": "Marc",
"familyName": "Bosch-Matas",
"email": "mboschmatas@gmail.com",
"@id": "https://orcid.org/0009-0008-8653-0577"
}
],
"softwareSuggestions": [
{
"@type": "SoftwareApplication",
"identifier": "tinytest",
"name": "tinytest",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=tinytest"
},
{
"@type": "SoftwareApplication",
"identifier": "tinysnapshot",
"name": "tinysnapshot",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=tinysnapshot"
},
{
"@type": "SoftwareApplication",
"identifier": "knitr",
"name": "knitr",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=knitr"
},
{
"@type": "SoftwareApplication",
"identifier": "rmarkdown",
"name": "rmarkdown",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=rmarkdown"
},
{
"@type": "SoftwareApplication",
"identifier": "palmerpenguins",
"name": "palmerpenguins",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=palmerpenguins"
},
{
"@type": "SoftwareApplication",
"identifier": "tinytable",
"name": "tinytable",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=tinytable"
},
{
"@type": "SoftwareApplication",
"identifier": "fwlplot",
"name": "fwlplot",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=fwlplot"
},
{
"@type": "SoftwareApplication",
"identifier": "tsibble",
"name": "tsibble",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=tsibble"
},
{
"@type": "SoftwareApplication",
"identifier": "units",
"name": "units",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=units"
},
{
"@type": "SoftwareApplication",
"identifier": "purrr",
"name": "purrr",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=purrr"
},
{
"@type": "SoftwareApplication",
"identifier": "fontquiver",
"name": "fontquiver",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=fontquiver"
},
{
"@type": "SoftwareApplication",
"identifier": "rsvg",
"name": "rsvg",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=rsvg"
},
{
"@type": "SoftwareApplication",
"identifier": "svglite",
"name": "svglite",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=svglite"
}
],
"softwareRequirements": {
"1": {
"@type": "SoftwareApplication",
"identifier": "glue",
"name": "glue",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=glue"
},
"2": {
"@type": "SoftwareApplication",
"identifier": "lifecycle",
"name": "lifecycle",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=lifecycle"
},
"3": {
"@type": "SoftwareApplication",
"identifier": "rlang",
"name": "rlang",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=rlang"
},
"4": {
"@type": "SoftwareApplication",
"identifier": "fixest",
"name": "fixest",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=fixest"
},
"5": {
"@type": "SoftwareApplication",
"identifier": "lfe",
"name": "lfe",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=lfe"
},
"6": {
"@type": "SoftwareApplication",
"identifier": "stats",
"name": "stats"
},
"7": {
"@type": "SoftwareApplication",
"identifier": "tinyplot",
"name": "tinyplot",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=tinyplot"
},
"SystemRequirements": null
},
"fileSize": "200.383KB",
"releaseNotes": "https://github.com/ropensci/partialling.out/blob/master/NEWS.md",
"readme": "https://github.com/ropensci/partialling.out/blob/main/README.md",
"contIntegration": [
"https://app.codecov.io/gh/ropensci/partialling.out",
"https://github.com/ropensci/partialling.out/actions/workflows/R-CMD-check.yaml"
],
"developmentStatus": "https://lifecycle.r-lib.org/articles/stages.html#experimental",
"review": {
"@type": "Review",
"url": "https://github.com/ropensci/software-review/issues/703",
"provider": "https://ropensci.org"
}
}
GitHub Events
Total
- Issue comment event: 1
- Public event: 1
- Push event: 85
- Pull request review event: 1
- Pull request event: 2
- Fork event: 3
- Create event: 1
Last Year
- Issue comment event: 1
- Public event: 1
- Push event: 85
- Pull request review event: 1
- Pull request event: 2
- Fork event: 3
- Create event: 1
Dependencies
.github/workflows/R-CMD-check.yaml
actions
- actions/checkout v4 composite
- r-lib/actions/check-r-package v2 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/lint.yaml
actions
- actions/checkout v4 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/pkgdown.yaml
actions
- JamesIves/github-pages-deploy-action v4.5.0 composite
- actions/checkout v4 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/test-coverage.yaml
actions
- actions/checkout v4 composite
- actions/upload-artifact v4 composite
- codecov/codecov-action v4 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
DESCRIPTION
cran
- fixest * imports
- glue * imports
- lfe * imports
- lifecycle * imports
- rlang * imports
- stats * imports
- fwlplot * suggests
- knitr * suggests
- palmerpenguins * suggests
- rmarkdown * suggests
- tinyplot * suggests
- tinytable * suggests
- tinytest * suggests