From 7d5522a747f5dc1606fe79ae09374f8bc3c50b70 Mon Sep 17 00:00:00 2001 From: Phillip Alday Date: Tue, 5 Sep 2023 18:51:09 +0200 Subject: [PATCH 01/15] VIF and GVIF --- Project.toml | 3 ++- src/StatsAPI.jl | 1 + src/regressionmodel.jl | 40 ++++++++++++++++++++++++++++++++++++++++ test/regressionmodel.jl | 29 +++++++++++++++++++++++++++-- test/statisticalmodel.jl | 2 +- 5 files changed, 71 insertions(+), 4 deletions(-) diff --git a/Project.toml b/Project.toml index 28810d4..74f79ea 100644 --- a/Project.toml +++ b/Project.toml @@ -1,10 +1,11 @@ name = "StatsAPI" uuid = "82ae8749-77ed-4fe6-ae5f-f523153014b0" authors = ["Milan Bouchet-Valat 1 || + throw(ArgumentError("VIF not meaningful for models with only one non-intercept term")) + # NB: The correlation matrix is positive definite and hence invertible + # unless there is perfect rank deficiency, hence the warning. + # so we want diag(inv(mm)) but directly computing inverses is bad. + # that said, these are typically small-ish matrices and this is Simple. + return diag(inv(mm)) +end + +# This generic function is owned by StatsModels.jl, which is the sole provider +# of the default definition. StatsModels needs to own the default definition +# because it depends on the @formula interface. +function gvif end diff --git a/test/regressionmodel.jl b/test/regressionmodel.jl index a8892fa..4ffaefa 100644 --- a/test/regressionmodel.jl +++ b/test/regressionmodel.jl @@ -1,18 +1,43 @@ module TestRegressionModel using Test, LinearAlgebra, StatsAPI -using StatsAPI: RegressionModel, crossmodelmatrix +using StatsAPI: RegressionModel, crossmodelmatrix, vif struct MyRegressionModel <: RegressionModel end StatsAPI.modelmatrix(::MyRegressionModel) = [1 2; 3 4] +StatsAPI.vcov(::MyRegressionModel) = [1 0; 0 1] + +struct MyRegressionModel2 <: RegressionModel +end + +StatsAPI.modelmatrix(::MyRegressionModel2) = [1 2; 1 2] +StatsAPI.vcov(::MyRegressionModel2) = [1 0; 0 1] + +struct MyRegressionModel3 <: RegressionModel +end + +StatsAPI.modelmatrix(::MyRegressionModel3) = [1 2 3; 1 2 3] +StatsAPI.vcov(::MyRegressionModel3) = [1 0 0; 0 1 0; 0 0 1] + @testset "TestRegressionModel" begin m = MyRegressionModel() @test crossmodelmatrix(m) == [10 14; 14 20] @test crossmodelmatrix(m) isa Symmetric + + # no intercept term + @test_throws ArgumentError vif(m) + + m2 = MyRegressionModel2() + # only one non intercept term + @test_throws ArgumentError vif(m2) + + m3 = MyRegressionModel3() + # vcov is identity, so the VIF is just 1 + @test vif(m3) ≈ [1, 1] end -end # module TestRegressionModel \ No newline at end of file +end # module TestRegressionModel diff --git a/test/statisticalmodel.jl b/test/statisticalmodel.jl index 114a68e..4b35998 100644 --- a/test/statisticalmodel.jl +++ b/test/statisticalmodel.jl @@ -36,4 +36,4 @@ StatsAPI.nobs(::MyStatisticalModel) = 100 @test adjr2 === adjr² end -end # module TestStatisticalModel \ No newline at end of file +end # module TestStatisticalModel From 12d8f85c2805355ca6294dd867d1690c2530b931 Mon Sep 17 00:00:00 2001 From: Phillip Alday Date: Wed, 6 Sep 2023 07:29:28 +0000 Subject: [PATCH 02/15] Apply suggestions from code review Co-authored-by: Alex Arslan --- src/regressionmodel.jl | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/regressionmodel.jl b/src/regressionmodel.jl index 8e52455..6a16efc 100644 --- a/src/regressionmodel.jl +++ b/src/regressionmodel.jl @@ -142,7 +142,7 @@ Returns a vector of inflation factors computed for each coefficient except for the intercept. In other words, the corresponding coefficients are `coefnames(m)[2:end]`. -The [variance inflation factor (VIF)](https://en.wikipedia.org/wiki/Variance_inflation_factor) measures +The [VIF](https://en.wikipedia.org/wiki/Variance_inflation_factor) measures the increase in the variance of a parameter's estimate in a model with multiple parameters relative to the variance of a parameter's estimate in a model containing only that parameter. @@ -156,9 +156,14 @@ See also [`coefnames`](@ref), [`gvif`](@ref). function vif(model::RegressionModel) mm = Statistics.cov2cor!(vcov(model), stderror(model)) # TODO: replace with hasintercept() when implemented (xref #17) - all(==(1), view(modelmatrix(model), :, 1)) || - throw(ArgumentError("VIF only defined for models with an intercept term")) - mm = @view mm[2:end, 2:end] + i = findfirst(Base.Fix1(all, isone), eachcol(modelmatrix(X))) + i === nothing && + throw(ArgumentError("VIF is only defined for models with an intercept term")) + # Translate the column index in the model matrix to the corresponding indices in the + # correlation matrix + j1 = firstindex(mm, 1) - i + 1 + j2 = firstindex(mm, 2) - i + 1 + m = view(mm, axes(mm, 1) .!= j1, axes(mm, 2) .!= j2) size(mm, 2) > 1 || throw(ArgumentError("VIF not meaningful for models with only one non-intercept term")) # NB: The correlation matrix is positive definite and hence invertible From d52010fd65b71dbac599c0c470ed2005943b2a28 Mon Sep 17 00:00:00 2001 From: Phillip Alday Date: Wed, 6 Sep 2023 07:35:31 +0000 Subject: [PATCH 03/15] Update test/statisticalmodel.jl Co-authored-by: Milan Bouchet-Valat --- test/statisticalmodel.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/test/statisticalmodel.jl b/test/statisticalmodel.jl index 4b35998..83a7471 100644 --- a/test/statisticalmodel.jl +++ b/test/statisticalmodel.jl @@ -37,3 +37,4 @@ StatsAPI.nobs(::MyStatisticalModel) = 100 end end # module TestStatisticalModel + From e4bc97db57b66bb90ad7505992ea300ebc0ce207 Mon Sep 17 00:00:00 2001 From: Phillip Alday Date: Wed, 6 Sep 2023 09:36:18 +0200 Subject: [PATCH 04/15] fixes for @ararslan --- src/regressionmodel.jl | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/regressionmodel.jl b/src/regressionmodel.jl index 6a16efc..9fe5cdf 100644 --- a/src/regressionmodel.jl +++ b/src/regressionmodel.jl @@ -154,26 +154,24 @@ See also [`coefnames`](@ref), [`gvif`](@ref). is not particularly informative anyway. """ function vif(model::RegressionModel) - mm = Statistics.cov2cor!(vcov(model), stderror(model)) + # copy in case vcov returns a view / reference to internal data structures + # this also allows us to guarantee 1-based indexing + mm = Statistics.cov2cor!(Matrix(vcov(model)), stderror(model)) # TODO: replace with hasintercept() when implemented (xref #17) - i = findfirst(Base.Fix1(all, isone), eachcol(modelmatrix(X))) + i = findfirst(Base.Fix1(all, isone), eachcol(modelmatrix(model))) i === nothing && throw(ArgumentError("VIF is only defined for models with an intercept term")) # Translate the column index in the model matrix to the corresponding indices in the - # correlation matrix + # correlation matrix. This removes the constant offset assumption, but there is still + # an assumption of linear indexing with unit stride. j1 = firstindex(mm, 1) - i + 1 j2 = firstindex(mm, 2) - i + 1 m = view(mm, axes(mm, 1) .!= j1, axes(mm, 2) .!= j2) - size(mm, 2) > 1 || + size(m, 2) > 1 || throw(ArgumentError("VIF not meaningful for models with only one non-intercept term")) # NB: The correlation matrix is positive definite and hence invertible # unless there is perfect rank deficiency, hence the warning. # so we want diag(inv(mm)) but directly computing inverses is bad. # that said, these are typically small-ish matrices and this is Simple. - return diag(inv(mm)) + return diag(inv(m)) end - -# This generic function is owned by StatsModels.jl, which is the sole provider -# of the default definition. StatsModels needs to own the default definition -# because it depends on the @formula interface. -function gvif end From d77e534f0374a8d0c4e2568ff85a15ddf3f5c236 Mon Sep 17 00:00:00 2001 From: Phillip Alday Date: Wed, 6 Sep 2023 09:37:56 +0200 Subject: [PATCH 05/15] remove comment --- src/regressionmodel.jl | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/regressionmodel.jl b/src/regressionmodel.jl index 9fe5cdf..c868bd8 100644 --- a/src/regressionmodel.jl +++ b/src/regressionmodel.jl @@ -171,7 +171,5 @@ function vif(model::RegressionModel) throw(ArgumentError("VIF not meaningful for models with only one non-intercept term")) # NB: The correlation matrix is positive definite and hence invertible # unless there is perfect rank deficiency, hence the warning. - # so we want diag(inv(mm)) but directly computing inverses is bad. - # that said, these are typically small-ish matrices and this is Simple. return diag(inv(m)) end From 2997d61700c73c1f1bfd82d8280e34dc9ac40036 Mon Sep 17 00:00:00 2001 From: Phillip Alday Date: Wed, 6 Sep 2023 09:40:03 +0200 Subject: [PATCH 06/15] add a copy step --- src/regressionmodel.jl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/regressionmodel.jl b/src/regressionmodel.jl index c868bd8..59eb4ef 100644 --- a/src/regressionmodel.jl +++ b/src/regressionmodel.jl @@ -155,8 +155,7 @@ See also [`coefnames`](@ref), [`gvif`](@ref). """ function vif(model::RegressionModel) # copy in case vcov returns a view / reference to internal data structures - # this also allows us to guarantee 1-based indexing - mm = Statistics.cov2cor!(Matrix(vcov(model)), stderror(model)) + mm = Statistics.cov2cor!(copy(vcov(model)), stderror(model)) # TODO: replace with hasintercept() when implemented (xref #17) i = findfirst(Base.Fix1(all, isone), eachcol(modelmatrix(model))) i === nothing && From e9a60dca27f0647ac85aa470b0a20f6de5d81b8d Mon Sep 17 00:00:00 2001 From: Phillip Alday Date: Wed, 6 Sep 2023 09:42:36 +0200 Subject: [PATCH 07/15] Julia 1.0 support --- src/regressionmodel.jl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/regressionmodel.jl b/src/regressionmodel.jl index 59eb4ef..7603221 100644 --- a/src/regressionmodel.jl +++ b/src/regressionmodel.jl @@ -157,7 +157,9 @@ function vif(model::RegressionModel) # copy in case vcov returns a view / reference to internal data structures mm = Statistics.cov2cor!(copy(vcov(model)), stderror(model)) # TODO: replace with hasintercept() when implemented (xref #17) - i = findfirst(Base.Fix1(all, isone), eachcol(modelmatrix(model))) + modelmat = modelmatrix(model) + # TODO: replace with eachcol() when support for Julia 1.0 is dropped + i = findfirst(Base.Fix1(all, isone), (view(modelmat, :, col) for col in axes(modelmat, 2))) i === nothing && throw(ArgumentError("VIF is only defined for models with an intercept term")) # Translate the column index in the model matrix to the corresponding indices in the From 5ac785f0c5b035ccdf6cbe7880db64db41b4134b Mon Sep 17 00:00:00 2001 From: Phillip Alday Date: Wed, 6 Sep 2023 09:47:40 +0200 Subject: [PATCH 08/15] more Julia 1.0 compat --- src/regressionmodel.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/regressionmodel.jl b/src/regressionmodel.jl index 7603221..893120e 100644 --- a/src/regressionmodel.jl +++ b/src/regressionmodel.jl @@ -159,7 +159,7 @@ function vif(model::RegressionModel) # TODO: replace with hasintercept() when implemented (xref #17) modelmat = modelmatrix(model) # TODO: replace with eachcol() when support for Julia 1.0 is dropped - i = findfirst(Base.Fix1(all, isone), (view(modelmat, :, col) for col in axes(modelmat, 2))) + i = findfirst(Base.Fix1(all, isone), [view(modelmat, :, col) for col in axes(modelmat, 2)]) i === nothing && throw(ArgumentError("VIF is only defined for models with an intercept term")) # Translate the column index in the model matrix to the corresponding indices in the From be9e1ae885e811d30bf3551bb1d1b53efbbbe1cb Mon Sep 17 00:00:00 2001 From: Phillip Alday Date: Wed, 6 Sep 2023 08:06:20 -0500 Subject: [PATCH 09/15] Update src/regressionmodel.jl --- src/regressionmodel.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/regressionmodel.jl b/src/regressionmodel.jl index 893120e..e111e4d 100644 --- a/src/regressionmodel.jl +++ b/src/regressionmodel.jl @@ -146,7 +146,7 @@ The [VIF](https://en.wikipedia.org/wiki/Variance_inflation_factor) measures the increase in the variance of a parameter's estimate in a model with multiple parameters relative to the variance of a parameter's estimate in a model containing only that parameter. -See also [`coefnames`](@ref), [`gvif`](@ref). +See also [`coefnames`](@ref). !!! warning This method will fail if there is (numerically) perfect multicollinearity, From 3618caedbbbd895eee43c9de8295ce9ad8138da0 Mon Sep 17 00:00:00 2001 From: Phillip Alday Date: Wed, 6 Sep 2023 21:55:14 +0200 Subject: [PATCH 10/15] require_one_based_indexing --- src/regressionmodel.jl | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/regressionmodel.jl b/src/regressionmodel.jl index e111e4d..ae43dca 100644 --- a/src/regressionmodel.jl +++ b/src/regressionmodel.jl @@ -154,23 +154,22 @@ See also [`coefnames`](@ref). is not particularly informative anyway. """ function vif(model::RegressionModel) - # copy in case vcov returns a view / reference to internal data structures - mm = Statistics.cov2cor!(copy(vcov(model)), stderror(model)) - # TODO: replace with hasintercept() when implemented (xref #17) + vc = vcov(model) modelmat = modelmatrix(model) - # TODO: replace with eachcol() when support for Julia 1.0 is dropped - i = findfirst(Base.Fix1(all, isone), [view(modelmat, :, col) for col in axes(modelmat, 2)]) - i === nothing && + # requires Julia 1.2 + Base.require_one_based_indexing(vc, modelmat) + intercept = findfirst(Base.Fix1(all, isone), + [view(modelmat, :, col) for col in axes(modelmat, 2)]) + isnothing(intercept) && throw(ArgumentError("VIF is only defined for models with an intercept term")) - # Translate the column index in the model matrix to the corresponding indices in the - # correlation matrix. This removes the constant offset assumption, but there is still - # an assumption of linear indexing with unit stride. - j1 = firstindex(mm, 1) - i + 1 - j2 = firstindex(mm, 2) - i + 1 - m = view(mm, axes(mm, 1) .!= j1, axes(mm, 2) .!= j2) + + # TODO: replace with hasintercept() when implemented (xref #17) + all(==(1), view(modelmatrix(model), :, 1)) || + throw(ArgumentError("VIF only defined for models with an intercept term")) + m = view(vc, axes(vc, 1) .!= intercept, axes(vc, 2) .!= intercept) size(m, 2) > 1 || throw(ArgumentError("VIF not meaningful for models with only one non-intercept term")) # NB: The correlation matrix is positive definite and hence invertible - # unless there is perfect rank deficiency, hence the warning. + # unless there is perfect rank deficiency, hence the warning in the docstring. return diag(inv(m)) end From 194e55e41144c9ebd83f0e00a9a882d00ed7c7c5 Mon Sep 17 00:00:00 2001 From: Phillip Alday Date: Wed, 6 Sep 2023 22:31:00 +0200 Subject: [PATCH 11/15] just stubs, nothing else --- Project.toml | 1 - src/StatsAPI.jl | 2 -- src/regressionmodel.jl | 56 +++++++++++++++++++++++------------------ test/regressionmodel.jl | 11 -------- 4 files changed, 31 insertions(+), 39 deletions(-) diff --git a/Project.toml b/Project.toml index 74f79ea..14ebc6a 100644 --- a/Project.toml +++ b/Project.toml @@ -5,7 +5,6 @@ version = "1.7.0" [deps] LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" -Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" [compat] julia = "1" diff --git a/src/StatsAPI.jl b/src/StatsAPI.jl index 2596253..cc7e8b0 100644 --- a/src/StatsAPI.jl +++ b/src/StatsAPI.jl @@ -1,8 +1,6 @@ module StatsAPI using LinearAlgebra -using Statistics - include("statisticalmodel.jl") include("regressionmodel.jl") diff --git a/src/regressionmodel.jl b/src/regressionmodel.jl index ae43dca..b6f351e 100644 --- a/src/regressionmodel.jl +++ b/src/regressionmodel.jl @@ -138,38 +138,44 @@ function linearpredictor! end Compute the variance inflation factor (VIF). -Returns a vector of inflation factors computed for each coefficient except -for the intercept. -In other words, the corresponding coefficients are `coefnames(m)[2:end]`. - The [VIF](https://en.wikipedia.org/wiki/Variance_inflation_factor) measures the increase in the variance of a parameter's estimate in a model with multiple parameters relative to the variance of a parameter's estimate in a model containing only that parameter. -See also [`coefnames`](@ref). +See also [`gvif`](@ref). !!! warning This method will fail if there is (numerically) perfect multicollinearity, i.e. rank deficiency. In that case though, the VIF is not particularly informative anyway. """ -function vif(model::RegressionModel) - vc = vcov(model) - modelmat = modelmatrix(model) - # requires Julia 1.2 - Base.require_one_based_indexing(vc, modelmat) - intercept = findfirst(Base.Fix1(all, isone), - [view(modelmat, :, col) for col in axes(modelmat, 2)]) - isnothing(intercept) && - throw(ArgumentError("VIF is only defined for models with an intercept term")) - - # TODO: replace with hasintercept() when implemented (xref #17) - all(==(1), view(modelmatrix(model), :, 1)) || - throw(ArgumentError("VIF only defined for models with an intercept term")) - m = view(vc, axes(vc, 1) .!= intercept, axes(vc, 2) .!= intercept) - size(m, 2) > 1 || - throw(ArgumentError("VIF not meaningful for models with only one non-intercept term")) - # NB: The correlation matrix is positive definite and hence invertible - # unless there is perfect rank deficiency, hence the warning in the docstring. - return diag(inv(m)) -end +function vif end +# This generic function is owned by StatsModels.jl, which is the sole provider +# of the default definition. + +""" + gvif(m::RegressionModel; scale=false) + +Compute the generalized variance inflation factor (GVIF). + +If `scale=true`, then each GVIF is scaled by the degrees of freedom +for (number of coefficients associated with) the predictor: ``GVIF^(1 / (2*df))`` + +The [generalized variance inflation factor (VIF)](https://doi.org/10.2307/2290467) +measures the increase in the variance of a (group of) parameter's estimate in a model +with multiple parameters relative to the variance of a parameter's estimate in a +model containing only that parameter. For continuous, numerical predictors, the GVIF +is the same as the VIF, but for categorical predictors, the GVIF provides a single +number for the entire group of contrast-coded coefficients associated with a categorical +predictor. + +See also [`vif`](@ref). + +## References + +Fox, J., & Monette, G. (1992). Generalized Collinearity Diagnostics. +Journal of the American Statistical Association, 87(417), 178. doi:10.2307/2290467 +""" +function gvif end +# This generic function is owned by StatsModels.jl, which is the sole provider +# of the default definition. diff --git a/test/regressionmodel.jl b/test/regressionmodel.jl index 4ffaefa..08c6114 100644 --- a/test/regressionmodel.jl +++ b/test/regressionmodel.jl @@ -27,17 +27,6 @@ StatsAPI.vcov(::MyRegressionModel3) = [1 0 0; 0 1 0; 0 0 1] @test crossmodelmatrix(m) == [10 14; 14 20] @test crossmodelmatrix(m) isa Symmetric - - # no intercept term - @test_throws ArgumentError vif(m) - - m2 = MyRegressionModel2() - # only one non intercept term - @test_throws ArgumentError vif(m2) - - m3 = MyRegressionModel3() - # vcov is identity, so the VIF is just 1 - @test vif(m3) ≈ [1, 1] end end # module TestRegressionModel From e09ef11315e9bffd397a15720ee50de101dbdb89 Mon Sep 17 00:00:00 2001 From: Phillip Alday Date: Wed, 6 Sep 2023 15:33:05 -0500 Subject: [PATCH 12/15] Update src/StatsAPI.jl --- src/StatsAPI.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/src/StatsAPI.jl b/src/StatsAPI.jl index cc7e8b0..eef2fdf 100644 --- a/src/StatsAPI.jl +++ b/src/StatsAPI.jl @@ -1,6 +1,7 @@ module StatsAPI using LinearAlgebra + include("statisticalmodel.jl") include("regressionmodel.jl") From 29ac7cce914cf6e5f6fc3d36870f99f72346c201 Mon Sep 17 00:00:00 2001 From: Phillip Alday Date: Wed, 6 Sep 2023 22:34:07 +0200 Subject: [PATCH 13/15] missed one --- test/regressionmodel.jl | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/test/regressionmodel.jl b/test/regressionmodel.jl index 08c6114..720807a 100644 --- a/test/regressionmodel.jl +++ b/test/regressionmodel.jl @@ -1,26 +1,12 @@ module TestRegressionModel using Test, LinearAlgebra, StatsAPI -using StatsAPI: RegressionModel, crossmodelmatrix, vif +using StatsAPI: RegressionModel, crossmodelmatrix struct MyRegressionModel <: RegressionModel end StatsAPI.modelmatrix(::MyRegressionModel) = [1 2; 3 4] -StatsAPI.vcov(::MyRegressionModel) = [1 0; 0 1] - -struct MyRegressionModel2 <: RegressionModel -end - -StatsAPI.modelmatrix(::MyRegressionModel2) = [1 2; 1 2] -StatsAPI.vcov(::MyRegressionModel2) = [1 0; 0 1] - -struct MyRegressionModel3 <: RegressionModel -end - -StatsAPI.modelmatrix(::MyRegressionModel3) = [1 2 3; 1 2 3] -StatsAPI.vcov(::MyRegressionModel3) = [1 0 0; 0 1 0; 0 0 1] - @testset "TestRegressionModel" begin m = MyRegressionModel() From 5e8e89cda7464dcd016dbe2e9ea54bdea18116a2 Mon Sep 17 00:00:00 2001 From: Phillip Alday Date: Wed, 6 Sep 2023 15:38:54 -0500 Subject: [PATCH 14/15] Apply suggestions from code review Co-authored-by: Milan Bouchet-Valat --- src/regressionmodel.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/regressionmodel.jl b/src/regressionmodel.jl index b6f351e..f98f85b 100644 --- a/src/regressionmodel.jl +++ b/src/regressionmodel.jl @@ -159,9 +159,9 @@ function vif end Compute the generalized variance inflation factor (GVIF). If `scale=true`, then each GVIF is scaled by the degrees of freedom -for (number of coefficients associated with) the predictor: ``GVIF^(1 / (2*df))`` +for (number of coefficients associated with) the predictor: ``GVIF^(1 / (2*df))``. -The [generalized variance inflation factor (VIF)](https://doi.org/10.2307/2290467) +The [GVIF](https://doi.org/10.2307/2290467) measures the increase in the variance of a (group of) parameter's estimate in a model with multiple parameters relative to the variance of a parameter's estimate in a model containing only that parameter. For continuous, numerical predictors, the GVIF From 0c4879c263a82ae63a8ea519e3eb4e734cba49d2 Mon Sep 17 00:00:00 2001 From: Phillip Alday Date: Wed, 6 Sep 2023 22:42:09 +0200 Subject: [PATCH 15/15] revert --- test/regressionmodel.jl | 2 +- test/statisticalmodel.jl | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/test/regressionmodel.jl b/test/regressionmodel.jl index 720807a..a8892fa 100644 --- a/test/regressionmodel.jl +++ b/test/regressionmodel.jl @@ -15,4 +15,4 @@ StatsAPI.modelmatrix(::MyRegressionModel) = [1 2; 3 4] @test crossmodelmatrix(m) isa Symmetric end -end # module TestRegressionModel +end # module TestRegressionModel \ No newline at end of file diff --git a/test/statisticalmodel.jl b/test/statisticalmodel.jl index 83a7471..114a68e 100644 --- a/test/statisticalmodel.jl +++ b/test/statisticalmodel.jl @@ -36,5 +36,4 @@ StatsAPI.nobs(::MyStatisticalModel) = 100 @test adjr2 === adjr² end -end # module TestStatisticalModel - +end # module TestStatisticalModel \ No newline at end of file