Skip to content

Commit c7f80d0

Browse files
committed
re-initialize to small values
1 parent 9c50828 commit c7f80d0

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/generalizedlinearmixedmodel.jl

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -361,13 +361,10 @@ function GeneralizedLinearMixedModel(
361361
tbl,
362362
d::Distribution,
363363
l::Link=canonicallink(d);
364-
wts=[],
365-
offset=[],
366-
contrasts=Dict{Symbol,Any}(),
367-
amalgamate=true,
364+
kwargs...,
368365
)
369366
return GeneralizedLinearMixedModel(
370-
f, Tables.columntable(tbl), d, l; wts, offset, contrasts, amalgamate
367+
f, Tables.columntable(tbl), d, l; kwargs...,
371368
)
372369
end
373370

@@ -469,7 +466,16 @@ function GeneralizedLinearMixedModel(
469466
)
470467

471468
# if the response is constant, there's no point (and this may even fail)
472-
constresponse || deviance!(res, 1)
469+
constresponse || try
470+
deviance!(res, 1)
471+
catch ex
472+
ex isa PosDefException || rethrow()
473+
@warn "Evaluation at default initial parameter vector failed, " *
474+
"initializing to very small variances. This may result in long " *
475+
"model fitting times. You will probably also need to use " *
476+
"`init_from_lmm=[:β, :θ]` in order to fit the model."
477+
res.optsum.initial[res.optsum.initial .!= 0] .= 1e-8
478+
end
473479

474480
return res
475481
end

0 commit comments

Comments
 (0)