Skip to content

Commit

Permalink
up compats, corrects tests, and bump version because behavior is slig…
Browse files Browse the repository at this point in the history
…htly different now that GLM drops colliear columns by default
  • Loading branch information
AsafManela committed Nov 29, 2022
1 parent d78cb56 commit ee57ac4
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 19 deletions.
10 changes: 5 additions & 5 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "HurdleDMR"
uuid = "f9e53bcf-9449-548a-a5fe-a83e43094f75"
version = "1.3.3"
version = "1.4.0"

[deps]
Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b"
Expand All @@ -19,16 +19,16 @@ StatsModels = "3eaba693-59b7-5ba5-a881-562e759f1c8d"
Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"

[compat]
GLM = "1.5"
GLM = "1.8"
LambertW = "0.4"
Lasso = "0.6"
LoggingExtras = "0.4"
Lasso = "0.7"
LoggingExtras = "1.0"
Missings = "1.0"
OrderedCollections = "1.1, 1.2, 1.3, 1.4"
StatsBase = "0.33"
StatsModels = "0.6"
Tables = "1.4"
julia = "0.7, 1"
julia = "1"

[extras]
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
Expand Down
12 changes: 1 addition & 11 deletions test/hdmr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -324,10 +324,6 @@ coefsHppos4, coefsHpzero4 = coef(hdmrcoefs4)
@test coefsHpzero4[:,3] == zeros(p+1)
@test HurdleDMR.includelinX(hdmrcoefs4) == includel

if M == InclusionRepetition
@info("Testing hdmr degenerate cases. The 12 following warnings by workers are expected ...")
end

zcounts = Matrix(deepcopy(counts))
Random.seed!(13)
for I = eachindex(zcounts)
Expand Down Expand Up @@ -380,13 +376,7 @@ coefsHppos3, coefsHpzero3 = coef(hdmrcoefs3)
@test HurdleDMR.includelinX(hdmrcoefs3) == includel

# hurdle dmr parallel remote cluster
if M == Hurdle
hdmrcoefs4 = fit(HDMRPaths{M},covars, zcounts; parallel=false, testargs...)
else
rx = Regex("fit\\($M...\\) failed for countsj")
warnings = [(:warn, rx) for i=1:4]
hdmrcoefs4 = @test_logs(warnings..., fit(HDMRPaths{M},covars, zcounts; parallel=false, testargs...))
end
hdmrcoefs4 = fit(HDMRPaths{M},covars, zcounts; parallel=false, testargs...)
coefsHppos4, coefsHpzero4 = coef(hdmrcoefs4)
@test coefsHppos coefsHppos4
@test coefsHpzero coefsHpzero4
Expand Down
8 changes: 6 additions & 2 deletions test/inrep.jl
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,12 @@ coefsJpos, coefsJzero = coef(inrep;select=AllSeg())
ydeg = zero(y)
ydeg[1] = 2
ydeg[2] = 3
increpglm = @test_logs (:warn, r"failed to fit truncated counts model to positive") fit(InclusionRepetition,GeneralizedLinearModel,[ones(size(X,1)) X],ydeg; showwarnings=true)

# should fail to fit positives model with dropcollinear=false (GLM<1.8.1 behavior)
increpglm1 = @test_logs (:warn, r"failed to fit truncated counts model to positive") fit(InclusionRepetition,GeneralizedLinearModel,[ones(size(X,1)) X],ydeg; showwarnings=true, dropcollinear=false)
# should be able to fit positives model with dropcollinear=true (default GLM>=1.8.1 behavior)
increpglm2 = fit(InclusionRepetition,GeneralizedLinearModel,[ones(size(X,1)) X],ydeg; showwarnings=true)
@test coef(increpglm1)[1] != coef(increpglm2)[1]
@test coef(increpglm1)[2] coef(increpglm2)[2]

# degenerate positive counts data case 1 without >1
y0or1 = deepcopy(y)
Expand Down
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ include("helpers.jl")
include("dmr.jl")
include("hdmr.jl")
@static if !Sys.iswindows()
# NOTE: we don't run tests on windows because the randomly fail due to mmap() throwing:
# NOTE: we don't run tests on windows because they randomly fail due to mmap() throwing:
# LoadError: could not create mapping view: The operation completed successfully.
include("multicounts.jl")
end
Expand Down

0 comments on commit ee57ac4

Please sign in to comment.