Skip to content

Add missing value support to glm #647

@fonnesbeck

Description

@fonnesbeck

When attempting to run a glm, any missing values in the response variable results in an exception, which is appropriate, but the error message is not clear:

TypeError: reduce() of empty sequence with no initial value

For example, in the following model, you get this error when oxygen has one or more missing values.

glm = pm3.glm.glm
​
with pm3.Model() as oxygen_no_hx:

    formula = 'oxygen ~ ' + '+'.join(no_hx_vars)
    glm(formula, rsv_no_hx, family=pm3.glm.families.Binomial())
    oxygen_trace = pm3.sample(2000, pm3.NUTS())

Might be worth checking for that further up the chain and returning a more informative error.

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