🎲 Monte Carlo Simulator

Monte Carlo Simulation and Analysis

Restore Saved Configuration
Load the input.json from a report package to restore variables, formula, sample count, CDF degree, and random seed.

Step 1: Add Variables (JSON Format)

📖 Show Input Examples

字段说明

基础字段
type
data 使用实测数据;params 使用统计参数。
values
data 类型需要,填写原始数据数组。
distribution
paramsdata + fit 使用;data + bootstrap 可省略。
可选字段
sampling_method
data 类型使用:bootstrapfit,默认 bootstrap
bootstrap_statistic
仅 bootstrap 使用:meanvalue,默认 mean
min_limit / max_limit
额外限制采样范围;bootstrap 会先过滤原始数据。
data + bootstrap

从原始数据有放回抽样,不假设理论分布。

distribution 不决定抽样形状。

data + fit

先用原始数据拟合 distribution,再从拟合分布抽样。

bootstrap_statistic 不生效。

params

直接使用分布参数,例如 mean/stdmin/max

不使用 valuessampling_method

bootstrap_statistic="mean" 表示每轮重抽原始样本量并取均值;"value" 表示每轮抽一个观测值。 min/max 是分布参数,min_limit/max_limit 是采样截断范围。 指数分布的 scalerate 二选一;当前 bootstrap 按变量独立抽样,不保留行配对关系。 字段别名:input_mode/data/dist_type/min_value/max_value

支持的9种概率分布

分布类型 参数 适用场景
normal mean, std 测量误差、自然现象
t mean, std, df 小样本、重尾数据
lognormal mean, std (对数空间) 价格、收入、资产
uniform min, max 等可能、缺乏信息
triangular min, mode, max 专家估计、项目管理
beta alpha, beta, min, max 百分比、概率、完成度
gamma shape, scale 等待时间、寿命分析
exponential scale (或 rate) 故障时间、服务时间
weibull shape, scale 可靠性分析、风速

示例 1: Bootstrap 均值分布 (Data)

{
  "P1": {
    "type": "data",
    "values": [25, 25, 17, 17, 13, 1, 5, 20, 8, 31,
    16, 6, 5, 11, 14, 174, 8, 22, 8, 6,
    9, 4, 77, 77, 75, 52, 15, 20, 14, 93,
    3, 20, 124, 28, 36, 21, 29, 27, 3, 181,
    22, 127, 43, 82, 59],
    "sampling_method": "bootstrap"
  },
  "C": {
    "type": "data",
    "values": [34963.61, 32496.26, 35525.13, 32395.24, 31133.41, 31233.43, 29989.2, 26530.1, 36463.79],
    "sampling_method": "bootstrap"
  }
}
默认使用 bootstrap_statistic="mean",适合公式中的变量代表一组测试值的均值。

示例 2: 拟合 t 分布 (Data + fit)

{
  "P1": {
    "type": "data",
    "values": [43.90, 80.05, 60.24, 90.22, 109.52, 84.03, 101.04, 84.60, 73.26, 62.71, 80.72, 85.11, 65.42, 51.02, 133.96,
224.57, 96.98, 55.98, 112.91, 158.73, 63.67, 53.70, 45.55, 89.25],
    "distribution": "t",
    "sampling_method": "fit",
    "min_limit": 0.1
  },
  "C": {
    "type": "data",
    "values": [1255.80,1168.12, 1275.73, 1164.53, 1119.68, 1123.21, 1078.96, 955.83, 1309.05],
    "distribution": "t",
    "sampling_method": "fit",
    "min_limit": 500
  }
}
sampling_method="fit" 会根据原始数据拟合指定分布;如果省略该字段,data 类型默认会走 bootstrap。

示例 3: Bootstrap 单个观测值 (Data)

{
  "单次浓度": {
    "type": "data",
    "values": [82, 91, 88, 105, 97, 76, 110, 94, 89, 101],
    "sampling_method": "bootstrap",
    "bootstrap_statistic": "value"
  }
}
适用于公式中的变量代表一次随机观测,而不是一组测试值的均值。

示例 4: 正态分布 (Params 与 Data + fit)

