Additional documentation needed on difference between calculator type test statistic return type
See original GitHub issueSummary
There is a large discrepancy in the value of the discovery test statistic if it is generated via an Asymptotic based or toy based calculator.
Related Issues:
OS / Environment
$ cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.4 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.4 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
Steps to Reproduce
# issue_1792.py
import pyhf
def discovery_from_test_stat(model, data):
init_pars = model.config.suggested_init()
par_bounds = model.config.suggested_bounds()
fixed_params = model.config.suggested_fixed()
return pyhf.infer.test_statistics.q0(
0.0,
data,
model,
init_pars,
par_bounds,
fixed_params,
)
def discovery_from_calculator(model, data, calc_type="asymptotics", **kwargs):
calculator = pyhf.infer.utils.create_calculator(
calc_type, data, model, test_stat="q0", **kwargs
)
return calculator.teststatistic(0.0)
def discovery_from_asymptotic_calculator(model, data):
calculator = pyhf.infer.calculators.AsymptoticCalculator(
data, model, test_stat="q0"
)
return calculator.teststatistic(0.0)
if __name__ == "__main__":
model = pyhf.simplemodels.uncorrelated_background([25], [2500], [2.5])
data = [2600] + model.config.auxdata
discovery_test_stat = discovery_from_test_stat(model, data)
print(f"Discovery test stat from infer.test_statistics.q0: {discovery_test_stat}")
discovery_test_stat = discovery_from_calculator(model, data, calc_type="toybased")
print(
f"Discovery test stat from toy based infer.utils.create_calculator: {discovery_test_stat}"
)
discovery_test_stat = discovery_from_calculator(model, data)
print(
f"Discovery test stat from asymptotics infer.utils.create_calculator: {discovery_test_stat}"
)
discovery_test_stat = discovery_from_asymptotic_calculator(model, data)
print(
f"Discovery test stat from infer.calculators.AsymptoticCalculator: {discovery_test_stat}"
)
File Upload (optional)
No response
Expected Results
The discovery test statistic would be the same regardless of calculator type.
Actual Results
$ python issue_1792.py
Discovery test stat from infer.test_statistics.q0: 3.9377335959507036
Discovery test stat from toy based infer.utils.create_calculator: 3.9377335959507036
Discovery test stat from asymptotics infer.utils.create_calculator: 1.485845489706193
Discovery test stat from infer.calculators.AsymptoticCalculator: 1.485845489706193
pyhf Version
9fd99be886349a90e927672e950cc233fad0916c on master
Code of Conduct
- I agree to follow the Code of Conduct
Issue Analytics
- State:
- Created 2 years ago
- Comments:13 (13 by maintainers)
Top Results From Across the Web
TI 83/84 Calculator – The Basics of Statistical Functions
Using the Calculator: To find the mean and standard deviation of a probability distribution, First: STAT > EDIT, then in L1 put in...
Read more >T.TEST function - Microsoft Support
Returns the probability associated with a Student's t-Test. Use T.TEST to determine whether two samples are likely to have come from the same...
Read more >One sample t test - GraphPad
The one sample t test calculator assumes it is a two-tailed one sample t test, meaning you are testing for a difference in...
Read more >Source code for tsfresh.feature_extraction.feature_calculators
This feature calculator returns the value of the respective test statistic. See the statsmodels implementation for references and more details.
Read more >T.TEST - Google Docs Editors Help
TEST returns the probability of a higher value of the t-statistic under the assumption that range1 and range2 are samples from populations with...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

this part I think is what confuses me, so if you have a better grasp, it would be great to clarify this for the upcoming release.
Yes, I didn’t phrase the original text clearly as I was dumping things in for myself to clarify later.