Hot answers tagged

15

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


11

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


8

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


8

Running an (OLS) regression with or without intercept will not change the other coefficients of the other covariates if the means of (all) these covariates are zero. For simplicity, consider the case of one covariate. We have two regressions, the first with and the second without an intercept. $$ \begin{align*} &y_i = \alpha + \beta x_{i} + \varepsilon_i,...


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


6

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


6

xtreg xtreg is a general command for panel regression. The panel regressions will have the following general form (see stata manual): $$y_{it} = α + \mathbf{x_{it}β} + ν_i + \epsilon_{it}$$ where $y_{it}$ is dependent variables $x_{it}$ independent variables, $\alpha$ is constant, $\beta$ parameters, $v_i$ are fixed effects and $\epsilon$ error term. ...


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

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

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

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


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

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


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


4

This is most likely a $\chi^2$ distribution with a degree of freedom of 3. From Wikipedia: In probability theory and statistics, the chi-squared distribution [...] with k degrees of freedom is the distribution of a sum of the squares of k independent standard normal random variables.


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


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

As far as I can see from the discussion there, by unit level they mean the level of the panel variable. What that is depends on your study. It might be firm or individual or country or whatever your panel variable happens to be. The panel variable is the variable that dictates the spatial dimension of your panel data. E.g if your panel consists of ...


3

There is no t-statistics because you are using F-test, with F-statistics. Also you do get p-value, p-value is the probability value of obtaining test results at least as large as the results actually observed, under the assumption that the $H_0$ is correct. So in your case 0.0013. Consequently, you should reject the null of your test and thus the parallel ...


3

Confidence intervals (CI) exist within the `frequentist' tradition of statistics/econometrics. In the very loosest sense, frequentism takes the perspective that there is some true parameter out there. CI's are a representation of this school of thought. CI's should be interpreted as saying that: "upon repeated random sampling from the population, we ...


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

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


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

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

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


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