Skip to content

Commit 0ad0594

Browse files
committed
Add checks on complete separation
1 parent 911a07a commit 0ad0594

File tree

1 file changed

+37
-2
lines changed

1 file changed

+37
-2
lines changed

issues/780/issue.jl

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,18 @@ module IssueData
2525
data = open(Downloads.download(URL), "r") do io
2626
zipfile = ZipFile.Reader(io)
2727
@info "extracting..."
28-
return extract_csv(zipfile, "testdataforjulia_bothcase.csv")
28+
return extract_csv(
29+
zipfile,
30+
"testdataforjulia_bothcase.csv";
31+
missingstring=["NA"],
32+
downcast=true,
33+
types=Dict(
34+
:case => Bool,
35+
:individual_local_identifier => String15,
36+
)
37+
)
2938
end
3039

31-
transform!(data, :individual_local_identifier => ByRow(string); renamecols=false),
3240
Arrow.write(path, data)
3341
return data
3442
end
@@ -48,6 +56,33 @@ using MixedModels
4856
using Statistics
4957

5058
data = get_data()
59+
60+
# check for complete separation of response within levels of columns used as predictors
61+
62+
println(
63+
unstack(
64+
combine(groupby(data, [:Analysisclass, :case]), nrow => :n),
65+
:case,
66+
:n
67+
),
68+
)
69+
70+
println(
71+
unstack(
72+
combine(groupby(data, [:individual_local_identifier, :case]), nrow => :n),
73+
:case,
74+
:n,
75+
),
76+
)
77+
78+
println(
79+
unstack(
80+
combine(groupby(data, [:cropyear, :case]), nrow => :n),
81+
:case,
82+
:n,
83+
),
84+
)
85+
5186
m0form = @formula(case ~ 0 + Analysisclass + (1|cropyear/individual_local_identifier))
5287

5388
# fails

0 commit comments

Comments
 (0)