Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
PharmCat committed Mar 14, 2023
1 parent 8c5e150 commit 4333a3f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/varstruct.jl
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ function fill_coding_dict!(t::T, d::Dict, data) where T <: Term
end
d
end
#=
function fill_coding_dict!(t::T, d::Dict, data) where T <: InteractionTerm
for i in t.terms
if typeof(Tables.getcolumn(data, i.sym)) <: AbstractCategoricalVector || !(typeof(Tables.getcolumn(data, i.sym)) <: AbstractVector{V} where V <: Real)
Expand All @@ -363,6 +364,7 @@ function fill_coding_dict!(t::T, d::Dict, data) where T <: InteractionTerm
end
d
end
=#
function fill_coding_dict_ct!(t, d, data)
for i in t
if isa(i, Term)
Expand All @@ -375,9 +377,11 @@ function fill_coding_dict_ct!(t, d, data)
end
d
end
#=
function fill_coding_dict!(t::T, d::Dict, data) where T <: Tuple{Vararg{AbstractTerm}}
fill_coding_dict_ct!(t, d, data)
end
=#
function fill_coding_dict!(t::T, d::Dict, data) where T <: CType
fill_coding_dict_ct!(t.args, d, data)
end
Expand Down
7 changes: 7 additions & 0 deletions test/test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ include("testdata.jl")
@test sum(Metida.hessian(lmm)) 1118.160713481362 atol=1E-2
@test Metida.nblocks(lmm) == 5
@test length(coefnames(lmm)) == 6
@test Metida.gmatrixipd(lmm)
@test Metida.confint(lmm)[end][1] -0.7630380758015894 atol=1E-4
@test Metida.confint(lmm, 6)[1] -0.7630380758015894 atol=1E-4
@test Metida.confint(lmm; ddf = :residual)[end][1] -0.6740837049617738 atol=1E-4
Expand Down Expand Up @@ -767,6 +768,8 @@ end
end

@testset " Experimental " begin


io = IOBuffer();
lmm = Metida.LMM(@formula(r2 ~ f), spatdf;
repeated = Metida.VarEffect(Metida.@covstr(x+y|1), Metida.SPEXP),
Expand Down Expand Up @@ -852,4 +855,8 @@ end
mb = Metida.miboot(mi; n = 10, bootn = 10, double = true, verbose = false, rng = StableRNG(1234))
Base.show(io, mb)
end

# Other
@test Metida.varlinkvecapply([0.1, 0.1], [:var, :rho]; varlinkf = :exp, rholinkf = :sigm) [1.1051709180756477, 0.004999958333749888] atol=1E-6

end

0 comments on commit 4333a3f

Please sign in to comment.