# Tag Info

32

1) Making some assumptions about the population size (namely that it is large enough that a binomial model is appropriate), the prevalence of a disease in a population at a particular time can be obtained by sampling simple random sampling of people and finding who is sick. That is a binomial random variable and the Wald confidence interval for a ...

25

Q1 You are doing two things wrong here. The first is a generally bad thing; don't in general delve into model objects and rip out components. Learn to use the extractor functions, in this case resid(). In this case you are getting something useful but if you had a different type of model object, such as a GLM from glm(), then mod$residuals would contain ... 21 The typical way to estimate a difference in differences model with more than two time periods is your proposed solution b). Keeping your notation you would regress $$Y_{ist} = \alpha +\gamma_s (\text{Treatment}_s) + \lambda (\text{year dummy}_t) + \delta D_{st} + \epsilon_{ist}$$ where$D_t \equiv \text{Treatment}_s\cdot d_t$is a dummy variable which equals ... 20 Summary: the "random-effects model" in econometrics and a "random intercept mixed model" are indeed the same models, but they are estimated in different ways. The econometrics way is to use FGLS, and the mixed model way is to use ML. There are different algorithms of doing FGLS, and some of them (on this dataset) produce results that are very close to ML. 1.... 19 I doubt there are strict, formal definitions that a wide range of data analysts agree on. In general however, time series connotes a single study unit observed at regular intervals over a very long period of time. A prototypical example would be the annual GDP growth of a country over decades or even more than a hundred years. For an analyst working for ... 19 This answer doesn't comment on mixed models, but I can explain what the random-effects estimator does and why it screws up on that graph. Summary: the random-effects estimator assumes$E[u_i \mid x ] = 0$, which is not true in this example. What is the random effects estimator doing? Assume we have the model: $$y_{it} = \beta x_{it} + u_i + \epsilon_{... 18 From my interpretation of the question, the underlying question you are asking is whether or not you can model time as a spline. The first question I will attempt to answer is whether or not you can use splines to extrapolate your data. The short answer is it depends, but the majority of the time, splines are not that great for extrapolation. Splines are ... 18 In this answer, I would like to elaborate a little on Matthew's +1 answer regarding the GLS perspective on what the econometrics literature calls the random effects estimator. GLS perspective Consider the linear model $$y_{it}=\alpha + X_{it}\beta+u_{it}\qquad i=1,\ldots,m,\quad t=1,\ldots,T$$ If it held that E(u_{it}\vert X_{... 15 The model is fine but instead of standardizing the treatment years there is an easier way to incorporate different treatment times in difference in differences (DiD) models which would be to regress,$$y_{it} = \beta_0 + \beta_1 \text{treat}_i + \sum^T_{t=2} \beta_t \text{year}_t + \delta \text{policy}_{it} + \gamma C_{it} + \epsilon_{it}$$where \text{... 15 A nice feature of difference-in-differences (DiD) is actually that you don't need panel data for it. Given that the treatment happens at some sort of level of aggregation (in your case cities), you only need to sample random individuals from the cities before and after the treatment. This allows you to estimate$$ y_{ist} = A_g + B_t + \beta D_{st} + c X_{... 15 I will assume you have a thorough grasp of the two group/two period difference-in-differences (DD) design and you now want to extend your intuition of the method to the multi-group/multi-period case. Suppose we have multiple observations of$i$units (e.g., counties) across multiple$tperiods (e.g., years). In DD applications, the data is ‘aggregated up’ ... 14 There are quite a few ways to work around it. Jittering the variables mildly to smear the lines apart First, since both age and the outcome are nicely discrete, we can afford to mildly jitter them in order to show some trends. The trick is to use transparency in the line color so that it's easier to discern the magnitude of overlapping. library(geepack) ... 14 At least in the social sciences you often have panel data that has large N and small T asymptotics, meaning that you observe each entity for a relatively short period of time. This is why applied work with panel data is often somewhat less concerned with the time series component of the data. Nevertheless time-series elements are still important in the ... 14 To see equality, let us first derive the FE estimator. Define the residual-maker matrix \begin{align*} \underset{(M\times M)}{\mathbf{Q}}&:=\mathbf{I}_M-\mathbf{1}_M(\mathbf{1}_M'\mathbf{1}_M)^{-1}\mathbf{1}_M'\\ &=\mathbf{I}_M-\left(% \begin{array}{ccc} 1/M & \cdots & 1/M \\ \vdots & \ddots & \vdots \\ 1/M & \cdots & 1/... 14 The unobserved effects model is modeled as: $$y = X\beta + u$$ where $$u = c_{i} + \lambda_{t} + v_{it}$$ A one-way error model assumes\lambda_{t} = 0$while a two-way error allows for$\lambda \in \mathbb{R}$and that is the answer to the first question. The second question cannot be answered ... 13 The answer here is pretty straight forward: Both pooled cross sectional data and pure panel data collect data over time (this can range from 2 time periods to any large number). The key difference between the two is the "units" we follow. I am defining units as households, countries, or whatever we are collecting data on. In pooled cross section, we will ... 13 It has been answered by Dimitri Pananos, I will only add that in order to estimate the prevalence with pre-set precision you need an absolute sample size which is pretty much invariant with the population size (only when the sample is a substantial part of the target population you have a non-negligible finite population correction factor). So there is not a ... 12 I've also asked myself this question, and this is the way I look at it: Suppose your regression models are Time dummies$y_t =\alpha + X_t\beta +\sum_{j=1}^{T-1}\tau_jT_{j} +e_{it}$where$\tau_j$is the coefficent on dummy$T_{j}$, the latter equal to one year$j$, zero elsewhere. For any given year, you can evaluate the function by setting$T_j=1$for ... 12 There are roughly three kinds of datasets: cross section: different subjects at the same time; think of it as one row with many columns corresponding to different subjects; time series: the same subject at different times; think of it as one column with rows corresponding to different time points; panel (longitudinal): many subjects at different times, you ... 12 You can and should use a well-specified random effects model. Always. The Hausman test is said to suggest fixed effects models, but can and should be viewed "as a standard Wald test for the omission of the variables$\widetilde{\mathbf{X}}$" (Baltagi 2008, §4.3), where$\widetilde{\mathbf{X}}$is a matrix of deviations from group means. If you do not omit$\...

12

For the Stata commands in this answer let me collect your variables in a local: local xlist sse01 wartosc_sr_trw_per_capita zatr_przem_bud podm_gosp_na_10tys_ludn proc_ludn_wiek_prod ludnosc_na_km2 So now you can always call all the variables with `xlist' 1) There are two commands that you can use after your fixed effects regression. xttest2 performs a ...

12

(1 + year | ID0) specify a random intercept and a random slope, both grouped by ID0. See the cheat sheet for an explanation of the syntax. 15 unique IDs times (intercept + slope) gives 30 random effects. You don't have sufficient observations to support the model.

11

If you have $N$ individuals and you include $N-1$ individual dummies (one less in order to avoid the dummy variable trap) in an OLS regression like $$y_{it} = X'_{it}\beta + \sum_{i=1}^{N-1}\delta_i (\text{individual}_i) + \epsilon_{it}$$ then this is called a least squares dummy variable (LSDV) regression. In this case, each individual dummy will "absorb" ...

11

I see the reasoning behind this advice but i) this person should have explained it better to you and ii) they should have also mentioned the restrictive assumptions underlying this idea. In the Hausman test you generally ask whether there is a difference between a consistent but inefficient model and a potential inconsistent model which is more efficient. ...

11

NB. I simplify notation somewhat and do not use bold typesetting. The following rules for matrix differentials are useful: \begin{align} d\log \vert A\vert &= \mathrm{tr}(A^{-1}dA) \\ dA^{-1} & = -A^{-1}(dA)A^{-1}. \end{align} A good source for such rules and how to derive them is Magnus and Neudecker. That text also explains how to go between ...

11

I am not really familiar enough with R to comment on your code, but the simple random intercept mixed model should be identical to the RE MLE estimator, and very close to the RE GLS estimator, except when total $N = \sum_i T_i$ is small and the data are unbalanced. Hopefully, this will be useful in diagnosing the problem. Of course, this is all assuming that ...

10

Note: the discussion below is largely copy/pasted from my answers in the following threads: Computing repeatability of effects from an lmer model how to partition the variance explained at group level and individual level Our model for the $i$th response by the $j$th individual is $$y_{ij} = \beta_0 + u_{0j} + e_{ij},$$ where the random intercepts \$u_{0j}...

10

The differences are usually more of a historic nature which is related to the matrix algebra involved. However, this was only a concern when econometrics had to be done by pen and paper way back in the days and today these technicalities barely matter. A discussion of this was provided in an earlier answer by StasK which you can find here. The main concern ...

10

When you use time dummies, you don't need a time dummy for every individual separately but for every year. So this leaves you with 28 time dummies and 997 individual dummies (always omitting the first year and first individual to avoid the dummy variable trap). The solution to your problem is much simpler than what the other answer suggested here. If you ...

10

Admittedly a bit confusing wording from Baltagi in this specific excerpt. But unfortunately, the expression "spurious regression" has come to be used in the econometrics literature as a synonym for "non-stationary and non-cointegrated regression" Let's first attempt to clarify what the "spurious regression phenomenon" is: Spurious regression : when the ...

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