[R] Two Time Fixed Effects - LFE package

Andrew Crane-Droesch andrewcd at gmail.com
Sun Nov 15 15:24:27 CET 2015


I don't see why not, but I also don't see why you need to take my word 
for it when you can compare the output of felm against the output of lm, 
with dummy variables for all the factors.  If that many dummies is 
computationally tough, just work with a subset.

On 11/15/2015 08:37 AM, Miluji Sb wrote:
> Dear Andrew,
>
> Thank you for your reply. Its an R question. The weeks are coded as 
> 1-53 for each year and I would like to control weeks and years as time 
> fixed effects.
>
> Will this be an issue if I estimate this type of regression using the 
> LFE package?
>
> felm(outcome ~ temperature + precipitation | city + year + week
>
> Thanks again!
>
> Sincerely,
>
> MS
>
> On Sun, Nov 15, 2015 at 12:13 AM, Andrew Crane-Droesch 
> <andrewcd at gmail.com <mailto:andrewcd at gmail.com>> wrote:
>
>     Is this an R question or an econometrics question?  I'll assume
>     that it is an R question.  If your weeks are coded sequentially
>     (i.e.: weeks since a particular date), then they'll be strictly
>     determined by year.  If however you're interested in the effect of
>     a particular week of the year (week 7, for example), then you'll
>     need to recode your week variable as a factor with 52 levels.  For
>     that you'd likely need the "%%" operator.  For example:
>
>     1> 1:10%%3
>      [1] 1 2 0 1 2 0 1 2 0 1
>
>
>
>
>     On 11/14/2015 05:18 PM, Miluji Sb wrote:
>
>         I have weekly panel data for more than a hundred cities. The
>         independent
>         variables are temperature and precipitation. The time
>         dimensions are year
>         and week and likely have time invariant characteristics and
>         are all
>         important for proper estimation.
>
>         Could I use the LFE (or plm) package to estimate something
>         like this by
>         including the location and two time fixed-effects?
>
>         felm(outcome ~ temperature + precipitation | city + year + week
>
>         Thanks!
>
>         MS
>
>                 [[alternative HTML version deleted]]
>
>         ______________________________________________
>         R-help at r-project.org <mailto:R-help at r-project.org> mailing
>         list -- To UNSUBSCRIBE and more, see
>         https://stat.ethz.ch/mailman/listinfo/r-help
>         PLEASE do read the posting guide
>         http://www.R-project.org/posting-guide.html
>         and provide commented, minimal, self-contained, reproducible code.
>
>
>


	[[alternative HTML version deleted]]



More information about the R-help mailing list