### Install and Run csdid2 Analysis in Stata Source: https://github.com/friosavila/stpackages/blob/main/csdid2/README.md This snippet demonstrates how to install the csdid2 package, load data, run the core analysis, and then use the `estat` command to display results. It covers basic usage and the default output. ```stata * loads data from a repository ssc install frause frause mpdta, clear * This will generate everything, but show nothing! unless you request it. * this can be done using the options agg(attgt) or agg(group) etc . csdid2 lemp, ivar(countyreal) tvar(year) gvar(first) Always Treated units have been excluded ----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 ............ * However after that is done, you can just use estat to produce outcomes you want . estat event ``` -------------------------------- ### Run csdid2 Estat Command Directly in Stata Source: https://github.com/friosavila/stpackages/blob/main/csdid2/README.md This example demonstrates how to directly invoke the `estat` command for event study analysis using csdid2, bypassing the initial `csdid2` command for analysis execution. ```stata csdid2 event, estat ``` -------------------------------- ### Install and Run CSDID for DDD Analysis in Stata Source: https://github.com/friosavila/stpackages/blob/main/csdid2/ddd_csdid.ipynb This snippet shows how to install the 'frause' package, load the 'mpdta' dataset, generate a treatment group variable, and then run the 'csdid' command twice for two different groups. It saves the results to 'f1.dta' and 'f2.dta'. ```stata qui:ssc install frause, replace frause mpdta, clear ** Assume two groups, based on lpop gen g1=lpop>3.3 ** Now use csdid to estimate the model, without covariates csdid lemp if g1==0, ivar(countyreal) time(year) gvar(first_treat) saverif(f1) replace csdid lemp if g1==1, ivar(countyreal) time(year) gvar(first_treat) saverif(f2) replace ``` -------------------------------- ### Install Marginal Histogram Dependencies Source: https://github.com/friosavila/stpackages/blob/main/f_stat/graphs_fstat_sim_marhist_v2_270323.txt Installs the 'palette' and 'colrspace' packages required by the Marginal Histogram Stata command. It's recommended to update existing packages as well. ```stata ssc install palettes, replace ssc install colrspace, replace ado update, update ``` -------------------------------- ### JavaScript: Initialize MathJax or KaTeX for Math Typesetting Source: https://github.com/friosavila/stpackages/blob/main/jwdid/JWDID.html This JavaScript code initializes math typesetting for a given HTML element. It checks for the presence of `window.MathJax` or `window.katex` and calls their respective rendering functions. It's designed to be used within the Quarto publishing system. ```javascript const typesetMath = (el) => { if (window.MathJax) { // MathJax Typeset window.MathJax.typeset([el]); } else if (window.katex) { // KaTeX Render var mathElements = el.getElementsByClassName("math"); var macros = []; for (var i = 0; i < mathElements.length; i++) { var texText = mathElements[i].firstChild; if (mathElements[i].tagName == "SPAN") { window.katex.render(texText.data, mathElements[i], { displayMode: mathElements[i].classList.contains('display'), throwOnError: false, macros: macros, fleqn: false }); } } } } window.Quarto = { typesetMath }; ``` -------------------------------- ### JavaScript: Initialize Citation Hover Popovers Source: https://github.com/friosavila/stpackages/blob/main/jwdid/JWDID.html This script iterates through bibliography references on the page and sets up hover popovers using the tippy.js library. When a reference is hovered, it displays a popup containing the full citation details fetched from elements with IDs like 'ref-citekey'. ```javascript var bibliorefs = window.document.querySelectorAll('a[role="doc-biblioref"]'); for (var i=0; i res.text()) .then(html => { const parser = new DOMParser(); const htmlDoc = parser.parseFromString(html, "text/html"); const note = htmlDoc.getElementById(id); if (note !== null) { const html = processXRef(id, note); instance.setContent(html); } }).finally(() => { instance.enable(); instance.show(); }); } } else { // See if we can fetch a full url (with no hash to target) // This is a special case and we should probably do some content thinning / targeting fetch(url) .then(res => res.text()) .then(html => { const parser = new DOMParser(); const htmlDoc = parser.parseFromString(html, "text/html"); const note = htmlDoc.querySelector('main.content'); if (note !== null) { // This should only happen for chapter cross references // (since there is no id in the URL) // remove the first header if (note.children.length > 0 && note.children[0].tagName === "HEADER") { note.children[0].remove(); } const html = processXRef(null, note); instance.setContent(html); } }).finally(() => { instance.enable(); instance.show(); }); } }, function(instance) { }); } ``` -------------------------------- ### Draw Normal Distribution Samples - Python Source: https://github.com/friosavila/stpackages/blob/main/uci/CUI_stata.ipynb This snippet demonstrates how to draw samples from a normal distribution using Python within the stpackages framework. It utilizes the 'drawnorm' command to generate 'x1' through 'x8' based on a covariance matrix 'V' and a sample size of 9999. ```python capture frame create scu frame scu: { drawnorm x1 x2 x3 x4 x5 x6 x7 x8, cov(V) n(9999) } ``` -------------------------------- ### Estimate Poisson Model using jwdid Source: https://github.com/friosavila/stpackages/blob/main/jwdid/readme.md Demonstrates how to specify a Poisson regression model within the jwdid command for estimating nonlinear ETWFE models. This leverages the method() option to pass the 'poisson' model specification directly to the underlying estimation function. ```Stata jwdid y, ivar(i) tvar(t) gvar(g) never method(poisson) ``` -------------------------------- ### Plot estat Aggregation Results (Advanced Styling) Source: https://github.com/friosavila/stpackages/blob/main/jwdid/readme.md Allows for detailed customization of plots for estat aggregation results in Stata, including line styles, colors, and widths for pre and post-treatment periods. Options like 'pstyle#', 'color#', 'lwidth#', and 'barwidth#' can be used. The '#2' options are specific to 'event' aggregations. ```Stata estat plot, pstyle1(str) color1(str) pstyle2(str) color2(str) lwidth1(str) lwidth2(str) barwidth1(str) barwidth2(str) ``` -------------------------------- ### Store estat Results in Memory (post) Source: https://github.com/friosavila/stpackages/blob/main/jwdid/readme.md Posts the results of the estat command to be the current estimations in memory ('e()') in Stata, similar to the 'margins' command. This allows the results to be saved or used in subsequent analyses. This option is useful for immediate post-estimation tasks. ```Stata estat [aggregation], post ``` -------------------------------- ### Estimate Model Coefficients and Variance-Covariance Matrix (Python) Source: https://github.com/friosavila/stpackages/blob/main/uci/CUI_stata.ipynb This Python code snippet estimates a statistical model using the `jwdid` command, extracts the coefficients into a matrix `b`, and the variance-covariance matrix into a matrix `V`. It requires the `statsmodels` library and assumes data is loaded and preprocessed. ```python frause mpdta, clear jwdid lemp lpop, ivar( countyreal) tvar( year) gvar( first_treat) never estat event, post matrix b=e(b) matrix V=e(V) ``` -------------------------------- ### Specify Custom Weights in estat Command Source: https://github.com/friosavila/stpackages/blob/main/jwdid/readme.md Allows users to specify custom weights for the estimation of aggregated Average Treatment Effects (ATTEs) in Stata. This option is used when the default weights derived from the model estimation are not suitable for the analysis. The syntax involves appending 'pw = weight' to the estat command. ```Stata estat [aggregation] [pw = weight] ``` -------------------------------- ### Plot estat Aggregation Results (Basic Style) Source: https://github.com/friosavila/stpackages/blob/main/jwdid/readme.md Generates a plot of the estimated aggregated effects (time, group, or event) from the estat command in Stata. The 'style()' option allows selection of plot types like 'rspike', 'rarea', 'rcap', or 'rbar', with 'rspike' being the default. Further styling options are available. ```Stata estat plot, style(style) ``` -------------------------------- ### Marginal Histogram Stata Command Syntax Source: https://github.com/friosavila/stpackages/blob/main/f_stat/graphs_fstat_sim_marhist_v2_270323.txt Defines the syntax for the sim_marhist command in Stata, specifying variable lists, weights, and various options for customizing scatter plots and histograms. ```stata sim_marhist {varlist} {ifin} [{it:{help weight:weight}}] [,{cmd:{it:Twoway_Options}} {cmd:{it:lowess}} {cmd:{it:lowess_options}({it:{help twoway lowess##options:lowess_opts}})} {cmd:scatter_options}({it:options}) {cmd:hhistogram_options}([{it:{help histogram##continuous_opts:continuous_opts}} {c |} {it:{help histogram##discrete_opts:discrete_opts}}] {it:{help histogram##options:options}}) {cmd:vhistogram_options}([{it:{help histogram##continuous_opts:continuous_opts}} {c |} {it:{help histogram##discrete_opts:discrete_opts}}] {it:{help histogram##options:options}})] ``` -------------------------------- ### Estimate Model with Specific Covariate Interactions (Stata) Source: https://github.com/friosavila/stpackages/blob/main/jwdid/readme.md This command estimates a model where covariates can be interacted with time, group, or neither, offering granular control over heterogeneity. It requires specifying the dependent variable and the variables for time, group, and covariate interactions. ```stata jwdid y , ivar(i) tvar(t) gvar(g) never exogvar(x_ex) xtvar(x_t) xgvar(x_g) ``` -------------------------------- ### Highlight Code Lines Based on Annotations (JavaScript) Source: https://github.com/friosavila/stpackages/blob/main/jwdid/JWDID.html This JavaScript snippet defines functions for selecting and highlighting specific lines within code blocks based on annotations. It uses data attributes (`data-target-cell`, `data-target-annotation`, `data-code-lines`) to identify the target code cell and annotation, then calculates the position and height of the lines to be highlighted. It dynamically creates or updates a `div` element to visually mark these lines. ```javascript let selectedAnnoteEl; const selectorForAnnotation = ( cell, annotation) => { let cellAttr = 'data-code-cell="' + cell + '"'; let lineAttr = 'data-code-annotation="' + annotation + '"'; const selector = 'span\[' + cellAttr + '\]\[' + lineAttr + '\]'; return selector; } const selectCodeLines = (annoteEl) => { const doc = window.document; const targetCell = annoteEl.getAttribute("data-target-cell"); const targetAnnotation = annoteEl.getAttribute("data-target-annotation"); const annoteSpan = window.document.querySelector(selectorForAnnotation(targetCell, targetAnnotation)); const lines = annoteSpan.getAttribute("data-code-lines").split(","); const lineIds = lines.map((line) => { return targetCell + "-" + line; }); let top = null; let height = null; let parent = null; if (lineIds.length > 0) { //compute the position of the single el (top and bottom and make a div) const el = window.document.getElementById(lineIds[0]); top = el.offsetTop; height = el.offsetHeight; parent = el.parentElement.parentElement; if (lineIds.length > 1) { const lastEl = window.document.getElementById(lineIds[lineIds.length - 1]); const bottom = lastEl.offsetTop + lastEl.offsetHeight; height = bottom - top; } if (top !== null && height !== null && parent !== null) { // cook up a div (if necessary) and position it let div = window.document.getElementById("code-annotation-line-highlight"); if (div === null) { div = window.document.createElement("div"); div.setAttribute("id", "code-annotation-line-highlight"); div.style.position = 'absolute'; parent.appendChild(div); } div.style.top = top - 2 + "px"; div.style.height = height + 4 + "px"; div.style.left = 0; let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter"); if (gutterDiv === null) { gutterDiv = window.document.createElement("div"); gutterDiv.setAttribute("id", "code-annotation-line-highlight-gutter"); gutterDiv.style.position = 'absolute'; const codeCell = window.document.getElementById(targetCell); const gutter = code ``` -------------------------------- ### Merge Datasets and Summarize Treatment Effects in Stata Source: https://github.com/friosavila/stpackages/blob/main/csdid2/ddd_csdid.ipynb This snippet demonstrates merging two datasets (f1 and f2) in Stata and then summarizing the 'ATT' variable from both datasets after the merge. It assumes 'f1' is the master dataset and 'f2' is the using dataset, merged on a common key. The `sum` command provides basic statistics for the merged treatment effect variables. ```Stata use f1, clear merge 1:1 countyreal using f2 sum ATT_g1 ATT_g2 ``` -------------------------------- ### Aggregate CSDID Results using csdid_stats in Stata Source: https://github.com/friosavila/stpackages/blob/main/csdid2/ddd_csdid.ipynb This code demonstrates how to load the previously saved CSDID results ('f1.dta' and 'f2.dta'), use the 'csdid_stats' command to calculate aggregated statistics, rename the ATT variable to distinguish between groups, and then save the aggregated results back to their respective files. ```stata use f1, clear csdid_stats simple, save ren ATT ATT_g1 save f1, replace use f2, clear csdid_stats simple, save ren ATT ATT_g2 save f2, replace ``` -------------------------------- ### Estimate Quantile Regressions with Method of Moments (mmqreg) Source: https://context7.com/friosavila/stpackages/llms.txt The mmqreg command estimates quantile regressions using the method of moments. It supports multiple fixed effects absorption and joint estimation of multiple quantiles. Dependencies include ftools and hdfe packages. ```stata * Load NLS data webuse nlswork, clear * Install required packages ssc install ftools ssc install hdfe * Median regression with individual fixed effects mmqreg ln_wage age c.age#c.age ttl_exp c.ttl_exp#c.ttl_exp tenure \ c.tenure#c.tenure not_smsa south, abs(idcode) * Multiple quantiles (25th and 75th) with fixed effects mmqreg ln_wage age c.age#c.age ttl_exp c.ttl_exp#c.ttl_exp tenure \ c.tenure#c.tenure not_smsa south, abs(idcode) q(25 75) * Compare with and without fixed effects use http://fmwww.bc.edu/RePEc/bocode/o/oaxaca.dta, clear mmqreg lnwage i.female educ exper tenure i.isco, q(25 75) mmqreg lnwage i.female educ exper tenure, q(25 75) abs(isco) mmqreg lnwage educ exper tenure, q(25 75) abs(isco female) * Robust standard errors mmqreg lnwage educ exper tenure, q(25 50 75) robust * Clustered standard errors mmqreg lnwage educ exper tenure, q(25 50 75) cluster(isco) ``` -------------------------------- ### Calculate Percentiles for Confidence Interval Construction - Python Source: https://github.com/friosavila/stpackages/blob/main/uci/CUI_stata.ipynb This Python command calculates descriptive statistics for the 'tmax' variable, including percentiles. The output is used to determine the 95th percentile, which serves as the critical t-value for constructing a uniform confidence interval. ```python frame scu:sum tmax,d ``` -------------------------------- ### Save estat Results to a File Source: https://github.com/friosavila/stpackages/blob/main/jwdid/readme.md Saves the results of an estat aggregation in Stata to a specified file ('filename') as a '.ster' file. This allows the results to be loaded and used at a later point, facilitating reproducibility and data management. ```Stata estat [aggregation], esave(filename) ``` -------------------------------- ### Plot Quantile Regression Coefficients (qregplot) Source: https://context7.com/friosavila/stpackages/llms.txt The qregplot command generates plots of quantile regression coefficients across quantiles. It is compatible with various quantile regression commands including qreg, bsqreg, sqreg, mmqreg, and rifhdreg. It offers extensive customization options for publication-quality graphs. ```stata * Load data webuse womenwk, clear * Estimate base quantile regression qreg wage age education i.married children i.county * Plot all coefficients across quantiles 5-95 qregplot age education i.married children, q(5(2.5)95) estore(qp) * Add OLS comparison line qregplot age education i.married children, q(5(2.5)95) ols * Customize confidence interval appearance qregplot age education i.married children, q(5(2.5)95) ols raopt(color(black%5)) * Single column layout for combined graph qregplot age education i.married children, q(5(2.5)95) ols col(1) ysize(20) xsize(8) * Plot from stored estimates qregplot age education children, from(qp) * Use variable labels as titles qregplot age education children, from(qp) label * Custom titles for subplots qregplot age education children, from(qp) label \ mtitles("Age in years" "Years of education") * With bootstrap standard errors bsqreg wage age education i.married children i.county qregplot age education i.married children, q(5(5)95) * With unconditional quantile regression rifhdreg wage age education i.married children i.county, rif(q(50)) qregplot age education i.married children, q(5(5)95) * With method of moments quantile regression mmqreg wage age education i.married children qregplot age education i.married children, q(5(5)95) ``` -------------------------------- ### jwdid_estat simple: Average Treatment Effect for All Treated Source: https://github.com/friosavila/stpackages/blob/main/jwdid/readme.md The `estat simple` command calculates the average treatment effect on the treated for all observations that were treated at any point. The condition R is defined to include observations treated at or after their group's treatment time. ```stata jwdid_estat simple ``` -------------------------------- ### Store estat Results in Named Estimation Set Source: https://github.com/friosavila/stpackages/blob/main/jwdid/readme.md Stores the results from an estat aggregation in Stata under a specified name ('name') in memory. This is analogous to using 'estimation store name' after a regression command and does not overwrite previously estimated results from the 'jwdid' command. ```Stata estat [aggregation], estore(name) ``` -------------------------------- ### Compare Treatment Effects and Test for Differences in Stata Source: https://github.com/friosavila/stpackages/blob/main/csdid2/ddd_csdid.ipynb This snippet uses the `csdid_rif` command to generate a table comparing two treatment effect estimates ('ATT_g1' and 'ATT_g2'). It then uses the `test` command to perform a hypothesis test checking if the two treatment effects are statistically equal. This is useful for assessing the robustness of the estimated treatment effect. ```Stata csdid_rif ATT_g1 ATT_g2 test ATT_g1= ATT_g2 ``` -------------------------------- ### Include High-Order Fixed Effects (Stata) Source: https://github.com/friosavila/stpackages/blob/main/jwdid/readme.md This option allows for the inclusion of fixed effects beyond individual and time dimensions, useful for advanced modeling. It is only compatible with 'reghdfe' or 'ppmlhdfe' estimator methods and does not introduce further interactions for these fixed effects. ```stata reghdfe y x1 x2, fe(fe1 fe2) absorb(fe3) ``` ```stata ppmlhdfe y x1 x2, fe(fe1 fe2) absorb(fe3) ``` -------------------------------- ### Calculate Aggregated Average Treatment Effect on the Treated (ATT) Source: https://github.com/friosavila/stpackages/blob/main/jwdid/readme.md This snippet outlines the general formula for calculating aggregated average treatment effects on the treated (AGGTE). It involves predicting outcomes under observed covariates and a counterfactual scenario of no treatment, then aggregating these differences based on specific conditions and weights. ```mathematica AGGTE_r = ( Sum[ATT_i * w_{i,t} * R_{i,t}, {i, N}] ) / ( Sum[w_{i,t} * R_{i,t}, {i, N}] ) ``` -------------------------------- ### Estimate DID Model with Pre-Treatment Effects using jwdid Source: https://github.com/friosavila/stpackages/blob/main/jwdid/readme.md Estimates a Difference-in-Differences (DID) model that allows for flexible pre-treatment effects using the `jwdid` command with the `never` option. This specification is useful for testing the parallel trends assumption and estimating treatment effects across all relative periods. It includes individual and time fixed effects. ```stata jwdid y, ivar(i) tvar(t) gvar(g) never ``` -------------------------------- ### JavaScript: Select and Unselect Code Lines with Annotations Source: https://github.com/friosavila/stpackages/blob/main/jwdid/JWDID.html This JavaScript function selects and highlights code lines, displaying associated annotations. It manages the visual state of highlighted lines and their corresponding gutter elements. It also handles unselecting lines and removing associated elements. ```javascript const selectCodeLines = (annoteEl) => { const elRect = annoteEl.getBoundingClientRect(); const top = elRect.top; const height = elRect.height; let selectedAnnoteEl = undefined; const gutter = window.document.querySelector('.code-annotation-gutter'); if (!gutter) { return; } const gutterDiv = window.document.createElement('div'); gutterDiv.id = 'code-annotation-line-highlight-gutter'; gutterDiv.style.top = top - 2 + "px"; gutterDiv.style.height = height + 4 + "px"; gutter.appendChild(gutterDiv); selectedAnnoteEl = annoteEl; }; const unselectCodeLines = () => { const elementsIds = ["code-annotation-line-highlight", "code-annotation-line-highlight-gutter"]; elementsIds.forEach((elId) => { const div = window.document.getElementById(elId); if (div) { div.remove(); } }); selectedAnnoteEl = undefined; }; ``` -------------------------------- ### Custom Weights for Aggregated ATTs (estat, pw=weight) Source: https://github.com/friosavila/stpackages/blob/main/jwdid/JWDID.html Allows users to specify custom weights for the estimation of aggregated ATTs. The default uses weights from the model estimation. The syntax is `estat [aggregation] [pw = weight]`, where 'weight' is the variable containing the desired weights. ```stata estat [aggregation], pw(weight_variable) ``` -------------------------------- ### JavaScript: Event Listener for Code Annotation Clicks Source: https://github.com/friosavila/stpackages/blob/main/jwdid/JWDID.html This script attaches click event listeners to elements that trigger code annotations. When an annotation element is clicked, it handles selecting or unselecting the code lines and updating the active state of the clicked element. ```javascript const annoteDls = window.document.querySelectorAll('dt[data-target-cell]'); for (const annoteDlNode of annoteDls) { annoteDlNode.addEventListener('click', (event) => { const clickedEl = event.target; if (clickedEl !== selectedAnnoteEl) { unselectCodeLines(); const activeEl = window.document.querySelector('dt[data-target-cell].code-annotation-active'); if (activeEl) { activeEl.classList.remove('code-annotation-active'); } selectCodeLines(clickedEl); clickedEl.classList.add('code-annotation-active'); } else { unselectCodeLines(); clickedEl.classList.remove('code-annotation-active'); } }); } ``` -------------------------------- ### Parallel Trends Test using estat event Source: https://github.com/friosavila/stpackages/blob/main/jwdid/readme.md When using `estat event` with the `never` option, the `pretrend` option can be used to conduct a parallel trends test. This tests the null hypothesis that aggregated treatment effects are zero for all periods before treatment. ```stata jwdid_estat event, pretrend ``` -------------------------------- ### jwdid_estat time: Average Treatment Effect at Specific Times Source: https://github.com/friosavila/stpackages/blob/main/jwdid/readme.md The `estat time` command calculates the average treatment effect at a specific time (t_c) for observations treated at that point. It estimates this for all relevant time periods with treated units. ```stata jwdid_estat time ``` -------------------------------- ### Plot estat Aggregation Results (Twoway Options) Source: https://github.com/friosavila/stpackages/blob/main/jwdid/readme.md Enables the use of most standard Stata 'twoway' graph options directly with the 'estat plot' command. This provides extensive flexibility in customizing the appearance of the generated plots for aggregated effects. ```Stata estat plot, twoway_options ``` -------------------------------- ### Create Joy Plots and Violin Plots with joy_plot in Stata Source: https://context7.com/friosavila/stpackages/llms.txt The `joy_plot` command in Stata generates joy plots (ridge plots) and violin plots to visualize data distributions across different groups. It allows for customization of colors, legends, and the display of interquartile range markers. The command can also perform two-way comparisons and overlay plots. ```stata * Load data use http://fmwww.bc.edu/RePEc/bocode/o/oaxaca.dta, clear * Create grouping variable gen mstatus = single + 2*married + 3*divorced label define mstatus 1 "Single" 2 "Married" 3 "Divorced" label values mstatus mstatus * Basic joy plot joy_plot lnwage, over(mstatus) * With legend instead of text labels joy_plot lnwage, over(mstatus) alegend notext * Custom colors joy_plot lnwage, over(mstatus) alegend color(navy gold) * Using colorpalette joy_plot lnwage, over(mstatus) alegend colorpalette(blues) notext * With interquartile range markers joy_plot lnwage, over(mstatus) iqr right \ title("Wages distribution") subtitle("by Marital Status") * Restricted range joy_plot lnwage, over(mstatus) iqr range(2 5) \ title("Wages distribution") subtitle("by Marital Status") * Two-way comparison: gender within marital status joy_plot lnwage, over(mstatus) by(female) \ title("Wages distribution") subtitle("by Marital Status") * Violin plot joy_plot lnwage, over(mstatus) by(female) \ title("Wages distribution") subtitle("by Marital Status and Gender") violin * Overlay plots by marital status within gender joy_plot lnwage, by(mstatus) over(female) \ title("Wages distribution") subtitle("by Marital Status and Gender") ``` -------------------------------- ### Manage csdid2 Data in Memory and Disk in Stata Source: https://github.com/friosavila/stpackages/blob/main/csdid2/README.md This snippet shows how to clear data currently held in memory by csdid2, save the analysis results to disk for later use, and then load them back into memory. ```stata csdid2 , clear csdid2 save_ex1, save clear all csdid2 save_ex1, load ``` -------------------------------- ### Estimate Baseline DID Model with Panel Data using jwdid Source: https://github.com/friosavila/stpackages/blob/main/jwdid/readme.md Estimates the baseline Difference-in-Differences (DID) model for panel data using the `jwdid` command. It requires specifying the dependent variable, individual identifier, time identifier, and group identifier. Assumes clustered standard errors at the individual level by default. ```stata jwdid y, ivar(i) tvar(t) gvar(g) ``` -------------------------------- ### Estimate Unconditional Standard Errors with estat Source: https://github.com/friosavila/stpackages/blob/main/jwdid/readme.md Enables the estimation of unconditional standard errors for aggregated ATTEs in Stata, as suggested by Wooldridge (2021). This requires the underlying command to support Score calculations, such as when 'method(regress)' is used. It is not compatible with 'reghdfe' or 'ppmlhdfe' default methodologies. ```Stata estat [aggregation], [vce(unconditional)] ``` -------------------------------- ### Specify Treatment Heterogeneity Type in jwdid (Stata) Source: https://github.com/friosavila/stpackages/blob/main/jwdid/JWDID.html This command shows how to specify different types of treatment effect heterogeneity in the jwdid Stata command. Options include 'time', 'cohort', or 'event' to model how treatment effects vary. ```stata jwdid y, ivar(i) tvar(t) gvar(g) hettype(option) ```