Comments (3)
Thanks for reporting. This bug is now fixed.
from fixest.
Don't mean to bother you. Just wanted to let you know: something in your fix seems to make it impossible to define the bins list outside of the regression.
library(fixest)
# Create a sample dataset
xx = (-7):7
yy = rep(c(0:1), each=length(xx))
d = data.frame(xx=rep(xx, times=2), yy = yy, dv = runif(length(yy)))
# Define categories
bin_categories = list("<=-5" = ~x <= -5, ">=5" = ~x >= 5)
# This doesn't work:
feols(dv ~ i(xx, yy, ref = -1, bin = bin_categories), data = d)
Error message:
Error in feols(dv ~ i(xx, yy, ref = -1, bin = bin_categories), data = d) :
The variable 'bin_categories' is in the RHS of the formula but not in the data set.
Of course, a user can just define the list in the regression and then it works fine.
Thanks so much for the original fix and for this absolutely incredible package!
from fixest.
For the record, the fact that one cannot use variables from the global environment is on purpose (it improves quality control and avoids many problems). One can only use scalars from the global environment, which are then hard coded in the formula.
I guess you know it, but in your case you could use d$xxx = bin(d$xx, bin_categories)
to bin the variable ex ante and avoid doing it at run time:
d$xxx = bin(d$xx, bin_categories)
feols(dv ~ i(xxx, yy, ref = -1), data = d)
#> OLS estimation, Dep. Var.: dv
#> Observations: 30
#> Standard-errors: IID
#> Estimate Std. Error t value Pr(>|t|)
#> (Intercept) 0.544425 0.072238 7.536598 4.0189e-07 ***
#> xxx::<=-5:yy 0.100750 0.181794 0.554201 5.8591e-01
#> xxx::-4:yy -0.384185 0.297843 -1.289892 2.1257e-01
#> xxx::-3:yy -0.144298 0.297843 -0.484477 6.3359e-01
#> xxx::-2:yy -0.520490 0.297843 -1.747533 9.6688e-02 .
#> xxx::0:yy -0.266031 0.297843 -0.893193 3.8293e-01
#> xxx::1:yy -0.077570 0.297843 -0.260438 7.9733e-01
#> xxx::2:yy 0.085091 0.297843 0.285692 7.7821e-01
#> xxx::3:yy 0.348274 0.297843 1.169320 2.5674e-01
#> xxx::4:yy 0.327161 0.297843 1.098434 2.8574e-01
#> xxx::>=5:yy 0.164174 0.181794 0.903078 3.7779e-01
#> ---
#> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> RMSE: 0.229953 Adj. R2: 0.011107
Thanks so much for the original fix and for this absolutely incredible package!
Thanks a lot! :-)
from fixest.
Related Issues (20)
- Conflicting benchmark results HOT 1
- Calculating ATT for a given range of post-periods HOT 1
- feols() no longer dependent variables in a list within list of samples
- Error when multiple estimation with offset HOT 1
- notes section misplaced if used with style.tex argument adjustbox = TRUE
- Negative R squared in IV regression HOT 1
- Weighted Dependent Variable Mean In etable HOT 2
- Variance Inflation Factors HOT 3
- Compatibility issue with ```fixest_multi``` from older version
- Collinearity diagnostics with fixed effects and more than two predictor variables HOT 1
- Any plan to include Hodrick (1992) standard errors?
- HC2, HC3, and Heteroskedasticity-Unbiased Standard Errors HOT 3
- Ordering of automatic headers from etable
- local variable XYZ assigned but may not be used
- Does 2SLS Endogenous Interactions Use Fitted Values? HOT 4
- drop.section = "coef" doesn't work
- How to use etable() to vertically display regression with split()
- Tweedie Distribution from glm package
- Feature request: VCV for multiple outcomes HOT 8
- `mvsw` (multiverse stepwise) is not exported/documented
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fixest.