Skip to content

Minor Bug: fix for negative values in the diagonal throws an error #118

@joseph-richard-martinez

Description

Thanks for this super useful package! I wanted to point out one error I've come across when using summary.fixest

In the code chunk below from fixest:::vcov.fixest, it seems that the matrix algebra inside the call to tcrossprod will throw an error if there is a single regressor (i.e. vcov is 1x1). I believe that diag(1e-8) will create a 0x0 matrix and the subsequent matrix algebra will be non-conformable.

if(any(diag(vcov) < 0)){
	    # We 'fix' it
	    e = eigen(vcov)
	    dm = dimnames(vcov)
	    vcov = tcrossprod(e$vectors %*% diag(pmax(e$values, 1e-8)), e$vectors)
	    dimnames(vcov) = dm
	    message("Variance contained negative values in the diagonal and was 'fixed' (a la Cameron, Gelbach & Miller 2011).")
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions