Skip to content

Commit

Permalink
Deploying to gh-pages from @ dad7bb8 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
kazuyanagimoto committed Apr 2, 2024
1 parent 20257fd commit 3ba89cc
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
Binary file modified freeze.rds
Binary file not shown.
8 changes: 4 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -277,13 +277,13 @@ <h2 id="toc-title">On this page</h2>
<section id="unitdid" class="level1">
<h1>unitdid</h1>
<!-- badges: start -->
<!-- badges: end -->
<p><a href="https://kazuyanagimoto.r-universe.dev/unitdid"><img src="https://kazuyanagimoto.r-universe.dev/badges/unitdid.png" class="img-fluid" alt="unitdid status badge"></a> <a href="https://github.com/kazuyanagimoto/unitdid/blob/main/LICENSE.md" target="_blank"><img src="https://img.shields.io/badge/license-MIT-blue"></a> <a href="https://kazuyanagimoto.com/unitdid/index.html"><img src="https://img.shields.io/badge/docs-homepage-blue.svg" class="img-fluid" alt="Docs"></a> <!-- badges: end --></p>
<p>The <code>unitdid</code> package provides a set of functions for the analysis of the unit-level difference-in-differences (<a href="https://arxiv.org/abs/2403.19563">Arkhangelsky, Yanagimoto, and Zohar 2024</a>).</p>
<section id="installation" class="level2">
<h2 class="anchored" data-anchor-id="installation">Installation</h2>
<p>You can install the development version of unitdid from <a href="https://github.com/kazuyanagimoto/unitdid">GitHub</a> with:</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="co"># install.packages("remotes")</span></span>
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a>remotes<span class="sc">::</span><span class="fu">install_github</span>(<span class="st">"kazuyanagimoto/unitdid"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<p>You can install the development version of unitdid from R-universe with:</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">install.packages</span>(<span class="st">'unitdid'</span>,</span>
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a> <span class="at">repos =</span> <span class="st">'https://kazuyanagimoto.r-universe.dev'</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</section>
<section id="example" class="level2">
<h2 class="anchored" data-anchor-id="example">Example</h2>
Expand Down
4 changes: 2 additions & 2 deletions search.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
"href": "index.html",
"title": "unitdid",
"section": "",
"text": "The unitdid package provides a set of functions for the analysis of the unit-level difference-in-differences (Arkhangelsky, Yanagimoto, and Zohar 2024).\n\n\nYou can install the development version of unitdid from GitHub with:\n# install.packages(\"remotes\")\nremotes::install_github(\"kazuyanagimoto/unitdid\")\n\n\n\nThis is a basic example with the simulated base_heterocp data set:\n\nlibrary(unitdid)\nlibrary(dplyr)\nlibrary(ggplot2)\n\nbase_heterocp |&gt;\n head()\n#&gt; # A tibble: 6 × 5\n#&gt; id year byear cyear y\n#&gt; &lt;int&gt; &lt;int&gt; &lt;int&gt; &lt;int&gt; &lt;dbl&gt;\n#&gt; 1 1 1999 1955 1985 -0.848\n#&gt; 2 1 2000 1955 1985 0.759\n#&gt; 3 1 2001 1955 1985 -1.03 \n#&gt; 4 1 2002 1955 1985 0.858\n#&gt; 5 1 2003 1955 1985 -0.866\n#&gt; 6 1 2004 1955 1985 -0.651\n\nIndividual-level child penalties are estimated by unitdid():\n\nmdl_base &lt;- base_heterocp |&gt;\n unitdid(yname = \"y\",\n iname = \"id\",\n tname = \"year\",\n ename = \"cyear\",\n bname = \"byear\")\n\n# Estimated individual-level child penalties (y_tilde)\nget_unitdid(mdl_base)\n#&gt; # A tibble: 32,257 × 6\n#&gt; id year byear cyear y y_tilde\n#&gt; &lt;int&gt; &lt;int&gt; &lt;int&gt; &lt;int&gt; &lt;dbl&gt; &lt;dbl&gt;\n#&gt; 1 705 2000 1957 2000 0.138 -0.0287 \n#&gt; 2 997 2000 1958 2000 0.138 0.0849 \n#&gt; 3 998 2000 1958 2000 0.119 -0.104 \n#&gt; 4 1013 2000 1958 2000 0.115 -0.0000709\n#&gt; 5 1082 2000 1958 2000 0.0362 0.00549 \n#&gt; 6 1127 2000 1958 2000 0.386 0.125 \n#&gt; 7 1225 2001 1959 2001 0.158 -0.118 \n#&gt; 8 1228 2000 1959 2000 0.241 -0.0937 \n#&gt; 9 1228 2001 1959 2000 0.443 0.0226 \n#&gt; 10 1230 2000 1959 2000 0.143 -0.0266 \n#&gt; # ℹ 32,247 more rows\n\n\n\nThey can be aggregated to the full, event (year at event (treatment). Mainly for staggered DiD design), event_age (age at event. Mainly for child penalties) levels:\n\nsummary(mdl_base) # default agg = \"full\"\n#&gt; # A tibble: 6 × 3\n#&gt; mean rel_time n\n#&gt; &lt;dbl&gt; &lt;int&gt; &lt;dbl&gt;\n#&gt; 1 -0.0653 0 4357\n#&gt; 2 -0.193 1 4357\n#&gt; 3 -0.307 2 4357\n#&gt; 4 -0.310 3 4357\n#&gt; 5 -0.350 4 4357\n#&gt; 6 -0.349 5 4357\n\n\nsum_eage &lt;- summary(mdl_base, agg = \"event_age\")\n\nsum_eage |&gt;\n filter(rel_time == 0) |&gt;\n mutate(rel_time = -1,\n mean = 0) |&gt;\n bind_rows(sum_eage) |&gt;\n filter(between(event_age, 25, 34)) |&gt;\n mutate(lbl_facet = paste0(\"Age \", event_age)) |&gt;\n ggplot(aes(x = rel_time, y = mean)) +\n geom_point() +\n geom_line() +\n geom_vline(xintercept = -1, linetype = \"dashed\") +\n geom_hline(yintercept = 0) +\n facet_wrap(~lbl_facet, ncol = 5) +\n labs(x = \"Time to First Childbirth\",\n y = \"Child Penalties on y\") +\n theme_minimal() +\n theme(panel.grid.major.x = element_blank(),\n panel.grid.minor = element_blank())\n\n\n\n\n\n\n\n\n\n\n\nSince the individual-level child penalties are estimated with measurement errors, the variance of the y_tilde is not equal to the variance of the individual-level child penalties.\nThe compute_varcov = \"var\" option of the unitdid estimates the variance of the measurement errors and the variance of the individual-level child penalties by subtracting the variance of the measurement errors from the variance of y_tilde\n\nmdl_base &lt;- base_heterocp |&gt;\n unitdid(yname = \"y\",\n iname = \"id\",\n tname = \"year\",\n ename = \"cyear\",\n bname = \"byear\",\n compute_varcov = \"var\")\n\nsum_eage &lt;- summary(mdl_base, agg = \"event_age\")\n\nsum_eage |&gt;\n filter(rel_time == 0) |&gt;\n mutate(rel_time = -1,\n var = 0) |&gt;\n bind_rows(sum_eage) |&gt;\n filter(between(event_age, 25, 34)) |&gt;\n mutate(lbl_facet = paste0(\"Age \", event_age)) |&gt;\n ggplot(aes(x = rel_time, y = sqrt(var))) +\n geom_point() +\n geom_line() +\n geom_vline(xintercept = -1, linetype = \"dashed\") +\n geom_hline(yintercept = 0) +\n facet_wrap(~lbl_facet, ncol = 5) +\n labs(x = \"Time to First Childbirth\",\n y = \"S.D. of Child Penalties\") +\n theme_minimal() +\n theme(panel.grid.major.x = element_blank(),\n panel.grid.minor = element_blank())\n\n\n\n\n\n\n\n\n\n\n\n\nArkhangelsky, Dmitry, Kazuharu Yanagimoto, and Tom Zohar. 2024. “Flexible Analysis of Individual Heterogeneity in Event Studies: Application to the Child Penalty.” arXiv. https://arxiv.org/abs/2403.19563.",
"text": "The unitdid package provides a set of functions for the analysis of the unit-level difference-in-differences (Arkhangelsky, Yanagimoto, and Zohar 2024).\n\n\nYou can install the development version of unitdid from R-universe with:\ninstall.packages('unitdid',\n repos = 'https://kazuyanagimoto.r-universe.dev')\n\n\n\nThis is a basic example with the simulated base_heterocp data set:\n\nlibrary(unitdid)\nlibrary(dplyr)\nlibrary(ggplot2)\n\nbase_heterocp |&gt;\n head()\n#&gt; # A tibble: 6 × 5\n#&gt; id year byear cyear y\n#&gt; &lt;int&gt; &lt;int&gt; &lt;int&gt; &lt;int&gt; &lt;dbl&gt;\n#&gt; 1 1 1999 1955 1985 -0.848\n#&gt; 2 1 2000 1955 1985 0.759\n#&gt; 3 1 2001 1955 1985 -1.03 \n#&gt; 4 1 2002 1955 1985 0.858\n#&gt; 5 1 2003 1955 1985 -0.866\n#&gt; 6 1 2004 1955 1985 -0.651\n\nIndividual-level child penalties are estimated by unitdid():\n\nmdl_base &lt;- base_heterocp |&gt;\n unitdid(yname = \"y\",\n iname = \"id\",\n tname = \"year\",\n ename = \"cyear\",\n bname = \"byear\")\n\n# Estimated individual-level child penalties (y_tilde)\nget_unitdid(mdl_base)\n#&gt; # A tibble: 32,257 × 6\n#&gt; id year byear cyear y y_tilde\n#&gt; &lt;int&gt; &lt;int&gt; &lt;int&gt; &lt;int&gt; &lt;dbl&gt; &lt;dbl&gt;\n#&gt; 1 705 2000 1957 2000 0.138 -0.0287 \n#&gt; 2 997 2000 1958 2000 0.138 0.0849 \n#&gt; 3 998 2000 1958 2000 0.119 -0.104 \n#&gt; 4 1013 2000 1958 2000 0.115 -0.0000709\n#&gt; 5 1082 2000 1958 2000 0.0362 0.00549 \n#&gt; 6 1127 2000 1958 2000 0.386 0.125 \n#&gt; 7 1225 2001 1959 2001 0.158 -0.118 \n#&gt; 8 1228 2000 1959 2000 0.241 -0.0937 \n#&gt; 9 1228 2001 1959 2000 0.443 0.0226 \n#&gt; 10 1230 2000 1959 2000 0.143 -0.0266 \n#&gt; # ℹ 32,247 more rows\n\n\n\nThey can be aggregated to the full, event (year at event (treatment). Mainly for staggered DiD design), event_age (age at event. Mainly for child penalties) levels:\n\nsummary(mdl_base) # default agg = \"full\"\n#&gt; # A tibble: 6 × 3\n#&gt; mean rel_time n\n#&gt; &lt;dbl&gt; &lt;int&gt; &lt;dbl&gt;\n#&gt; 1 -0.0653 0 4357\n#&gt; 2 -0.193 1 4357\n#&gt; 3 -0.307 2 4357\n#&gt; 4 -0.310 3 4357\n#&gt; 5 -0.350 4 4357\n#&gt; 6 -0.349 5 4357\n\n\nsum_eage &lt;- summary(mdl_base, agg = \"event_age\")\n\nsum_eage |&gt;\n filter(rel_time == 0) |&gt;\n mutate(rel_time = -1,\n mean = 0) |&gt;\n bind_rows(sum_eage) |&gt;\n filter(between(event_age, 25, 34)) |&gt;\n mutate(lbl_facet = paste0(\"Age \", event_age)) |&gt;\n ggplot(aes(x = rel_time, y = mean)) +\n geom_point() +\n geom_line() +\n geom_vline(xintercept = -1, linetype = \"dashed\") +\n geom_hline(yintercept = 0) +\n facet_wrap(~lbl_facet, ncol = 5) +\n labs(x = \"Time to First Childbirth\",\n y = \"Child Penalties on y\") +\n theme_minimal() +\n theme(panel.grid.major.x = element_blank(),\n panel.grid.minor = element_blank())\n\n\n\n\n\n\n\n\n\n\n\nSince the individual-level child penalties are estimated with measurement errors, the variance of the y_tilde is not equal to the variance of the individual-level child penalties.\nThe compute_varcov = \"var\" option of the unitdid estimates the variance of the measurement errors and the variance of the individual-level child penalties by subtracting the variance of the measurement errors from the variance of y_tilde\n\nmdl_base &lt;- base_heterocp |&gt;\n unitdid(yname = \"y\",\n iname = \"id\",\n tname = \"year\",\n ename = \"cyear\",\n bname = \"byear\",\n compute_varcov = \"var\")\n\nsum_eage &lt;- summary(mdl_base, agg = \"event_age\")\n\nsum_eage |&gt;\n filter(rel_time == 0) |&gt;\n mutate(rel_time = -1,\n var = 0) |&gt;\n bind_rows(sum_eage) |&gt;\n filter(between(event_age, 25, 34)) |&gt;\n mutate(lbl_facet = paste0(\"Age \", event_age)) |&gt;\n ggplot(aes(x = rel_time, y = sqrt(var))) +\n geom_point() +\n geom_line() +\n geom_vline(xintercept = -1, linetype = \"dashed\") +\n geom_hline(yintercept = 0) +\n facet_wrap(~lbl_facet, ncol = 5) +\n labs(x = \"Time to First Childbirth\",\n y = \"S.D. of Child Penalties\") +\n theme_minimal() +\n theme(panel.grid.major.x = element_blank(),\n panel.grid.minor = element_blank())\n\n\n\n\n\n\n\n\n\n\n\n\nArkhangelsky, Dmitry, Kazuharu Yanagimoto, and Tom Zohar. 2024. “Flexible Analysis of Individual Heterogeneity in Event Studies: Application to the Child Penalty.” arXiv. https://arxiv.org/abs/2403.19563.",
"crumbs": [
"Home"
]
Expand All @@ -133,7 +133,7 @@
"href": "index.html#installation",
"title": "unitdid",
"section": "",
"text": "You can install the development version of unitdid from GitHub with:\n# install.packages(\"remotes\")\nremotes::install_github(\"kazuyanagimoto/unitdid\")",
"text": "You can install the development version of unitdid from R-universe with:\ninstall.packages('unitdid',\n repos = 'https://kazuyanagimoto.r-universe.dev')",
"crumbs": [
"Home"
]
Expand Down
4 changes: 2 additions & 2 deletions vignettes/base_heterocp.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">

<meta name="author" content="Kazuharu Yanagimoto">
<meta name="dcterms.date" content="2024-03-29">
<meta name="dcterms.date" content="2024-04-02">

<title>unitdid - Data Generation Process of base_heterocp</title>
<style>
Expand Down Expand Up @@ -323,7 +323,7 @@ <h1 class="title">Data Generation Process of base_heterocp</h1>
<div>
<div class="quarto-title-meta-heading">Published</div>
<div class="quarto-title-meta-contents">
<p class="date">March 29, 2024</p>
<p class="date">April 2, 2024</p>
</div>
</div>

Expand Down
4 changes: 2 additions & 2 deletions vignettes/example_psid.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">

<meta name="author" content="Kazuharu Yanagimoto">
<meta name="dcterms.date" content="2024-03-29">
<meta name="dcterms.date" content="2024-04-02">

<title>unitdid - Individual-level Child Penalties with PSID</title>
<style>
Expand Down Expand Up @@ -313,7 +313,7 @@ <h1 class="title">Individual-level Child Penalties with PSID</h1>
<div>
<div class="quarto-title-meta-heading">Published</div>
<div class="quarto-title-meta-contents">
<p class="date">March 29, 2024</p>
<p class="date">April 2, 2024</p>
</div>
</div>

Expand Down

0 comments on commit 3ba89cc

Please sign in to comment.