如何实现蒙特卡洛模拟以按照5个实验数据点的特定曲线趋势添加额外的数据点?
我有一个指数曲线和5个外部实验数据点,我需要创建一个蒙特卡洛模拟,该模拟将添加额外的数据点,遵循现有5个数据点相同的趋势(与它们偏离曲线的偏差有关)。我的代码如下:
import numpy as np
import matplotlib.pyplot as plt
def probability(dose):
p = 1 - np.exp(- b0 - b1*dose)
return p
b0 = 0.0097
b1 = 0.0449
d = np.linspace(0, 3.5, 1000)[1:]
x = d
y = probability(d)
plt.plot(x, y)
plt.xlim(xmin=0)
plt.ylim(ymin=0)
plt.yticks([0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1])
a = [0, 0.01, 0.1, 0.5, 2]
b = [0, 0.01, 0.01, 0.05, 0.09]
plt.scatter(a, b, cmap='hot', clip_on=False)
plt.title("Dose-Response for acrylamide")
plt.xlabel("Dose")
plt.ylabel("Probability")
plt.show()
由于我对使用Python进行编码蒙特卡洛模拟很少,因此对任何帮助都将不胜感激。提前致谢。
I have an exponential curve and 5 external experimental data points, and I need to create a Monte Carlo simulation which will be adding extra data points following the same trend of the existing 5 data points (in relation to their deviation from the curve). My code is the following:
import numpy as np
import matplotlib.pyplot as plt
def probability(dose):
p = 1 - np.exp(- b0 - b1*dose)
return p
b0 = 0.0097
b1 = 0.0449
d = np.linspace(0, 3.5, 1000)[1:]
x = d
y = probability(d)
plt.plot(x, y)
plt.xlim(xmin=0)
plt.ylim(ymin=0)
plt.yticks([0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1])
a = [0, 0.01, 0.1, 0.5, 2]
b = [0, 0.01, 0.01, 0.05, 0.09]
plt.scatter(a, b, cmap='hot', clip_on=False)
plt.title("Dose-Response for acrylamide")
plt.xlabel("Dose")
plt.ylabel("Probability")
plt.show()
Since I know very little of coding Monte Carlo simulation with Python, any help would be appreciated a lot. Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论