Skip to content

Commit

Permalink
YAS
Browse files Browse the repository at this point in the history
  • Loading branch information
palday committed Mar 20, 2024
1 parent fd2b9c4 commit 7905589
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ext/EffectsMixedModelsExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function Effects.effects!(reference_grid::DataFrame, model::MixedModel;
# the existence of an appropriate formula method
form = formula(model)
form_typical = typify(reference_grid, form, modelmatrix(model); typical=typical)
piv = view(model.feterm.piv, 1:model.feterm.rank)
piv = view(model.feterm.piv, 1:(model.feterm.rank))
X = view(modelcols(form_typical, reference_grid), :, piv)
eff = X * fixef(model)
err = sqrt.(diag(X * vcov(model)[piv, piv] * X'))
Expand Down
4 changes: 2 additions & 2 deletions test/mixedmodels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ using Test

rng = StableRNG(42)
x = rand(rng, 100)
data = (x = x, x2 = 1.5 .* x, y = rand(rng, [0,1], 100), z = repeat('A':'T', 5))
model = @suppress fit(MixedModel, @formula(y ~ x + x2 + (1|z)), data; progress=false)
data = (x=x, x2=1.5 .* x, y=rand(rng, [0, 1], 100), z=repeat('A':'T', 5))
model = @suppress fit(MixedModel, @formula(y ~ x + x2 + (1 | z)), data; progress=false)
dropped_idx = model.feterm.piv[end]
dropped_coef = coefnames(model)[dropped_idx]
kept_coef = last(fixefnames(model))
Expand Down

0 comments on commit 7905589

Please sign in to comment.