[R] Two Time Fixed Effects - LFE package

Andrew Crane-Droesch andrewcd at gmail.com
Sun Nov 15 00:13:43 CET 2015


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



More information about the R-help mailing list