{
  "测量值": {
    "type": "data",
    "values": [10.5, 11.2, 9.8, 10.1, 10.7, 11.0, 10.3],
    "distribution": "normal",
    "sampling_method": "fit"
  },
  "理论值": {
    "type": "params",
    "mean": 100,
    "std": 5,
    "distribution": "normal"
  }
}
上面的 测量值 会先从原始数据拟合 normal;理论值 直接使用给定的 normal 参数。

示例 5: 对数正态分布 (Lognormal)

{
  "资产价值": {
    "type": "params",
    "mean": 13.8,
    "std": 0.5,
    "distribution": "lognormal"
  }
}
注意:mean 和 std 是对数空间的参数

示例 6: 均匀分布 (Uniform)

{
  "折扣率": {
    "type": "params",
    "min": 0.05,
    "max": 0.15,
    "distribution": "uniform"
  }
}

示例 7: 三角分布 (Triangular)

{
  "项目工期": {
    "type": "params",
    "min": 10,
    "mode": 15,
    "max": 25,
    "distribution": "triangular"
  }
}
适用于有最小值、最可能值、最大值的专家估计

示例 8: Beta 分布

{
  "完成率": {
    "type": "params",
    "alpha": 2,
    "beta": 5,
    "min": 0,
    "max": 1,
    "distribution": "beta"
  }
}
适用于有界变量,如百分比、概率等

示例 9: Gamma 分布

{
  "等待时间": {
    "type": "params",
    "shape": 2,
    "scale": 3,
    "distribution": "gamma"
  }
}

示例 10: 指数分布 (Exponential)

{
  "故障时间": {
    "type": "params",
    "scale": 100,
    "distribution": "exponential"
  }
}
也可以使用 rate 参数(rate = 1/scale)

示例 11: Weibull 分布

{
  "元件寿命": {
    "type": "params",
    "shape": 1.5,
    "scale": 5000,
    "distribution": "weibull"
  }
}

示例 12: 混合使用多种分布

{
  "收入": {
    "type": "params",
    "mean": 13.8,
    "std": 0.5,
    "distribution": "lognormal"
  },
  "成本": {
    "type": "params",
    "mean": 100000,
    "std": 5000,
    "distribution": "normal"
  },
  "折扣": {
    "type": "params",
    "min": 0.05,
    "max": 0.15,
    "distribution": "uniform"
  },
  "完成度": {
    "type": "params",
    "alpha": 8,
    "beta": 2,
    "min": 0,
    "max": 1,
    "distribution": "beta"
  }
}

示例 13: 带限值约束

{
  "温度": {
    "type": "params",
    "mean": 20,
    "std": 3,
    "distribution": "normal",
    "min_limit": 15,
    "max_limit": 25
  },
  "压力": {
    "type": "params",
    "mean": 100,
    "std": 5,
    "distribution": "normal",
    "min_limit": 85,
    "max_limit": 115
  }
}
min_limit 和 max_limit 会限制采样范围
Paste JSON format variable definition, click "Show Input Examples" above to view examples

Step 2: Define Function

📖 Show Simple Formula Examples

示例 1: 百分比计算

1 - P1 / C
计算剩余比例(常用)

示例 2: 基本算术运算

A + B
两个变量相加

示例 3: 乘法和除法

收入 * 折扣率
计算折扣后的收入

示例 4: 复合运算

(收入 - 成本) / 收入
计算利润率

示例 5: 加权平均

温度 * 0.6 + 压力 * 0.4
两个变量的加权求和

示例 6: 幂运算

A**2 + B**2
平方和计算

示例 7: 多变量组合

(A + B) * C - D
多个变量的复合计算

示例 8: 数学函数 - 三角函数

sin(弧度) + cos(弧度)
使用三角函数(用弧度)

示例 9: 数学函数 - 指数和对数

exp(A) + log(B)
指数函数和自然对数

示例 10: 数学函数 - 平方根

sqrt(A**2 + B**2)
计算向量长度
支持的运算符: +(加)、-(减)、*(乘)、/(除)、**(幂)、()(括号)
支持的数学函数: sin, cos, tan, exp, log, log10, sqrt, abs, pow
Use variable names directly in the formula
Polynomial fit degree (1-30)

Step 3: Generate Charts

Step 4: Analysis & Download

Generate analysis report and download simulation data

Reset Simulator