# Questions tagged [stata]

A statistical software package. Use this tag for any on-topic question that (a) involves Stata either as a critical part of the question or expected answer, & (b) is not just about how to use Stata.

1,523 questions
Filter by
Sorted by
Tagged with
19 views

### Calculating p-values [closed]

My code below aggregates the estimates from individual event-study regressions, to calculate the average effect of all treatment. The average effect is conceptually equivalent to the output of a ...
15 views

### Difference between xtreg and reghdfe [closed]

When I try to set my panel data with the following command in Stata xtset familyid MatricYear I get the following error ...
• 1,351
4 views

### Data preparation for multistate modelling

I need to use multi-state modelling using Stata Software for which I need to prepare the data. My data consists of disease diagnosis and dates of diagnosis. I need to understand how can I create the ...
1 vote
32 views

### Looped Regression and Inference in Stata or R

I have a sample of panel data and am running regressions on a loop for values of a specific categorical variable. For illustration: $$y_{it} = \alpha_i + \eta_t + \beta^C D_{it} + \epsilon_{it}$$ ...
20 views

### How should I test for parallel trend assumption in a repeated cross-sectional data?

I have a repeated cross-sectional dataset on time-use which I am using to estimate the impact of a certain shock. My outcome of interest is time spent by certain individual on particular activity. ...
32 views

### Multivariate Analysis for Personal Hygiene Product Survey

I conducted a survey involving 5 different personal hygiene products. Each product had 6 different brands, and participants were asked to select one or more brands they preferred for each product. In ...
65 views

### Diff-in-diff with an unbalanced panel

