Skip to content

Commit

Permalink
more fullrankx
Browse files Browse the repository at this point in the history
  • Loading branch information
palday committed Mar 25, 2024
1 parent 394135c commit 729dbcb
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/Xymat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ function fullrankx(A::FeTerm)
return rnk == size(x, 2) ? x : view(x, :, 1:rnk) # this handles the zero-columns case
end

fullrankx(m::MixedModel) = fullrankx(m.feterm)

LinearAlgebra.rank(A::FeTerm) = A.rank

"""
Expand Down
2 changes: 1 addition & 1 deletion src/generalizedlinearmixedmodel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@ function updateη!(m::GeneralizedLinearMixedModel{T}) where {T}
b = m.b
u = m.u
reterms = m.LMM.reterms
mul!(η, view(modelmatrix(m), :, 1:rank(m)), m.β)
mul!(η, fullrankx(m), m.β)
for i in eachindex(b)
mul!(η, reterms[i], vec(mul!(b[i], reterms[i].λ, u[i])), one(T), one(T))
end
Expand Down
2 changes: 1 addition & 1 deletion src/simulate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ function _simulate!(
# add fixed-effects contribution
# note that unit scaling may not be correct for
# families with a dispersion parameter
mul!(η, view(lm.X, :, 1:(lm.feterm.rank)), β, one(T), one(T))
mul!(η, fullrankx(lm), β, one(T), one(T))

μ = resp === nothing ? linkinv.(Link(m), η) : GLM.updateμ!(resp, η).mu

Expand Down

0 comments on commit 729dbcb

Please sign in to comment.