# 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,430 questions
Filter by
Sorted by
Tagged with
15 views

### Stata teffects ATET

How does stata estimates ATET using teffects psmatch. I understand the average treatment effect (ATE) is computed by taking the average of the difference between the observed and potential outcomes ...
6 views

### Group by in stata [closed]

Given an existing table that contains a list of observations: colA, colB, value 0, 0, 11 0, 0, 12 0, 1, 11 0, 1, 22 1, 1, 33 How do I ...
34 views

### Leads and Lags in a Staggered Difference-in-Differences Model Stata

I'm trying to use: 1) lags to check whether the effect increases or decreases over time, and 2) leads to check for parallel trends. I'm thinking that regressing each dummy (0 years after treatment, 1 ...
49 views

### Generate given percentile (or data) from n, mean, median, standard deviation, p1, p25, p50, p75, p99?

I apologize if this should be asked elsewhere. I have the following information: Where N=1808 I am trying to calculate a given percentile (in this case p99.723), or ideally, if possible, generate ...
37 views

### Adding Controls to Staggered Difference in Difference Regressions on Stata

I am running a staggered diff-in-diff model, looking at legalization's effect on various variables. For context, only a percentage of all states have legalized, and the year they legalized differs ...
18 views

### Time fixed effect - calculate the net of time effect

I have a data that includes two categories, one being Manchester and another Leeds. This is panel data. I have a Year variable, a dummy for city 0 (Man) 1 (Leeds) and a dummy for each Year. How would ...
• 3
6 views

### Linear Mixed Model - Pupils within classes

Educational researcher wants to examine if a new teaching system improves pupils achievements in the exam. He goes to a single school, and takes 3 classes of pupils as his sample. Each pupils gets an ...
• 418
1 vote
36 views

### Nested Individuals within a group - meaning?

I am reading "DID Intro" by Stata Corp LLC. It is recently updated, early April 2022. On page 7, it explains how Stata runs a panel-data difference-in-differences regression. My question is ...
12 views

### Struggle with use of event study approach with non-firm data

I am attempting to use event study combined with difference in difference analyses to assess the parallel trend assumption in an individual level analyses of the impact of COVID on monthly income. The ...
14 views

### Attempting to recreate official Stata SEM example in the R-package lavaan [migrated]

I want to recreate this official Stata example with the R-package lavaan. I am using the same data and graphically it looks identical. My issue is that the ...
• 239
14 views

### Inequality constraints (interval restrictions) with clogit (STATA)

I am trying to estimate a conditional logit model using clogit. I have to impose different restrictions, for example: utility function: U(ik) = b1 x1(ik) + b2 x2(ik) + b3 x3(ik) + e(ik) constraints: ...
1 vote
24 views

### Stata automatically omits all posiitve or all negative outcomes during poisson panel fixed effectes regression

I am trying to run a poisson fixed panel effects regression using xtpoisson on Stata where my outcome variable is a binary variable. For a majority of my units, the outcome variable = 0 for the entire ...
1 vote
50 views

### Can I make Stata run lasso faster?

I am trying to run a lasso in Stata. I have 1.5 million observations and 1700 variables. Stata is running too slow. I am in 36th grid after 4 days. And get slower ever grid. I am using a 98GB Memory, ...
• 11
60 views

### Triple Difference-in-differences

I am currently trying to run a regression working out the change in the mental well-being of ethnic individuals in a set of countries after a migration policy was imposed. I have two waves of data, ...
• 31
32 views

### Survival (PH) R^2 *decreases* with additional variables

I am running a R.P. flexible parametric survival model (hazards) in Stata, using the stpm2 package and I have encountered a possibly unusual scenario. My Royston & Sauerbrei’s R^2 (not adjusted) ...
• 113
33 views

### STATA - Mean differences between treated and control groups after matching

Relevant Files: https://www.dropbox.com/sh/0jnj3txf4stb2q8/AAD58COnAUysul58qG2p5emwa?dl=0 ...
74 views

### Stata and SPSS regression results different

I am using Stata with a simple dataset to do very basic regressions and comparing with SPSS to see if the results are the same, but they're not. I'm close, the significance are slightly the same, ...
58 views

### How to compare equality of the distribution at different quantiles

I have a dataset from which I am taking a set of descriptive statistics as follows: The value measured is productivity of a firm for each of the group at different quantile (I use Stata command: table ...
• 3
1 vote
29 views

### How do I interpret an augmented dickey-fuller test with 3 lags? [Econometrics]

TLDR: I have found my variable is stationary using the augmented dickey-fuller test, but this took 3 lags to remove serial correlation. How do I interpret this, does this mean I need 3 lags of the ...
19 views

### Comparing two dependent variables with different frequency distributions

So I am running these two OLS regressions on two DVs, each having the same IVs. The problem is, one DV is continuous, and the other is measured categorically in a five-point Likert scale format (I ...
17 views

### How to test whether there is a statistically significant difference in agreement(Cohen's kappa) between 2 or more independent groups?

I have 2 methods to compare by difference in race. For example I want to test the agreement between Method 1 and Method 2 between Asians, Americans and Africans. I know how to calculate kappa ...
18 views

### Random effects tobit if random effects are non-normal distributed

I have the following (panel tobit) data-generating process: $y_{i, t}^* = a + bx_{i,t} + u_{i} + e_{i,t}$ $y_{i,t} = y_{i, t}^*$ if $y_{i, t}^* \geq 0$ and $y_{i,t} = 0$ otherwise. where \$i = 1,..., N;...
90 views

### Nearest Neighbor Matching

This is probably a very basic question. But I spent a good part of 2 weeks trying to understand this (by reading textbooks, searching on internet, listening to lectures) but haven't gotten anywhere ...
• 31
36 views

### Difference between means

I want to compare two means. The first one is the mean over several questions, in which people had to decide how they would split a hundred euro between two different persons. The second mean is the ...
23 views

### Results from a Hausman Test

If the results I get from running a Hausman test in STATA is Prob > chi2 = 0.4504 does this mean I should use a FE or a RE?
19 views

### Panel Data- FE vs RE

I am trying to understand the different Panel Data models and I am getting confused by the different terms that people use, i.e., Random effect models and Random effects estimators and Fixed effect ...
14 views

### difference between two random effects models?

I am trying to understand the difference between the random effects model options I have, and I don't understand the documentation on them well enough to figure that out. They are xtlogit and melogit ...
• 155
1 vote
59 views

### Panel-data unit-root tests (xtunitroot vs. dfuller)

I have 120 IDs. For each ID I have hourly data (90 hours per ID). My data is perfectly balanced. I run xtunitroot tests and all the different versions (llc, ips, demean, trend, lags etc.) and I ...
• 11
42 views

### repeated measures mixed effects using stata - do I use the # or not?

I am trying to run a repeated measures mixed effect on some unbalanced panel data that I have using stata. The data has three hundred observations taken at time 1 and time 2, with 150 distinct person ...
• 155
1 vote
65 views

### What is the ATE in the output of stata with psmatch2 or teffects psmatch

It has been known that we can not get ATE from MatchIt package with method = "nearest" in R because What is the ...
• 43
9 views

### How do I do the specific predict value after two part model? Also the % difference between actual and prediction

I was trying to use two part model for the medical utilization outcomes. First part is logit and second part is glm gamma.Stata program runs smoothly. However, I encounter TWO questions that need the ...
• 1
1 vote
54 views

### Difference-in-Sargan test in R

How can I calculate the Difference-in-Sargan statistic (or C-statistic) in R? In Stata, I would do something like this to get this statistic for pred2 (and see if it is exogenous, assuming that all ...
• 243
65 views

### Is Stata xtreg "within" r-squared incorrect when using i.time fixed effect dummies?

In Stata xtreg y x1 x2 i.year, fe will give the within R-squared, but is it calculating it using the projected model (taking out fixed effects) yet mistakenly (my ...
• 91
1 vote
108 views

### Graphing in Stata with a dummy variable

I'm graphing a regression in Stata with a dummy variable, but my results look like this, which makes sense because obviously the dummy variable is either 1 or 0. But s there a better way to graph this ...
1 vote
51 views

### How does the option"outcome" work in psmatch2 in Stata? [closed]

psmatch2 depvar [indepvars] [if exp] [in range] [, outcome(varlist)... in stata, I just learned psm, I have some doubts about the role of outcome(varlist). I found a psm example (with 3 outcomes), I ...
35 views

### Biplots in R vs in SAS, does the scale parameter differ?

When reading up on biplots in a principal component context, I found that in SAS setting c = 0 gives you a GH biplot that represents the vectors correctly.[1] The same applies in STATA.[2] From what I ...
• 627
208 views

### Different standard errors in Stata and R for instrumental variables (ivreg)

Working with instrumental variables (IV), I noticed differences between reported standard errors in Stata (e.g., using ivreg2) and R (e.g., using AER:ivreg2). In R I found ways to replicate Stata's ...
• 317
46 views

### How to calculate 95% CI around the percentage attenuation using a bootstrap method

I am trying to repeat the statistical methods of an article in which Cox regressions were used to compute hazard ratios (HRs) for the association between life-course SES and death. The author created ...
30 views

### What regression should I run for a composite index as a dependent variable?

My study aims to assess the impact of microfinance on women empowerment by analysing the causal links between the intensity of microfinance and a composite index of empowerment indicators from the ...
103 views

### Difference-in-differences with a continuous treatment

I am currently doing research about the effects on the labour market of Venezuelan migration in Peru. For the first step, I want to get the effects of natives' mean wages in the three biggest cities ...
• 1
24 views

### Why do some people prefer to use 'change in variable' over the actual level in regression analysis?

So for example, say we're choosing to look at the change in level of workers in an office on productivity versus the actual levels of workers in a regression?
1 vote
44 views

### OLS linearity assumptions

Do we have to check on stata that the OLS assumptions of linearity of a regression if the regression is already linear in parameters? I'm having trouble with this concept. Thanks in advance.
1 vote
62 views

### Using same control variables as in propensity score matching

I matched my treatment and control group in STATA, using propensity score matching. I also made sure that each treatment/control pair share the same industry and year ( it's a panel data). If I'm now ...
46 views

### Difference in Difference and clustering errors

I have audience data for weekly TV news broadcasts from 50 different regions. So each broadcast (around 250 in total) has 50 different audience figures. My data contains two years (year1 and year2). ...
• 11
25 views

### How to test for the endogeneity between variables? which tests i should use?

my thesis is about measuring the impact of population growth on the economic growth in my country. However, i should test for the endogeneity between the variables chosen. for the dependent variable i ...
62 views

### Bayesian analysis example with convergence under Gibbs but not Metropolis-Hastings

Having a conceptual understanding of algorithms such as Metropolis-Hastings, Gibbs and Hamiltonian Monte Carlo can provide ideas of remediation to apply when models do not converge. This question ...
• 524
1 vote
53 views

### Interpreting Multinomial Logistic Regression Results with Interaction Terms

My dependent variable is vote choice between the three major Canadian federal parties, using Liberals as the reference point. I have three different lines of code drawn up to study the effect of ...
49 views

### Dummy variable's p value interpretation

I have a question related to the significance of the dummy variable. Some background context: I am writing my thesis and I have hypothesized the following. My first hypothesis hypothesizes that the ...