From 9a01cc2d8a70873a92cd2e8ac16f508ac8c97019 Mon Sep 17 00:00:00 2001 From: PharmCat Date: Wed, 17 Feb 2021 00:40:10 +0300 Subject: [PATCH] v0.3.1 #doc --- Project.toml | 2 +- change.log | 4 ++++ docs/Project.toml | 2 ++ docs/src/instanduse.md | 4 ++-- src/Metida.jl | 1 + src/utils.jl | 2 +- src/varstruct.jl | 2 ++ test/test.jl | 5 ++++- 8 files changed, 17 insertions(+), 5 deletions(-) diff --git a/Project.toml b/Project.toml index e344578a..f9e7eebe 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "Metida" uuid = "a1dec852-9fe5-11e9-361f-8d9fde67cfa2" authors = ["Vladimir Arnautov "] -version = "0.3.0" +version = "0.3.1" [deps] CategoricalArrays = "324d7699-5711-5eae-9e2f-1d82baa6b597" diff --git a/change.log b/change.log index ca44f3f8..1454bc89 100644 --- a/change.log +++ b/change.log @@ -1,3 +1,7 @@ +v0.3.1 + * export fix + * doc fix + v0.3.0 * effect model remake * subject keyword removed diff --git a/docs/Project.toml b/docs/Project.toml index 4cbdc5bc..696d51c1 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -4,10 +4,12 @@ StatsPlots = "f3b207a7-027a-5e70-b257-86293d7955fd" CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b" DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" MixedModels = "ff71e718-51f3-5ec2-a782-8ffcbfa3c316" +Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" [compat] Documenter = "≥0.22" +Plots = "0.28, 0.29, 1.0" StatsPlots = "≥0.14" CSV = "0.7, 0.8" DataFrames = "≥0.22" diff --git a/docs/src/instanduse.md b/docs/src/instanduse.md index 3406c301..c5fdf7ab 100644 --- a/docs/src/instanduse.md +++ b/docs/src/instanduse.md @@ -40,7 +40,7 @@ fit!(lmm) ### Model construction -[Metida.LMM](@ref) +[`LMM`](@ref) * `model` - example: `@formula(var ~ sequence + period + formulation)` @@ -51,7 +51,7 @@ fit!(lmm) ### Fitting -[Metida.fit!](@ref) +[`fit!`](@ref) * `solver` - `:default` solving with Optim.jl, for `:nlopt` and `:cuda` MetidaNLopt.jl and MetidaCu.jl should be installed. diff --git a/src/Metida.jl b/src/Metida.jl index 1c3cf889..b1d24778 100644 --- a/src/Metida.jl +++ b/src/Metida.jl @@ -21,6 +21,7 @@ AR, Autoregressive, ARH, HeterogeneousAutoregressive, CS, CompoundSymmetry, CSH, HeterogeneousCompoundSymmetry, +ARMA, AutoregressiveMovingAverage, fit!, LMM, VarEffect, theta, logreml, m2logreml, thetalength, dof_satter, dof_contain, rankx, caic, gmatrix, rmatrix, vmatrix! diff --git a/src/utils.jl b/src/utils.jl index e7736223..6d7b0a1d 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -225,7 +225,7 @@ function vmatrix(lmm, i) end function nblocks(lmm) - return length.covstr.vcovblock + return length(lmm.covstr.vcovblock) end """ hessian(lmm, theta) diff --git a/src/varstruct.jl b/src/varstruct.jl index fa321be9..71c99eea 100644 --- a/src/varstruct.jl +++ b/src/varstruct.jl @@ -391,6 +391,7 @@ function updatenametype!(ct, rcnames, csp, schema, s) append!(rcnames, rcoefnames(schema, csp[3], s)) end ################################################################################ +#= function subjmatrix!(subj, data, subjz, i) if length(subj) > 0 if length(subj) == 1 @@ -405,6 +406,7 @@ function subjmatrix!(subj, data, subjz, i) subjz[i] = trues(size(data, 1),1) end end +=# ################################################################################ function makeblocks(subjz) blocks = Vector{Vector{Int}}(undef, 0) diff --git a/test/test.jl b/test/test.jl index 6e69eb71..15cf0203 100644 --- a/test/test.jl +++ b/test/test.jl @@ -48,6 +48,7 @@ include("testdata.jl") @test length(modelmatrix(lmm)) == 120 @test isa(response(lmm), Vector) @test sum(Metida.hessian(lmm)) ≈ 1118.160713481362 atol=1E-2 + @test Metida.nblocks(lmm) == 5 #AI like algo Metida.fit!(lmm; aifirst = true, init = Metida.theta(lmm), blocksolve = true) @test Metida.m2logreml(lmm) ≈ 16.241112644506067 atol=1E-6 @@ -200,11 +201,13 @@ end end @testset " Model: Noblock, different subjects, ARMA/SI " begin + io = IOBuffer(); #SPSS 904.236!!! lmm = Metida.LMM(@formula(response ~ 1 + factor), ftdf3; contrasts=Dict(:factor => DummyCoding(; base=1.0)), random = Metida.VarEffect(Metida.@covstr(s2|r1&r2), Metida.ARMA), ) - Metida.fit!(lmm;) + Metida.fit!(lmm; verbose = 3, io = io) + println(io, lmm.log) @test Metida.m2logreml(lmm) ≈ 903.2467964711996 atol=1E-8 end