Skip to content

IPW weights bug. Missuse of np.average rather than mean of weighted outcomes #67

@marcoBmota8

Description

@marcoBmota8

Hi,

I believe there is a mistake in the calculation of outcomes in IPW.
The code is using np.average to compute the expected outcome across treatment groups. This computation sums the weighted outcomes and normalizes by the sum of the weights which is incorrect for IPW:
sum(weights*y)/sum(weights)

Instead it should be the mean of the weighted outcomes:
sum(weights*y)/len(y)

This is an easy but important fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions