Skip to content

Commit

Permalink
Add checks on complete separation
Browse files Browse the repository at this point in the history
  • Loading branch information
dmbates committed Aug 16, 2024
1 parent 911a07a commit 0ad0594
Showing 1 changed file with 37 additions and 2 deletions.
39 changes: 37 additions & 2 deletions issues/780/issue.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,18 @@ module IssueData
data = open(Downloads.download(URL), "r") do io
zipfile = ZipFile.Reader(io)
@info "extracting..."
return extract_csv(zipfile, "testdataforjulia_bothcase.csv")
return extract_csv(
zipfile,
"testdataforjulia_bothcase.csv";
missingstring=["NA"],
downcast=true,
types=Dict(
:case => Bool,
:individual_local_identifier => String15,
)
)
end

transform!(data, :individual_local_identifier => ByRow(string); renamecols=false),
Arrow.write(path, data)
return data
end
Expand All @@ -48,6 +56,33 @@ using MixedModels
using Statistics

data = get_data()

# check for complete separation of response within levels of columns used as predictors

println(
unstack(
combine(groupby(data, [:Analysisclass, :case]), nrow => :n),
:case,
:n
),
)

println(
unstack(
combine(groupby(data, [:individual_local_identifier, :case]), nrow => :n),
:case,
:n,
),
)

println(
unstack(
combine(groupby(data, [:cropyear, :case]), nrow => :n),
:case,
:n,
),
)

m0form = @formula(case ~ 0 + Analysisclass + (1|cropyear/individual_local_identifier))

# fails
Expand Down

0 comments on commit 0ad0594

Please sign in to comment.