Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "MixedModelsSerialization"
uuid = "b32ace64-3998-4ca6-afd0-a0db4a0482b2"
version = "0.2.2"
authors = ["Phillip Alday <me@phillipalday.com>"]
version = "0.2.0"

[deps]
GLM = "38e38edf-8417-5370-95a0-9cbb8c7f171a"
Expand All @@ -22,15 +22,22 @@ Effects = "8f03c58b-bd97-4933-a826-f71b64d2cca2"
MixedModelsSerializationEffectsExt = ["DataFrames", "Effects"]

[compat]
Aqua = "0.8"
DataFrames = "1"
Effects = "1"
GLM = "1"
JLD2 = "0.4.22, 0.5, 0.6"
LinearAlgebra = "1"
MixedModels = "5.0.3"
MixedModelsDatasets = "0.2"
SparseArrays = "1"
StatsAPI = "1"
StatsBase = "0.33, 0.34"
StatsFuns = "1"
StatsFuns = "1, 2"
StatsModels = "0.7"
Suppressor = "0.2"
Test = "1"
TestSetExtensions = "4"
julia = "1.10"

[extras]
Expand Down
7 changes: 5 additions & 2 deletions src/MixedModelsSerialization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,10 @@ function StatsAPI.coeftable(mms::MixedModelSummary)
co = copy(coef(mms))
se = copy(stderror(mms))
z = co ./ se
pvalue = 2 .* normccdf.(abs.(z))
# use the same code path as MixedModels.jl's own coeftable so that the
# values agree bit-for-bit: Distributions' ccdf(Chisq(1), x) delegates
# to StatsFuns.chisqccdf
pvalue = chisqccdf.(1, abs2.(z))
names = copy(coefnames(mms))

return StatsBase.CoefTable(hcat(co, se, z, pvalue),
Expand Down Expand Up @@ -294,7 +297,7 @@ function Base.show(io::IO, ::MIME"text/plain", m::LinearMixedModelSummary)
join(io, (re.nlevs for re in values(m.reterms)), ", ")
println(io)
println(io, "\n Fixed-effects parameters:")
return show(io, coeftable(m))
return show(io, MIME("text/plain"), coeftable(m))
end

#####
Expand Down
8 changes: 5 additions & 3 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
include("set_up_tests.jl")

@testset ExtendedTestSet "Aqua" begin
Aqua.test_all(Effects; ambiguities=false)
Aqua.test_all(MixedModelsSerialization; ambiguities=false)
end

@testset "StatsAPI" begin
Expand All @@ -15,7 +15,8 @@ end
for f in statsapi
@test f(fm1) == f(mms)
end
@test sprint(show, coeftable(fm1)) == sprint(show, coeftable(mms))
@test sprint(show, MIME("text/plain"), coeftable(fm1)) ==
sprint(show, MIME("text/plain"), coeftable(mms))
@test_throws ArgumentError loglikelihood(mms2)
end

Expand All @@ -38,7 +39,8 @@ end
for f in mixedmodels
@test f(fm1) == f(mms)
end
@test sprint(show, coeftable(fm1)) == sprint(show, coeftable(mms))
@test sprint(show, MIME("text/plain"), coeftable(fm1)) ==
sprint(show, MIME("text/plain"), coeftable(mms))
end

@testset "GLM" begin
Expand Down
Loading