# Tag Info

13

In my university the choice of program is considered generally irrelevant. We focus on results, and it is up to each student to determine which program is best suited for the task and user preference. You will find that using one language translates very well to another. With resources like stackoverflow, I would not be too concerned about which. I would ...

7

The main economic journals are slowly starting to require authors to make their data and the code of their analysis available as part of the online appendix. When this is the case, it is easy to figure out which software was used. One example are recent publications in the American Economic Review. For instance, Calsamiglia, Caterina, Guillaume Haeringer, ...

6

Basically it's better to use the software your PI uses! First (s)he will be able to correct your code. Second, if you're a TA for a class using one software, it's better to handle it... To find the faculty using R, either have a look at the papers/books published by one department. Or look at the R-packages published in your field and find the authors. I ...

6

If you are only looking for "A department where at least few researchers use R? ", I believe you should be able to find plenty. In my department (Vanderbilt University), I can count at least 3 grad students using R instead of Stata (oh and I guess with myself it makes 4 ;)). If you are looking for more heavily R-oriented econ department, you might have a ...

6

You can use code like the following (making use of the as_latex function) to output a regression result to a tex file but it doesn't stack them neatly in tabular form the way that outreg2 does: import pandas as pd import statsmodels.formula.api as smf x = [1, 3, 5, 6, 8, 3, 4, 5, 1, 3, 5, 6, 8, 3, 4, 5, 0, 1, 0, 1, 1, 4, 5, 7] y = [0, 1, 0, 1, 1, 4, 5, 7,0, ...

5

See RePEc's software top. You'll find much Stata, a bit Matlab, and nothing else. From long personal observations, economists' preferences are ranked like this: Stata (none) Matlab Python, R SAS, Gauss Java, C#, C, Julia are used when performance is important (heavy simulations, combinatorics, etc.). In a specific paper, software is easy to identify ...

5

