Skip to content

Commit 995c8bb

Browse files
talgalilimeta-codesync[bot]
authored andcommitted
Add post-stratification tutorial page (mdx) (#142)
Summary: Pull Request resolved: #142 This adds a documentation page that embeds the post-stratification tutorial notebook as HTML on the balance website. This is split from the previous diff because the MDX file references a URL that the original diff cannot see, causing validation errors. ``` Error: Unable to build website for locale en. Error: Error: Docusaurus found broken links! Please check the pages of your site in the list below, and make sure you don't reference any path that does not exist. Note: it's possible to ignore broken links with the 'onBrokenLinks' Docusaurus configuration, and let the build pass. Exhaustive list of all broken links found: - On source page path = /docs/docs/statistical_methods/poststratify/: -> linking to ../../tutorials/quickstart_poststratify/ (resolved as: /docs/docs/tutorials/quickstart_poststratify/) at throwError (/home/runner/work/balance/balance/website/node_modules/docusaurus/logger/lib/index.js:76:11) at handleBrokenLinks (/home/runner/work/balance/balance/website/node_modules/docusaurus/core/lib/server/brokenLinks.js:153:47) at async buildLocale (/home/runner/work/balance/balance/website/node_modules/docusaurus/core/lib/commands/build.js:186:5) at async tryToBuildLocale (/home/runner/work/balance/balance/website/node_modules/docusaurus/core/lib/commands/build.js:41:20) at async mapAsyncSequential (/home/runner/work/balance/balance/website/node_modules/docusaurus/utils/lib/jsUtils.js:34:24) at async Command.build (/home/runner/work/balance/balance/website/node_modules/docusaurus/core/lib/commands/build.js:76:21) [INFO] Docusaurus version: 2.4.3 Node version: v18.20.8 error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. Error: Process completed with exit code 1. ``` NOTE: this can only be tested after the previous diff has landed. Differential Revision: D86857631 fbshipit-source-id: 6b524cc89aa00b32508ec2e314a0a21ef0999fe7
1 parent df844ab commit 995c8bb

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

website/docs/docs/statistical_methods/poststratify.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ Similarly, we can compute the weight for people from each cell in the table:
5858
Below are two short code examples that show how to run ``balance.weighting_methods.poststratify`` on the simulated data shipped
5959
with the package. They rely on ``balance.load_data`` so you can copy-paste the
6060
cells into a notebook, or refer to the new
61+
[post-stratification tutorial](https://import-balance.org/docs/tutorials/quickstart_poststratify/).
6162

6263
> **Tip:** For clarity we drop rows where any of the adjustment variables are
6364
> missing, because the default ``strict_matching=True`` requires that every

website/docs/tutorials/index.mdx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ If you are new to balance, we suggest getting started with the [balance Quicksta
1313
1. [**quickstart**](./quickstart) - this is based on a simulated data and presents the simple end-to-end workflow of balance package with default arguments. It demonstrates the process from reading the data, through understanding the biases in the sample, producing weights, evaluating the results and producing the population estimations.
1414
2. [**quickstart_cbps**](./quickstart_cbps) - like the [**quickstart**](./quickstart) tutorial, but shows how to use the CBPS algorithm and compares the results to IPW (logistic regression with LASSO).
1515
3. [**quickstart_rake**](./quickstart_rake) - like the [**quickstart**](./quickstart) tutorial, but shows how to use the rake (raking) algorithm and compares the results to IPW (logistic regression with LASSO).
16-
4. [**balance_transformations_and_formulas**](./balance_transformations_and_formulas) - This tutorial showcases ways in which transformations, formulas and penalty can be included in your pre-processing of the covariates before adjusting for them.
17-
5. [**comparing_cbps_in_r_vs_python_using_sim_data**](./comparing_cbps_in_r_vs_python_using_sim_data) - This notebook compares the results of running CBPS in R and Python. In R using the `BCPS` package, and in Python using the `balance` package. The results are almost identical.
16+
4. [**quickstart_poststratify**](./quickstart_poststratify) - focuses on post-stratification, highlighting how to match either a single marginal distribution or the full joint distribution of two covariates.
17+
5. [**balance_transformations_and_formulas**](./balance_transformations_and_formulas) - This tutorial showcases ways in which transformations, formulas and penalty can be included in your pre-processing of the covariates before adjusting for them.
18+
6. [**comparing_cbps_in_r_vs_python_using_sim_data**](./comparing_cbps_in_r_vs_python_using_sim_data) - This notebook compares the results of running CBPS in R and Python. In R using the `BCPS` package, and in Python using the `balance` package. The results are almost identical.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
title: Quickstart_poststratify
3+
sidebar_position: 5
4+
hide_table_of_contents: true
5+
hide_title: true
6+
---
7+
8+
import HTMLLoader from '@site/src/components/HTMLLoader';
9+
import useBaseUrl from '@docusaurus/useBaseUrl';
10+
11+
Link to notebook: [balance_quickstart_poststratify.ipynb](https://github.com/facebookresearch/balance/blob/main/tutorials/balance_quickstart_poststratify.ipynb)
12+
13+
<HTMLLoader docFile={useBaseUrl('html/tutorials/balance_quickstart_poststratify.html')}/>

0 commit comments

Comments
 (0)