Skip to content

NLopt error for Bernoulli models with random slopes when NOT using fast=true #220

@hikea

Description

@hikea

Something strange is happening with Bernoulli models. Normal seems to run okay.

Also, unrelated to this issue, but the package cannot handle arrays with missing values out of the box.

using DataFrames, MixedModels, GLM, RDatasets, RData, RCall, Missings, CSV

lexdec = rcopy(R"languageR::lexdec")

fm = fit(MixedModel, @formula(Correct ~ 1 + Class*NativeLanguage*Frequency + Trial + (1+Class + Frequency + Trial|Subject) + (1|Word)), lexdec, Bernoulli())
ERROR: ArgumentError: invalid NLopt arguments: zero step size
Stacktrace:

julia> fm = fit!(GeneralizedLinearMixedModel(@formula(Correct ~ 1 + Class*NativeLanguage*Frequency + (1+Class + Frequency + Trial|Subject) + (1|Word)), lexdec, Bernoulli()))
ERROR: ArgumentError: invalid NLopt arguments: zero step size
Stacktrace:

julia> fm = fit!(GeneralizedLinearMixedModel(@formula(Correct ~ 1 + Class*NativeLanguage*Frequency + (1+Class + Frequency + Trial|Subject) + (1|Word)), lexdec, Bernoulli()), fast=true)
Generalized Linear Mixed Model fit by maximum likelihood (nAGQ = 1)
  Correct ~ 1 + Class + NativeLanguage + Frequency + Class & NativeLanguage + Class & Frequency + NativeLanguage & Frequency + Class & NativeLanguage & Frequency + (1 + Class + Frequency + Trial | Subject) + (1 | Word)
  Distribution: Bernoulli{Float64}
  Link: LogitLink()

  Deviance: 475.6604

Variance components:
             Column        Variance      Std.Dev.    Corr.
 Subject (Intercept)   1.8648165158988 1.365582848
         Class: plant  0.6393674729270 0.799604573 -0.49
         Frequency     0.1061836740609 0.325858365 -0.94  0.73
         Trial         0.0000076274775 0.002761789  0.93 -0.21 -0.75
 Word    (Intercept)   0.7313290831756 0.855177808
 Number of obs: 1659; levels of grouping factors: 21, 79

Fixed-effects parameters:
──────────────────────────────────────────────────────────────────────────────────────────
                                                   Estimate  Std.Error    z value  P(>|z|)
──────────────────────────────────────────────────────────────────────────────────────────
(Intercept)                                       -1.11513    0.839064  -1.32902    0.1838
Class: plant                                      -0.721878   1.14746   -0.629111   0.5293
NativeLanguage: Other                              0.913713   1.03829    0.88002    0.3788
Frequency                                         -0.495801   0.174133  -2.84725    0.0044
Class: plant & NativeLanguage: Other               1.20139    1.33366    0.900816   0.3677
Class: plant & Frequency                          -0.140558   0.274048  -0.512895   0.6080
NativeLanguage: Other & Frequency                 -0.118276   0.221975  -0.532835   0.5941
Class: plant & NativeLanguage: Other & Frequency  -0.263183   0.336882  -0.781232   0.4347
──────────────────────────────────────────────────────────────────────────────────────────

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions