From b06dc359f50b73438a657495204b218f2ec1f344 Mon Sep 17 00:00:00 2001 From: PharmCat <13901158+PharmCat@users.noreply.github.com> Date: Thu, 16 Jan 2025 23:58:28 +0300 Subject: [PATCH] dispersion table, update MetidaBase --- Project.toml | 4 ++-- src/MetidaBioeq.jl | 2 +- src/bioequivalence.jl | 14 ++++++++++---- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/Project.toml b/Project.toml index 2a7fd0e..f3a09ab 100644 --- a/Project.toml +++ b/Project.toml @@ -3,7 +3,7 @@ uuid = "00e1d80e-504f-4d7b-946f-0aea2e7abfe3" keywords = ["bioequivalence"] desc = "Bioequivalence" authors = ["Vladimir Arnautov "] -version = "0.2.7" +version = "0.2.8" [deps] CategoricalArrays = "324d7699-5711-5eae-9e2f-1d82baa6b597" @@ -22,7 +22,7 @@ DataFrames = "1" Distributions = "0.21, 0.22, 0.23, 0.24, 0.25" GLM = "1.8" Metida = "0.15" -MetidaBase = "0.12" +MetidaBase = "0.12, 0.13, 0.14" MetidaNCA = "0.5" MixedModels = "4" StatsBase = "0.30, 0.31, 0.32, 0.33, 0.34" diff --git a/src/MetidaBioeq.jl b/src/MetidaBioeq.jl index f789fac..12a82ce 100644 --- a/src/MetidaBioeq.jl +++ b/src/MetidaBioeq.jl @@ -4,7 +4,7 @@ module MetidaBioeq import Base: show - import MetidaBase: cvfromsd, sdfromcv + import MetidaBase: cvfromsd, cvfromvar, sdfromcv export result, bioquivalence, estimate, makeseq, cvfromsd, sdfromcv diff --git a/src/bioequivalence.jl b/src/bioequivalence.jl index 97ed4d0..3573234 100644 --- a/src/bioequivalence.jl +++ b/src/bioequivalence.jl @@ -552,7 +552,7 @@ function estimate(be; estimator = "auto", method = "auto", supresswarn = false, if estimator == "glm" results = [fit(LinearModel, m, be.data; contrasts = Dict(be.formulation => DummyCoding(base = be.reference)), dropcollinear = true) for m in models] - dfvar = dfdict[:var] = DataFrame(Parameter = String[], Metric = String[], SE = Float64[], CV = Float64[]) + dfvar = dfdict[:var] = DataFrame(Parameter = String[], Metric = String[], σ²= Float64[], CV = Float64[]) for i in results DF = dof_residual(i) @@ -572,11 +572,16 @@ function estimate(be; estimator = "auto", method = "auto", supresswarn = false, exp(CI[2])*100, (1-2alpha)*100 )) + + σ² = GLM.dispersion(i.model, true) push!(dfvar, (string(coefnames(i)[2], " - ", be.reference), coefnames(i.mf.f.lhs), - sevec[2], - cvfromsd(sevec[2]) * 100 + σ², + cvfromvar(σ²) * 100 )) + + + end # If Metida Used @@ -652,7 +657,8 @@ function estimate(be; estimator = "auto", method = "auto", supresswarn = false, end end - BEResults(be, results, Dict(:result => df), estimator, method) + + BEResults(be, results, dfdict, estimator, method) end """