Use -areg- in Stata, and the standard errors will come out as in the textbook. Specifically, the command areg lpassen lfare ldist ldistsq y98 y99 y00, absorb(id) vce(robust) will produce the desired result. -xtreg- with fixed effects and the -vce(robust)- option will automatically give standard errors clustered at the id level, whereas -areg- with -vce(...

4

I'm still not sure if I'm doing something wrong. However, it is useful to note that I get the same results in R. library(foreign) library(plm) library(lmtest) df <- read.dta("airfare.dta") fe.out <- plm(lpassen ~ lfare + ldist + ldistsq + y98 + y99 + y00, data=df, index = c("id", "year"), method = "within", effect = "individual") ...

3

FE logit requires the idiosyncratic errors to be IID across $i$ and $t$, quite a strong assumption. Also the regressors should be strictly exogenous, but it's the same for linear FE models. In your application, the fact that FE logit wouldn't converge will make a good argument against FE logit, and will satisfy some referees but not all. An important ...

3

If you check Stata's help file on regress you should understand how to do it. Particularly pp. 16-7 have specific examples of how to apply weights. I will edit in order to be more detailed. gen lnyl1y=ln(y)-l1.ln(y) xi: reg lnyl1y i.country [w=y] Notice that if the weighted regression is done by dividing all values for observation $i$ by $\sqrt{w_i}$, ...

3

To understand the issue let's review what is the so call robust variance-covariance matrix estimates (VCE) and the implied "robust" standard errors. The robustness is meant to allow for violations of homoscedasticity in the cross-sectional dimension or heteroscedasticity. There are various heteroscedastic robust VCE which are known as the Sandwich estimators ...

2

Your errors aren't the same anymore. For example, instead of writing $Y = \beta_1 + \beta_2 X + U$, you're actually writing $Y = \alpha_1 + \alpha_2 X + \alpha_3 X^2 + V$. There is no expectation that they should be the same. In other areas, the trouble is that the error term is likely correlated with your regressors. Fear not: running wages on ...

2

There is now a Python version of the well known stargazer R package, which does exactly this. See also this related question: https://stackoverflow.com/q/35051673/2858145

2

It is important to recognize that there are path dependencies to removing different variables from your model. This is due to the fact that variables can be highly correlated (positively or negatively) with one another so that by removing an insignificant variable then other variables can become statistically significant or insignificant. There are very ...

2

You should do none of the above. This is an invalid decision-making process. In the best of all possible worlds, create a series of do loops and go through the set of all possible combinations of variables. Calculate the AIC or the BIC. If you know nothing about either, just pick one as they usually give the same result. The model with the lowest AIC or ...

2

You have firm fixed effects. Presumably, every firm is in the same country throughout your observation period. Moreover, no country ever changes its development status (I assume). Hence, for a given firm, there is no variation in the development status. Therefore, you can't identify an effect.

2

Have you seen http://faculty.econ.ucdavis.edu/faculty/dlmiller/statafiles/ ? I see some entries there such as Multi-way clustering with OLS and Code for “Robust inference with Multi-way Clustering”. EDIT: At least we can calculate the two-way clustered covariance matrix (note the nonest option), I think, though I can't verify it for now. See the following. ...

1

Do the last one, the first one is just the same thing but you will not be using the in-built adf function. The second one does it better and you have a choice of including lagged differences to control for possible autocorrelation. If your data is monthly, give it a lag order of 12.

1

You can use mark. For example, if the treatment was done in the year 2000, and your time variable is called time, the syntax is mark treatment if time >= 2000 & time <. where treatment is the dummy that is generated.

1

Note that the fixed effects estimates use only within-firms differences, essentially discarding any information about differences between firms. If predictor variables vary greatly across firms but have little variation over time for each firm, then fixed effects estimates will be imprecise and have large standard errors. So, if there is not enough variation ...

1

You are saying: $y$ is regressed on $x_1$ and $x_2$, say, and you think it would be better to use cluster errors since you expect $y$ is correlated with abilities for each person. First, $y$ is naturally correlated with the error term $u$ (if you mean the error term by "abilities") because $u$ is a part of $y$. You have no problems with that; $y$ is always ...

1

Pooled regression on a panel-data sample, indeed, does not take the time dimension into account. This is why it is called "pooled": we ignore the fact that for each cross-section we have a time series, and we treat the whole panel-data sample as though it were a cross-sectional one, as if, say, $x_{it}$ and $x_{i,t+1}$ are diffrenet cross sections.

1

mean command with pweight gives you mean and sd estimates, which in turn gives you estimate of the coefficient of variation. pctile also takes pweight. It will generate percentiles. kdensity only gives point estimates, not confidence intervals of the density estimates, so I think using fweight instead of pweight is fine. But I'm not certain about this. ...

1

Is this what you want (in Stata)? clear all * Generate Data (n=5, T=20) set obs 100 gen id = floor((_n-1)/20)+1 by id, sort: gen year = 1990+_n gen x = rnormal() xtset id year * Convert gen t5 = floor((year-1991)/5)+1 gen idt5 = id*10+t5 /* 10 can be 100, 1000, etc., depending on T */ by idt5, sort: egen xbar5 = mean(x) *drop t5 idt5 /* drop if ...

1

Stock prices follow a random walk process, usually we include a drift term to account for the somewhat prolonged upward/downward drifts. This is basically an AR(p) process, p being the lag order. For instance AR(1) with drift is $X_t=\delta+\beta X_{t-1}+u_t$ where $\beta = 1$. Try testing this model for unit root using ADF test in stata. One lag is enough. ...

1

You can regress residual squares (from RE or FE depending on your estimation) on $X_{it} \hat\beta$ and its square using the clustered standard errors (the vce(cl id) option), and read the F statistic and the associated p value. This is basically the same as Het test for cross sectional models (White's simplified test). xtreg y x1 x2, re predict uhat, ue ...

1

This isn't a matter of statistical packages as much as it is a matter of how to write a program to maximize/minimize a function. You can do this readily in Stata, Matlab, R, Python, etc. No matter what language you use, though, the process is basically the same. You write a function that specifies the functional form your trying to, say, minimize, set the ...

1

@OccupyGezi 's suggestion is good -you should check for severe collinearity, that may render the estimations unstable and unreliable for purely technical reasons. As for choosing between the models, there are technical, purely statistical criteria, but there is also the economic essence of the matter, which should not be forgotten: by including the ...

1

This is a well known phenomenon called collinearity. Basically your two independent variables (age and age-squared) are correlated strongly. In the presence of collinearity the coefficient estimates can change significantly. To overcome this problem you may use robust regression, such as ridge regression.

Only top voted, non community-wiki answers of a minimum length are eligible