google / google/matched_markets

_impact_estimate in tbrmmdiagnostics.py

Open
#16 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
103
Forks
33
PR merge metrics
No merged PRs in 30d

Description

In the current code, SQ term is calculated as (line 236 in tbrmmdiagnostics.py)

`sq = np.sqrt(phi * (n + 1) / (n * n_test * (n - 1)) + 1 / n + 1 / n_test)`

Shall we write it as
`sq = np.sqrt(phi * (n + n_test) / (n * n_test * (n - 1)) + 1 / n + 1 / n_test)`

I think `phi * (n + 1) / (n * n_test * (n - 1))` part is to estimate

$$\frac{(X_h - \bar{X})^2}{\sum (X_i - \bar{X})^2}$$

Which is $$\approx \frac{\sigma_x^2 (\frac{1}{n} + \frac{1}{n_{test}}) \chi^2(1)}{\sigma_x^2 \chi^2(n-1)} = F(1, n-1) \cdot \frac{\frac{n + n_{test}}{n \cdot n_{test}}}{n-1}$$

Not
$$F(1, n-1) \cdot \frac{\frac{n + 1}{n \cdot n_{test}}}{n-1}$$

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.