Hot answers tagged

14

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 ...


9

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, ...


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, ...


7

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 ...


7

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 ...


5

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


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(...


5

I use all three programs. Python can do everything that R can do and R can do everything that Python does, but I must say R is superior to Python when it comes to the packages. For that reason for most econometric analysis I usually default to R. I find also producing nice standard statistics graphics with R easier (but for maps I prefer Python). However, ...


5

Why don't you just take a weighted average? Suppose you have ten years $t \in \{1,...,10\}$ and year $t$ has $N_t$ observations such that in total you have $\sum_t N_t=N$ observations. Let the year-$t$ CDF be $F_t$ with support $[\underline w_t,\overline w_t]$. You can then define a weighted average CDF as $$\overline F (w) = \sum_t \frac{N_t}{N} F_t(w).$$ ...


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") ...


4

The answer by @Baysiean proposed to compute a weighted average of the per-period empirical distribution functions $EDF_t(w)$ (where $w$ is the value in the support of a random variable $W$), a value at which we evaluate the $EDF_t$ of $W$. Let's see what that may mean. The $EDF_t(w)$ expression is, for each value $w$ in the support, $$EDF_t(w) = \frac 1{N_t} ...


3

You can use the stargazer package (install with pip install stargazer). From https://github.com/mwburke/stargazer/blob/master/examples.ipynb: import pandas as pd from sklearn import datasets import statsmodels.api as sm from stargazer.stargazer import Stargazer from IPython.core.display import HTML diabetes = datasets.load_diabetes() df = pd.DataFrame(...


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

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. ...


2

In panel regressions you have multiple dimensions and that is why also you have 3 different $R^2$. The within $R^2$ tells you how much variation within your panel variables is on average explained by your model. The between $R^2$, tells you how much variation between your panel variables is explained by the model, and overall $R^2$ gives you the combination ...


2

I would advise you to think deeper about your research question first, as this will guide the decision to use country fixed effects. If you would like to exploit cross country variation, for example by studying how the same industry functions differently across countries, then do not use country dummies because it will absorb the variation you want. If you ...


2

In this lecture it is stated at chapter 2.3 that "The Markov switching model and its variants discussed in the preceding sections are only suitable for stationary data". Perhaps you'd like to read into that more thoroughly. Possible solution: Since differentiation is allowed, you should also be able to produce an Error-Correcting Model -and its ...


2

Not sure if this is on-topic, but I'll give a simple solution. It's perhaps not the most efficient, but should be easy enough to follow. Assuming you also want to keep "category" and not just "id", how about something like the following: use sample.dta, clear tempfile month10 preserve keep if month==8 | month==9 collapse value , by(year ...


2

You can use the continuous variable "Assets" as stand-alone, and use its categorical incarnation for the interaction term. While we may be accustomed to use "automatically generated" interaction terms as part of ready-made functional forms like the translog, nothing forbids us to introduce selectively interaction terms in a regression ...


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

Staiger and Stock (1997) formalized the definition of “weak instruments” and most researchers seem to have concluded (incorrectly) from that work (or hearsay) that if the F-statistic on the excluded instruments in the first stage is greater than 10, one need worry no further about weak instruments.Stock and Yogo (2005) go into more detail and ...


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 ...


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