From aa847214587b233137db9ce2630476a4048fbace Mon Sep 17 00:00:00 2001 From: Matthieu Gomez Date: Fri, 30 Oct 2026 10:11:49 -0400 Subject: [PATCH] Use degrees of freedom in simple ranktest and bump to 0.8.4 --- Project.toml | 2 +- src/ranktest.jl | 2 +- test/estimators.jl | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Project.toml b/Project.toml index 7684fba..6635314 100755 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "Vcov" uuid = "ec2bfdc2-55df-4fc9-b9ae-4958c2cf2486" -version = "0.8.3" +version = "0.8.4" [deps] Combinatorics = "861a8166-3701-5b0c-9a16-15d98fcdc6aa" diff --git a/src/ranktest.jl b/src/ranktest.jl index 37e6ea5..b449606 100644 --- a/src/ranktest.jl +++ b/src/ranktest.jl @@ -56,7 +56,7 @@ function ranktest!(X::Matrix{Float64}, # compute vhat if vcov_method isa Vcov.SimpleCovariance - vlab = cholesky!(Hermitian((kronv * kronv') ./ size(X, 1)), check = false) + vlab = cholesky!(Hermitian((kronv * kronv') ./ (size(Z, 1) - dof_small - dof_fes)), check = false) else K = kron(Gmatrix, Fmatrix)' vcovmodel = Vcov.VcovData(Z, K, nothing, X, size(Z, 1) - dof_small - dof_fes) diff --git a/test/estimators.jl b/test/estimators.jl index d891cfb..efdf914 100644 --- a/test/estimators.jl +++ b/test/estimators.jl @@ -157,6 +157,8 @@ end Gm = cholesky(Symmetric(X' * X)).U s_k = minimum(svdvals(Fm * (Gm' \ Pi')')) @test Vcov.ranktest!(copy(X), copy(Z), copy(Pi), simple(), 0, 0) ≈ n * s_k^2 + # the degrees of freedom enter as in the Cragg-Donald F statistic + @test Vcov.ranktest!(copy(X), copy(Z), copy(Pi), simple(), l, 3) ≈ (n - l - 3) * s_k^2 perm = [k; 1:(k - 1)] for v in (simple(), robust()) @test Vcov.ranktest!(copy(X), copy(Z), copy(Pi), v, 0, 0) ≈