Comments (1)
Yep, you're right, it's aweights
.
If you use frequency weights, you need to adjust the VCOV manually:
> base = iris
> names(base) = c("y", "x1", "x2", "x3", "species")
>
> # Creating new data where each row can be there multiple times
> # Each row can appear 0 to 5 times
> set.seed(0)
> n_times = sample(0:5, 150, TRUE)
> base_large = base[n_times >= 1, ]
> for(n in 2:5){
> base_large = rbind(base_large, base[n_times >= n, ])
> }
> # The weights == the frequencies
> base$w = n_times
>
> # Estimations
> est = feols(y ~ x1 + x2 + x3, base, weights = ~w)
#> NOTE: 27 observations removed because of 0-weight.
> est_large = feols(y ~ x1 + x2 + x3, base_large)
>
> # Same coefs, but SEs differ
> etable(est, est_large)
#> est est_large
#> (Intercept) 1.702*** (0.2641) 1.702*** (0.149)
#> x1 0.6745*** (0.06935) 0.6745*** (0.03912)
#> x2 0.7549*** (0.06184) 0.7549*** (0.03488)
#> x3 -0.6375*** (0.1434) -0.6375*** (0.08089)
#> ___________________ ___________________ ____________________
#> Observations 123 378
#> S.E. type: Standard Standard Standard
#> R2 0.85474 0.86833
#> Adjusted R2 0.85108 0.86727
>
> # Manual adjustment of the VCOV
> V = vcov(est) * (est$nobs - est$nparams) / (sum(base$w) - est$nparams)
> est_fweights = summary(est, .vcov = V)
>
> # Identical results
> etable(est_fweights, est_large)
#> est_fweights est_large
#> (Intercept) 1.702*** (0.149) 1.702*** (0.149)
#> x1 0.6745*** (0.03912) 0.6745*** (0.03912)
#> x2 0.7549*** (0.03488) 0.7549*** (0.03488)
#> x3 -0.6375*** (0.08089) -0.6375*** (0.08089)
#> ___________________ ____________________ ____________________
#> Observations 123 378
#> S.E. type: Standard Standard Standard
#> R2 0.85474 0.86833
#> Adjusted R2 0.85108 0.86727
from fixest.
Related Issues (20)
- Adding empty row between coefficients HOT 1
- Unexpected Behavior with vcov
- Saving fixest objects HOT 9
- fitstat ivwald: "missing value where TRUE/FALSE needed" HOT 1
- Potential binning issue in regressions HOT 3
- Unable to successfully save plots produced by coefplot() or iplot() HOT 4
- RcppEigen::fastLm HOT 4
- Inconsistent confidence intervals HOT 4
- OLS vs `feols()` HOT 2
- [request] Support etable in self-contained Rmarkdown HTML documents.
- `r2` fails if package is not attached and fixed effects are present HOT 2
- How to set 0 or not applicable values for Cluster, IV, FE parts of the call? HOT 5
- header generates NA in latex table HOT 1
- Can fixest auto-Inverse-Variance weight the FE estimate? HOT 1
- Custom coefficient format for a specific variable in fixest etable
- How to use bias-reduced linearization (BRL) / CR2 - adjusted standard errors with feols? HOT 2
- R Session Aborted with IV when all variables are collinear with the fixed effects
- Feature request/bug: predict/fitted for multiple lhs regressions
- Accessing the within rhs covariates HOT 2
- find weights column within data HOT 2
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.