Say I want to study the effect of some intervention using a diff-in-diff setup. I have a panel of units observed during some period. I can identify treated/non-treated groups and pre/post periods (...
1 vote
38 views

### Interpreting a coefficient of a predictor not involved in an interaction term in a linear regression model with an interaction

I have the following output from Stata (see below), which is based on a linear regression model with an interaction term (female*region) and an independently added continuous predictor of age. The ...
• 335
1 vote
43 views

### Staggered diff-in-diff vs Stacked diff-in-diff

Just trying to better understand what really is the technical difference between staggered diff-in-diff and stacked diff-in-diff. I understand that TWFE staggered DiD has its own troubles and that ...
48 views

### statsmodels: Update OLS' degrees of freedom when absorbing 3+ fixed effects

I want to run an OLS regression with 3+ fixed effects. (Whether this is a good idea is out of the scope of this question). I can do it using Stata: ...
• 138
34 views

### Difference between reghdfe and fixest for a multiple FE regression?

I am estimating the following equation using fixest: $$Y_{i,f,s,t} = \beta_1 treat_i + \beta_2 post_t + \beta_3 treat_i*post_t + \alpha_i + \alpha_{s,t} + \alpha_{f,t} + \epsilon_{i,f,s,t}$$ where ...
• 31
19 views

### Firm Fixed Effects Model dropping Sector Dummies? Potential Solution?

For my thesis, I am using panel data with stock returns and other firm data. I first used an event study to calculate abnormal returns (with event window of 7 days so 7 observations for 500 firms) ...
73 views

### What is the R Equivalent of this Stata Survey Weighting Code?

I am working with the SIPP data set and they use replicate weights. They offer advice here for what code you should use in Stata or SAS for applying their replicate weights correctly. Specifically ...
• 117
38 views

### Understanding differences in collinearity across Stata commands

Here's a simple example of a regression of y on x including time and id fixed-effects and both a linear and a quadratic time trend. If my t starts at 1, these 3 different regressions get the same ...
• 15
24 views

### Diff-in-diff with balanced panel: adding fixed effects does not change coefficients?

I'm trying to run a differences-in-differences model in Stata. My dependent variable is order volumes, each observation is 1 store, and my panel is strongly balanced (20 quarters for each store, 6K ...
• 1
101 views

### Fixed effects regression: reghdfe vs reg with dummies (stata)

I am trying to understand what is the difference between running a regression with a bunch of fixed effects by directly creating the dummies versus using reghdfe. Below a minimal working example: <...
• 157
853 views

### Regressors Became Statistically Insignificant Upon Correcting for Autocorrelation

I am using Stata and used the regress command and received $p$ values that indicate the regressor is statistically significant. However, after plotting the residuals, I noticed there was clearly an ...
38 views

### How to specify gravity model of trade with intranational (domestic) trade flows?

Having read the literature on gravity models, I would like to estimate one myself. Focusing on cross-section only for now, they take the general form: lnTRADEij = aXi + bXj + cZij + eij where ...
13 views

### Regressions with different time periods

I'm trying to run a pooled OLS and fixed effects regression model using panel data but my problem is that my independent variables are measured monthly while my dependent variable is measured annually....
32 views

### Parallel Trend and DID Estimation

I am trying to estimate the effect of climate shock on hours spent in paid labor by women. The key independent variables are time dummy (that takes 1 if shock happened, 0 otherwise; there are two pre-...
9 views

### Which variables should I include/exclude in my regression analysis for GDP? [duplicate]

I am wanting to establish the impact mobile money has on Kenyan economic growth. I am building my regression model and have collected data for GDP, consumption, government spending, investment, net ...
63 views

### Double selection lasso in and NA's handling

I work in a team where everyone uses Stata, and I work in R. I have created an efficient workflow that allows me to export the results quickly. The problem I ran into was when implementing the double ...
• 151
23 views

### Controlling for Time-Varying Work Factors in Dynamic DID Analysis: Handling Staggered Adoption of Child Care Leave

I'm working on a dynamic Difference-in-Differences (DID) analysis to assess the impact of child care leave on individuals' wages over their working life. My database includes information on the date ...
18 views

### Using diff-in-diff and fixed effects in Stata

I am doing research using Stata on state-level contraception policy effects on male labour outcomes (e.g. wages). I am utilizing the laws between 1960 and 1976 when Roe vs. Wade was not ruling and the ...
64 views

### About regression analysis with categorical variables

Suppose my dependent variable is a continuous variable and is normally distributed. And I have three IVs: one is a continuous variable, and the other two independent variables are categorical. What ...
• 31
74 views

### In Stata or SAS, how do I run a stacked regression with entropy balancing?

My objective is to run stacked regression (DiD) with entropy balancing in the setting of multiple timing for treatments. Initially, my data consisted of panel data for firm-years. I then stacked this ...
19 views

### Marginal Treatment Effects using MTEFE - postestimation discrepancy

I am currently calculating Marginal Treatment Effects for an outcome Y (earnings) and a treatment D (joining sector 1 vs sector 0), using the MTEFE package from Stata. I use a separate approach with a ...
19 views

### C-statistic with censoring data

I have analyzed a cancer dataset that contains risk factors and an outcome. However, I am dealing with many observations lost to follow-up and missing values.   I want to obtain the c-statistic, but I ...
• 3
1 vote
24 views

### How to properly estimate a change in slope across a cutoff value

Imagine that you want to estimate whether the slope between y and x changes after a cutoff value. Assume that the cutoff is not at x = 0 but at some arbitrary point c. I could estimate this two ...
1 vote
41 views

### When I am comparing RMSFE between a log model and a level model of the same dataset, how should I proceed?

I have created an AR(2) and AR(5) model to forecast my data in stata. The AR(2) model is a level model, while the AR(5) model is a log model. I have computed the RMSFE to compare the forecasting ...
• 11
22 views

### Applying OLS regression on model with binary dependent variable to run diagnostic tests

My dependent variable is binary and am therefore using a logit regression but since the diagnostic tests to run for logit are different can I not just regress the variables with OLS and run the ...
32 views

### irt hybrid model predict latent estimate using bayesian method

I'm having some problem about irt prediction model. When i use irt hybrid model, it cannot predict the latent value even it has successfully converge during the irt model processed. It contain binary ...
• 11
1 vote
193 views

### Panel Data Estimation and Control Variables

My undergrad thesis has something to do with the relationship between emissions, mitigation-related official development assistance, and governance variables in chosen ASEAN countries. As such, my (...
• 11
72 views

### High t statistic with high p value for same variable?

I am trying to do a difference in difference model to compare two cities' police departments' uses of force after treatment from a consent decree. When I run the model with clustered standard errors, ...
19 views

### Best models to determine the impact of demographic variables on chances of winning a competition?

I have a dataset where two teams generally compete against each other. For each team, I've gathered demographic characteristics such as the percentage of males, the number of males, average age, ...
• 13
114 views

### Stata and R giving different results for zero-inflated negative binomial regression [closed]

I know this has technically already been asked here, but it doesn't look like the previous question had a reproducible example. I am having the same problem: Very simple, running a zero-inflated ...
• 1,155
121 views

### Cannot seem to find a statistical difference despite a clear difference in the dataset

I've got a dataset of patients with AVM (neurosurgical disease) where you can receive endovascular treatment, surgical treatment or both (usually because endovascular treatment failed). My outcome is ...
• 2,351
90 views

### Robust Hausman vs Mundlak test to choose between FE and RE model?

What is the difference between robust Hausman test and Mundlak test? Wooldridge "Econometric Analysis of Cross Section and Panel Data" (Second edition page 870) mentions robust Hausman test ...
• 101
1 vote
185 views

### Calculating Inverse Mills Ratio after Probit

I need to compute the Inverse Mills Ratio after the probit command in Stata. From here, I found that predict IMR1, score, will calculate it and store it in IMR1. I ...
1 vote
36 views

### Suest for comparing Non linear regressions in Stata but show "estimation sample of the model saved under model1 could not be restored" [closed]

I am using suest to compare the results of Non linear regressions, ...
• 11
70 views

### How to deal with insignificance in this regression?

The hw question: Data set includes: ...
• 23
55 views

### Correctly interpreting a two-sample Kolmogorov-Smirnov test and a Kruskal-Wallis test

I want to confirm my understanding of the two tests referenced in the title. Say I have data on a variable $Y$ from two groups (0 and 1), and I perform the following tests in Stata: ...
• 1
513 views

### How to interpret margins in percentage points when the independent variable is a percentage?

I have 2 research questions, dependent variable of 1st question is a binary variable and I use logit regression to estimate it on STATA. The dependent variable of second research question is in ...
• 63
1 vote
58 views

### How to generate placebo test for random false treatment?

I would like to do a placebo test to ensure the result of my main staggered DID results. I have a country-level mandate that goes into effect in different years during my sample period, and in some ...
• 11
32 views

### How can I perform an analysis of the NHIS imputed income variables?

I have downloaded five family income variables from https://nhis.ipums.org/nhis-action/variables/group?id=economic_income (INCPPOINT1, INCPPOINT2, INCPPOINT3, INCPPOINT4, INCPPOINT5) for they years ...
245 views

### whether to adjust or not adjust for baseline in longitudinal RCT

I have a longitudinal RCT data, aiming to compare the superiority of one group with high exercising to the other group with low exercising to see the improving of pain (pain is outcome). Data is ...
• 129
1 vote
71 views

### Appropriate test for comparing categories in two groups?

I have a subset of a data as below: I would like to compare two groups (1/0) for 6 categories for using a medication Every week they could choose more than one option for each question. The number of ...
• 129
51 views

### Interpretation of interaction term in Cox regression

I am trying in Stata to analyze the effect of an exposure on the risk of an event, and to determine whether this risk increases or not after a temporal cut-off. I have two groups of subjects, with ...
1 vote