From 664c00381dc58c67348cc176c951faecb75265a0 Mon Sep 17 00:00:00 2001 From: Phillip Alday Date: Tue, 19 Mar 2024 20:48:26 -0500 Subject: [PATCH] fix simulate when only the non pivoted coefs are provided --- src/simulate.jl | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/simulate.jl b/src/simulate.jl index 8335c60be..ce8c78ba9 100644 --- a/src/simulate.jl +++ b/src/simulate.jl @@ -157,10 +157,10 @@ function simulate!( θ = convert(Vector{T}, θ) isempty(θ) || setθ!(m, θ) - # if length(β) ≠ length(m.feterm.piv) - # padding = length(model.feterm.piv) - m.feterm.rank - # append!(β, fill(-0.0, padding)) - # end + if length(β) ≠ length(m.feterm.piv) + β = invpermute!(copyto!(fill(-0.0, length(m.feterm.piv)), β), + m.feterm.piv) + end # initialize y to standard normal randn!(rng, y) @@ -247,11 +247,11 @@ function _simulate!( d = m.resp.d - # if length(β) ≠ length(m.feterm.piv) - # padding = length(model.feterm.piv) - m.feterm.rank - # append!(β, fill(-0.0, padding)) - # end - + if length(β) ≠ length(m.feterm.piv) + β = invpermute!(copyto!(fill(-0.0, length(m.feterm.piv)), β), + m.feterm.piv) + end + fast = (length(m.θ) == length(m.optsum.final)) setpar! = fast ? setθ! : setβθ! params = fast ? θ : vcat(β, θ)