From ee638ec0411156406651d4b0383304472be734df Mon Sep 17 00:00:00 2001 From: PharmCat Date: Mon, 8 Mar 2021 21:08:54 +0300 Subject: [PATCH] update --- change.log | 1 + docs/src/api.md | 5 +++++ src/Metida.jl | 2 +- src/statsbase.jl | 13 +++++++++---- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/change.log b/change.log index e74e5046..296b611d 100644 --- a/change.log +++ b/change.log @@ -1,6 +1,7 @@ v0.6.1 * add methods for dof_satter * add settings for fit! + * add confint * first step scoring * initial values minor changes * validation & documentation diff --git a/docs/src/api.md b/docs/src/api.md index acab69b8..b3a7eab5 100644 --- a/docs/src/api.md +++ b/docs/src/api.md @@ -91,6 +91,11 @@ Metida.coef Metida.coefnames ``` +### Metida.confint +```@docs +Metida.confint +``` + ### Metida.nobs ```@docs Metida.nobs diff --git a/src/Metida.jl b/src/Metida.jl index 5892feb2..f6719d54 100644 --- a/src/Metida.jl +++ b/src/Metida.jl @@ -11,7 +11,7 @@ using Optim, LineSearches import LinearAlgebra:checksquare import StatsModels: @formula -import StatsBase: fit, fit!, coef, coefnames, nobs, dof_residual, dof, loglikelihood, aic, bic, aicc, isfitted, vcov, stderror, modelmatrix, response +import StatsBase: fit, fit!, coef, coefnames, confint, nobs, dof_residual, dof, loglikelihood, aic, bic, aicc, isfitted, vcov, stderror, modelmatrix, response import Base:show export @formula, @covstr, diff --git a/src/statsbase.jl b/src/statsbase.jl index a2fb3856..2eb7df2f 100644 --- a/src/statsbase.jl +++ b/src/statsbase.jl @@ -3,8 +3,6 @@ StatsBase.coeftable(model::LMM) = error("coeftable is not defined for $(typeof(model)).") -StatsBase.confint(model::LMM) = error("confint is not defined for $(typeof(model)).") - StatsBase.deviance(model::LMM) = error("deviance is not defined for $(typeof(model)).") StatsBase.islinear(model::LMM) = error("islinear is not defined for $(typeof(model)).") @@ -18,7 +16,13 @@ StatsBase.nullloglikelihood(model::LMM) = StatsBase.score(model::LMM) = error("score is not defined for $(typeof(model)).") =# +""" + StatsBase.confint(lmm::LMM{T}; level::Real=0.95, ddf::Symbol = :satter) where T +Confidece interval for coefficients. + +ddf = :satter/:residual/:contain +""" function StatsBase.confint(lmm::LMM{T}; level::Real=0.95, ddf::Symbol = :satter) where T alpha = 1.0 - level if ddf == :satter @@ -167,6 +171,9 @@ StatsBase.modelmatrix(lmm::LMM) = lmm.data.xv Response vector. """ StatsBase.response(lmm::LMM) = lmm.data.yv + +#StatsBase.crossmodelmatrix(model::LMM) = (x = modelmatrix(model); Symmetric(x' * x)) + #= StatsBase.mss(model::LMM) = error("mss is not defined for $(typeof(model)).") @@ -230,8 +237,6 @@ StatsBase.responsename(model::LMM) = error("responsename is not defined for $(ty StatsBase.meanresponse(model::LMM) = error("meanresponse is not defined for $(typeof(model)).") -StatsBase.crossmodelmatrix(model::LMM) = (x = modelmatrix(model); Symmetric(x' * x)) - StatsBase.leverage(model::LMM) = error("leverage is not defined for $(typeof(model)).") StatsBase.residuals(model::LMM) = error("residuals is not defined for $(typeof(model)).")