diff --git a/src/fit.jl b/src/fit.jl index 0af1eca6..83e020a0 100644 --- a/src/fit.jl +++ b/src/fit.jl @@ -157,8 +157,8 @@ function fit!(lmm::LMM{T}; kwargs...) where T varlinkrvecapply!(θ, lmm.covstr.ct; varlinkf = varlinkf, rholinkf = rholinkf) # Twice differentiable object / reml_sweep_β_nlopt - vloptf(x) = reml_sweep_β(lmm, lmm.dv, varlinkvecapply(x, lmm.covstr.ct; varlinkf = varlinkf, rholinkf = rholinkf); maxthreads = maxthreads)[1] - vloptfd(x) = reml_sweep_β_nlopt(lmm, lmm.dv, varlinkvecapply(x, lmm.covstr.ct; varlinkf = varlinkf, rholinkf = rholinkf); maxthreads = maxthreads)[1] + vloptf(x) = reml_sweep_β(lmm, lmm.dv, varlinkvecapply!(x, lmm.covstr.ct; varlinkf = varlinkf, rholinkf = rholinkf); maxthreads = maxthreads)[1] + vloptfd(x) = reml_sweep_β_nlopt(lmm, lmm.dv, varlinkvecapply!(x, lmm.covstr.ct; varlinkf = varlinkf, rholinkf = rholinkf); maxthreads = maxthreads)[1] gcfg = ForwardDiff.GradientConfig(vloptf, θ, chunk) hcfg = ForwardDiff.HessianConfig(vloptf, θ, chunk) diff --git a/src/lmm.jl b/src/lmm.jl index 6087f35a..8d7da5bc 100644 --- a/src/lmm.jl +++ b/src/lmm.jl @@ -117,19 +117,6 @@ function coefn(lmm) length(lmm.result.beta) end -tname(t::AbstractTerm) = "$(t.sym)" -tname(t::InteractionTerm) = join(tname.(t.terms), " & ") -tname(t::InterceptTerm) = "(Intercept)" -function tname(t::FunctionTerm) - args = string(t.args_parsed[1]) - if length(t.args_parsed) > 1 - for i = 2:length(t.args_parsed) - args *= ", "*string(t.args_parsed[i]) - end - end - string(t.forig)*"("*args*")" -end - """ theta(lmm::LMM) diff --git a/src/utils.jl b/src/utils.jl index 55ba3980..ac584d81 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -26,9 +26,24 @@ function nterms(rhs::Union{Tuple{Vararg{AbstractTerm}}, Nothing, AbstractTerm}) end p end + +""" + Rerm name. +""" tname(t::AbstractTerm) = "$(t.sym)" tname(t::InteractionTerm) = join(tname.(t.terms), " & ") tname(t::InterceptTerm) = "(Intercept)" +function tname(t::FunctionTerm) + args = string(t.args_parsed[1]) + if length(t.args_parsed) > 1 + for i = 2:length(t.args_parsed) + args *= ", "*string(t.args_parsed[i]) + end + end + string(t.forig)*"("*args*")" +end + + """ lcontrast(lmm::LMM, i::Int)