Comments (6)
You can now get it with the field vcov_expr
from fixedeffectmodels.jl.
You can now get a namedtuple with mod1.nclusters
.
from fixedeffectmodels.jl.
Just checking: Does the vcov_expr
field still exist?
I was expecting the following to work, but it doesn't.
using DataFrames, RDatasets, FixedEffectModels
df = dataset("plm", "Cigar")
mod1 = reg(df, @formula(Sales ~ NDI + fe(State) + fe(Year)), Vcov.cluster(:State), weights = :Pop)
## Get no. of clusters (here: equal to number of States)
mod1.vcov_expr
# ERROR: type FixedEffectModel has no field vcov_expr
# Stacktrace:
# [1] getproperty(::Any, ::Symbol) at ./Base.jl:20
from fixedeffectmodels.jl.
from fixedeffectmodels.jl.
Thanks Matthieu.
To clarify (since I just tried vcov_expr
and it didn't quite give what I was expecting):
My original request was to get the number of cluster units. In the case of the above regression, the answer would be trivially 46, because there are 46 unique states in our clustering variable "State". In the case of multiway, clustering, however, the number of units may not be trivial because of smallest length cluster adjustments, nested FEs, etc.
Again, apologies if I'm missing something or if I just wasn't clear the first time around. The model that I'm thinking of following here is based on the output from Stata's reghdfe. For example, if I ran . reghdfe price weight length, absorb(rep78) vce(cluster rep78 foreign)
in Stata, part of the output would include:
[...]
Number of clusters (rep78) = 5 [...]
Number of clusters (foreign) = 2 [...]
(Std. Err. adjusted for 2 clusters in rep78 foreign)
[...]
Absorbed degrees of freedom:
-----------------------------------------------------+
Absorbed FE | Categories - Redundant = Num. Coefs |
-------------+---------------------------------------|
rep78 | 5 5 0 *|
-----------------------------------------------------+
* = FE nested within cluster; treated as redundant for DoF computation
Of course, you may not want the output to be nearly as verbose as this. But I do think the effective clustering level of 2 in particular is valuable information. At least, this something journals / referees ask for in my experience.
from fixedeffectmodels.jl.
from fixedeffectmodels.jl.
Related Issues (20)
- StatsBase version incompatibility HOT 1
- no method matching fe(::CategoricalValue
- MethodError: no method matching fe(::CategoricalValue{String15, UInt32}) HOT 1
- Implement StatsAPI.fit() HOT 1
- Generate confidence intervals for `predict` HOT 1
- Ignore rows with `Inf`s? HOT 3
- error in using gpu? HOT 3
- Feature request: GPU support in MacOS HOT 2
- Drop regressors that are collinear with the fixed effects (depending on tolerance for partialling-out)
- Get " run `reg` with the option save = :residuals" despite doing exactly that HOT 3
- How can I get the dof? HOT 2
- Degrees of freedom always 1 HOT 1
- Demeaning HOT 3
- Print name of dependent variable in FixedEffectModel results display? HOT 1
- tolerance in `invsym!` HOT 1
- Next release please! For Stata front-end HOT 4
- `predict` for fixed effects HOT 4
- Feature request: Saving an object of type `FixedEffectModel` HOT 1
- Using r2 as a regression name conflicts with r2 (r-squared?) HOT 1
- Wrong results in a large data set with one set of FE HOT 51
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 fixedeffectmodels.jl.