我对统计不确定性的实施有疑问。在pyhf文档https://scikit-hep.org/pyhf/likelihood.html#sample中,您提到了推断统计不确定性的方法是使用带有“ type”:“ staterror”且数据字段= [0.1]的修饰符。
因此,假设我有一个来自MC的后台频道,并且将我的发行版分为3个bin:
"name": "background",
"data": [300., 50., 60.]
您如何正确考虑统计不确定性?从泊松pdf的构造中,我要说的是,通过构造,您已经考虑了统计不确定性。还是我必须包含一个包含staterror的修饰符?staterror的数据字段到底是什么?
我有一个来自MC的后台频道
鉴于您似乎想对由于有限的蒙特卡洛样本大小而引起的形状不确定性建模,最好使用staterror
。在bin中的staterror
所有样本(具有staterror
修饰符)之间共享,并使用法线约束应用约束,约束的强度是正交添加的每个样本不确定性。此处的data
键表示样本每个仓中的绝对不确定性(在这种情况下,为仓数的泊松不确定性):
因此,考虑到您的示例具有3个容器的单个背景样本,示例规格可能看起来像这样(我将其命名为bkg_only_spec.json
)
{
"channels": [
{
"name": "single_channel",
"samples": [
{
"name": "background",
"data": [
300.0,
50.0,
60.0
],
"modifiers": [
{
"name": "uncorr_bkguncrt",
"type": "staterror",
"data": [
17.32051,
7.07107,
7.74597
]
}
]
}
]
}
],
"observations": [
{
"name": "single_channel",
"data": [
300.0,
50.0,
60.0
]
}
],
"measurements": [
{
"name": "Measurement",
"config": {
"poi": "mu",
"parameters": []
}
}
],
"version": "1.0.0"
}
我们可以看到(注意constrained_by_normal
)仍然是CLI的inspect
有效规范(尽管您当然也需要信号样本来进行任何推断)
$ pyhf --version
pyhf, version 0.5.1
$ python answer.py
$ pyhf inspect bkg_only_spec.json
Summary
------------------
channels 1
samples 1
parameters 1
modifiers 1
channels nbins
---------- -----
single_channel 3
samples
----------
background
parameters constraint modifiers
---------- ---------- ----------
uncorr_bkguncrt constrained_by_normal staterror
measurement poi parameters
---------- ---------- ----------
(*) Measurement mu (none)
以下是answer.py
生成规范的地方。
# answer.py
import numpy as np
import json
def main():
bins = [300.0, 50.0, 60.0]
# rounding, as keeping full floating point is maybe a bit silly
poisson_uncert = np.sqrt(bins).round(decimals=5).tolist()
# just set the observations to be the same as the bin count here
# as a placeholder
spec = {
"channels": [
{
"name": "single_channel",
"samples": [
{
"name": "background",
"data": bins,
"modifiers": [
{
"name": "uncorr_bkguncrt",
"type": "staterror",
"data": poisson_uncert,
}
],
}
],
}
],
"observations": [{"name": "single_channel", "data": bins}],
"measurements": [
{"name": "Measurement", "config": {"poi": "mu", "parameters": []}}
],
"version": "1.0.0",
}
with open("bkg_only_spec.json", "w") as spec_file:
json.dump(spec, spec_file, indent=4)
if __name__ == "__main__":
main()
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句