Giter Club home page Giter Club logo

Comments (6)

matthieugomez avatar matthieugomez commented on May 13, 2024 1

You can now get it with the field vcov_expr

from fixedeffectmodels.jl.

matthieugomez avatar matthieugomez commented on May 13, 2024 1

You can now get a namedtuple with mod1.nclusters.

from fixedeffectmodels.jl.

grantmcdermott avatar grantmcdermott commented on May 13, 2024

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.

matthieugomez avatar matthieugomez commented on May 13, 2024

from fixedeffectmodels.jl.

grantmcdermott avatar grantmcdermott commented on May 13, 2024

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.

matthieugomez avatar matthieugomez commented on May 13, 2024

from fixedeffectmodels.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.