我需要绘制从文件中读取的整数值的 cdf。我正在按照此处的示例进行操作。我不确定如何规范化 pdf 的数据,然后计算 cdf。
import numpy as np
from pylab import *
with open ("D:/input_file.txt", "r+") as f:
data = f.readlines()
X = [int(line.strip()) for line in data]
Y = exp([-x**2 for x in X]) # is this correct?
# Normalize the data to a proper PDF
Y /= ... # not sure what to write here
# Compute the CDF
CY = ... # not sure what to write here
# Plot both
plot(X,Y)
plot(X,CY,'r--')
show()
万千封印
相关分类