fixest | Fixed-effects estimations
kandi X-RAY | fixest Summary
kandi X-RAY | fixest Summary
The fixest package offers a family of functions to perform estimations with multiple fixed-effects in both an OLS and a GLM context. Please refer to the introduction for a walk-through. At the time of writing of this page (February 2020), fixest is the fastest existing method to perform fixed-effects estimations, often by orders of magnitude. See below for a benchmarking with the fastest alternative software.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of fixest
fixest Key Features
fixest Examples and Code Snippets
Community Discussions
Trending Discussions on fixest
QUESTION
I am working with fixest package. Great results so far.
My data could be set as a panel. Is there any way for fixest to run run panel data analysis.
My model looks something like this:
...ANSWER
Answered 2022-Apr-16 at 15:28Yes. You can use the panel.id
argument in your estimation function to get access to a bunch of panel methods.
From the documentation:
panel.id The panel identifiers. Can either be: i) a one sided formula (e.g. panel.id = ~id+time), ii) a character vector of length 2 (e.g. panel.id=c('id', 'time'), or iii) a character scalar of two variables separated by a comma (e.g. panel.id='id,time'). Note that you can combine variables with ^ only inside formulas (see the dedicated section in feols).
See here for more details.
QUESTION
My current dataset looks like:
...ANSWER
Answered 2022-Mar-29 at 13:04I can't replicate your example with the provided code. Neverthless, you can use a loop like this:
QUESTION
I have made very good experiences with plm()
in small datasets like this one:
ANSWER
Answered 2022-Feb-23 at 06:19edit: plm version 2.6-0 has the fast mode enabled by default. A further speed up for plm is gained if package fixest
(or lfe
) is also installed. For the benchmarked example in ?plm.fast
, this gives a speed up to a 28x speed-up.
old answer Since version 2.4-0 of plm, there is an optional fast mode, see the NEWS entry for 2.4-0 and 2.4-2: https://cran.r-project.org/web/packages/plm/news/news.html
To enable the fast mode, set this option:
options("plm.fast" = TRUE)
You can set this option manually, in your script, or in your .Rprofile
file.
You will need to have package collapse
installed as well, optionally package fixest
or lfe
for further speed up for some cases, esp. two-ways fixed effects from plm 2.4-2 onwards.
For a benchmarked example, see the help for ?plm.fast
.
In your example, much time is spent to create a pdata.frame (the data format plm uses), it happens implicitly in the call to plm
if the data is not explicitly converted first. So, one could split out the formating to pdata.frame and the model estimation. So, the execution time of plm()
is significantly smaller. Also, this would speed up any further model estimation after the first one on the data set.
QUESTION
I am currently working with a big dataset (n>10 million). I found fixest package very helpful to run logit fixed-effects models fast (feglm).
...ANSWER
Answered 2022-Feb-17 at 20:25Set family
, fml
and fml_all
to NULL
and it should work.
The issue is that these items refer to environments even though they do not include the environments. However, when save is applied, the environments to which these values refer are also saved, leading to the large file size.
This is an issue I'll try to solve in the package. Btw the items linear.predictors
and working_residuals
will be appropriately erased in the next version of the package (0.10.2).
QUESTION
I'm wondering how to change a complex variable name with dict
in etable
in fixest
package.
For example, I have a regression Y ~ x1 + x2:abs(x3):x4
and I'd like to change the name of x2:abs(x3):x4
.
I have tried
...ANSWER
Answered 2022-Jan-25 at 20:57It works. It's likely a version problem:
QUESTION
Is there any way to cross reference fixest::etable()
?
I know etable
is a simple method, but it's actually very useful.
If there is a way to do this, it would be very helpful.
The environment is Windows 10, using R 4.1.2 and running bookdown::render_book()
in RStudio.
The following is the file structure and the contents of each file.
- index.Rmd
- _bookdown.yml
- _output.yml
index.Rmd
...ANSWER
Answered 2022-Jan-18 at 13:35UPDATE: I have no idea why I missed the label
argument. Anyway, @laurent-bergé is more correct.
NOTE: This answer is translated from my original post (in Japanese).
I guess fixest package have no options for the cross references on Rmd. Although it may be a kind of kludge, I found that you can insert LaTeX command in the title
argument like the following.
QUESTION
I want to apply broom::tidy()
to models nested in a fixest_multi
object and extract the names of each list level as data frame columns. Here's an example of what I mean.
ANSWER
Answered 2022-Jan-14 at 13:51So, fixest_mult
has a pretty strange setup as I delved deeper. As you noticed, mapping across it or using apply
just accesses part of the data frames. In fact, it isn't just the data frames for "Ozone"
, but actually just the data frames for the first 6 data frames (those for c("Full sample", "5", "6")
.
If you convert to a list, it access the data
attribute, which is a sequential list of all 12 data frames, but dropping the relevant names you're looking for. So, as a workaround, could use pmap()
and the names (found in the attributes of the object) to tidy()
and then use mutate()
for your desired columns.
QUESTION
simple question:
Can I extract the final degrees of freedom after a feols
estimation using the fixest
package?
ANSWER
Answered 2021-Dec-19 at 20:43There is a degrees_freedom
QUESTION
I have two fixed effect variables and I'm interested in estimating coefficients of one fixed effect, but feols
automatically drops the first one always.
For example, in my toy data like below:
...ANSWER
Answered 2021-Nov-17 at 12:25Response from the dev: there's no way to manually drop one.
QUESTION
I'm trying to do a 'classic' difference in difference with multiple time periods. The model I want to do is:
...ANSWER
Answered 2021-Nov-03 at 23:58There are two issues, here.
- In the
lm()
model, theperiod
variable is interacted, but treated as a continuous numeric variable. In contrast, callingi(period, treat)
treatsperiod
as a factor (this is explained clearly in the documentation). - The
i()
function only includes the interactions, and not the constitutive terms.
Here are two models to illustrate the parallels:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install fixest
OLS: felm (R: package lfe), reghdfe (Stata) and FixedEffectModels (Julia)
Poisson: glmmboot (R: package glmmML), feglm (R: package alpaca) and ppmlhdfe (Stata)
Negative Binomial: glm.nb (R: package MASS) and nbreg (Stata)
Logit: glmmboot (R: package glmmML), feglm (R: package alpaca) and logit (Stata)
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page