Monte Carlo Simulation in Practice
A hands-on guide to implementing Monte Carlo simulation for uncertainty quantification in your LCA studies.
Prerequisites:
Monte Carlo Simulation in Practice
Monte Carlo simulation transforms uncertain LCA inputs into probabilistic outputs, enabling robust decision-making under uncertainty. This lesson provides practical guidance on implementing Monte Carlo analysis in your LCA work.
Monte Carlo provides rigorous statistical uncertainty analysis but requires additional effort and expertise. For many studies, a Data Quality Assessment (DQA) using pedigree matrices is a practical alternative that satisfies ISO 14044 requirements. See the Uncertainty Analysis module for guidance on when DQA alone may be sufficient versus when Monte Carlo adds value.
Monte Carlo Fundamentals
The Core Concept
Monte Carlo simulation works by:
- Treating uncertain inputs as probability distributions
- Randomly sampling from these distributions
- Running the LCA calculation with each sample set
- Collecting results to form an output distribution
After many iterations, the output distribution represents the range of possible outcomes given input uncertainties.
When to Use Monte Carlo
Monte Carlo is valuable when:
- Comparing products with similar performance
- Making high-stakes decisions based on LCA results
- Communicating results to skeptical audiences
- Validating the robustness of conclusions
- Understanding which parameters drive uncertainty
It may be unnecessary for:
- Screening studies where precision isn't critical
- Situations where one option clearly dominates
- Internal quick assessments
- Educational purposes
Setting Up Distributions
Choosing Distribution Types
Match distributions to your knowledge about each parameter:
Lognormal (most common for LCA)
Use when:
- Values must be positive
- You have a mean and estimate of spread
- Variation is proportional to magnitude
Parameters:
- Geometric mean (μg): the median value
- Geometric standard deviation (σg): multiplicative spread
If you believe the true value is between L and H with 95% confidence:
σg ≈ √(H/L) / 1.645
μg ≈ √(L × H)
Normal
Use when:
- Values can be positive or negative
- Symmetric variation around mean
- You have mean and standard deviation
Triangular
Use when:
- You can estimate minimum, maximum, and most likely
- Expert judgment drives the estimate
- Data is limited
Uniform
Use when:
- Only bounds are known
- All values within range are equally likely
Practical Distribution Selection
| Situation | Recommended Distribution |
|---|---|
| Measured data with known SD | Normal (if symmetric) or Lognormal |
| Database values with pedigree | Lognormal (use pedigree factors) |
| Expert estimate with range | Triangular |
| Only bounds known | Uniform |
| Ratio or multiplicative uncertainty | Lognormal |
The Pedigree-to-Distribution Workflow
ecoinvent and other databases use pedigree matrices to generate lognormal distributions:
- Assess pedigree scores (1-5) for each indicator
- Look up uncertainty factors from pedigree tables
- Calculate combined uncertainty:
σg² = σbase² + σR² + σC² + σT² + σG² + σTech² - Apply to parameter as lognormal(mean, σg)
Illustrative pedigree uncertainty factors (σ² values):
These are simplified illustrative values for teaching purposes. The actual ecoinvent pedigree matrix uses different base uncertainty factors and a more complex calculation. Always consult the official ecoinvent methodology documentation (Weidema et al., 2013) or your database's specific implementation when conducting real analyses.
| Score | Reliability | Completeness | Temporal | Geographic | Technological |
|---|---|---|---|---|---|
| 1 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 |
| 2 | 0.0006 | 0.0001 | 0.0002 | 0.0001 | 0.0006 |
| 3 | 0.002 | 0.0006 | 0.002 | 0.0004 | 0.008 |
| 4 | 0.008 | 0.002 | 0.008 | 0.04 | 0.04 |
| 5 | 0.04 | 0.008 | 0.04 | 0.12 | 0.12 |
Implementing Monte Carlo
Implementation Steps
Step 1: Identify uncertain parameters
Not everything needs uncertainty distributions. Focus on:
- Parameters with significant contributions to results
- Parameters with known data quality issues
- Parameters where alternatives exist
Step 2: Assign distributions
Document your choices:
| Parameter | Distribution | Parameters | Rationale |
|---|---|---|---|
| Electricity use | Lognormal | μg=2.5 kWh, σg=1.25 | Pedigree assessment |
| Transport dist. | Triangular | 300, 500, 800 km | Expert estimate |
| Steel input | Lognormal | μg=15 kg, σg=1.1 | Measured with ±10% uncertainty |
Step 3: Handle correlations
Identify correlated parameters:
- Electricity and cooling water (both scale with production)
- Material input and waste output (mass balance)
- Regional parameters (shared data source)
Options for handling:
- Sample correlated parameters together
- Use copulas for complex correlation structures
- Document and acknowledge if not addressed
Step 4: Run simulation
Number of iterations needed depends on:
- Required precision of percentile estimates
- Complexity of the model
- Available computation time
General guidance:
- 1,000 iterations: Rough estimates, screening
- 10,000 iterations: Standard analysis
- 100,000+ iterations: High precision, rare events
Step 5: Analyze results
Calculate and report:
- Mean, median, standard deviation
- Confidence intervals (e.g., 5th-95th percentile)
- Probability of exceeding thresholds
- For comparisons: probability A < B
Software-Specific Guidance
openLCA
-
Add uncertainty to flows:
- Open a process
- Click an input/output amount
- Select "Define uncertainty"
- Choose distribution and parameters
-
Run Monte Carlo:
- Open product system
- Click Calculate → Monte Carlo simulation
- Select LCIA method
- Set number of iterations
- Run and wait
-
Analyze results:
- View histogram of results
- Export data for external analysis
- Compare distributions across impact categories
SimaPro
-
Define uncertainty:
- In process records, enter uncertainty for each exchange
- Use default pedigree-based uncertainty or custom distributions
-
Run analysis:
- Calculate → Monte Carlo
- Set iterations and confidence level
- View statistical results and graphs
-
Advanced features:
- Contribution to variance analysis
- Comparative Monte Carlo for alternatives
Python/Brightway
import brightway2 as bw
import numpy as np
from scipy import stats
# Setup
bw.projects.set_current("your_project")
db = bw.Database("your_database")
method = ('ReCiPe Midpoint', 'climate change', 'GWP100')
# Define activity
activity = db.get("your_activity_code")
# Monte Carlo LCA
mc = bw.MonteCarloLCA({activity: 1}, method)
results = [next(mc) for _ in range(1000)]
# Analysis
mean = np.mean(results)
median = np.median(results)
ci_95 = np.percentile(results, [2.5, 97.5])
print(f"Mean: {mean:.2f}")
print(f"Median: {median:.2f}")
print(f"95% CI: [{ci_95[0]:.2f}, {ci_95[1]:.2f}]")
Analyzing Monte Carlo Results
Statistical Summary
Report these statistics:
| Statistic | Calculation | Interpretation |
|---|---|---|
| Mean | Sum/N | Average expected value |
| Median | 50th percentile | Central tendency (robust to outliers) |
| SD | √(Σ(x-mean)²/N) | Spread of results |
| CV | SD/Mean × 100% | Relative spread |
| 95% CI | 2.5th to 97.5th percentile | Range capturing 95% of outcomes |
Contribution to Variance
Identify which inputs drive output uncertainty:
- Calculate correlation between each input and the output
- Square correlations to get variance contribution
- Rank parameters by contribution
Parameters contributing most to variance are priorities for:
- Better data collection
- Sensitivity testing
- Uncertainty reduction efforts
Comparing Alternatives
For product comparisons, calculate:
Pairwise difference in each iteration:
diff[i] = GWP_A[i] - GWP_B[i]
Probability of outperformance:
P(A better) = count(diff < 0) / N
Significant difference: If 95% CI of difference excludes zero, the difference is statistically significant.
Visualization
Histograms: Show distribution shape
- Include mean/median lines
- Mark confidence intervals
- Use consistent binning across comparisons
Box plots: Compare multiple options
- Show median, quartiles, outliers
- Easy comparison across alternatives
Cumulative distribution functions (CDF): Show probability of exceedance
- Read off probability of meeting targets
- Compare entire distributions
Scatter plots: Show input-output relationships
- Identify influential parameters
- Reveal non-linear relationships
Handling Common Issues
Convergence
Results should stabilize as iterations increase. Check convergence by:
- Plot running mean vs. iteration number
- If mean is still changing significantly, run more iterations
- For percentile estimates, need more iterations than for mean
Extreme Values
Outliers in results may indicate:
- Very wide input distributions
- Multiplicative effects through supply chain
- Model sensitivity to certain parameter combinations
Investigate extreme values to ensure they're meaningful, not errors.
Negative Values
If physical quantities go negative (impossible):
- Check distribution choices (use lognormal for positive-only)
- Truncate distributions at zero
- Re-parameterize model
Long Run Times
For complex models:
- Start with fewer iterations for testing (100-500)
- Use parallel processing if available
- Consider simplified models for screening
- Focus uncertainty on most influential parameters
Advanced Topics
Latin Hypercube Sampling
More efficient than simple random sampling:
- Stratifies each distribution into equal-probability intervals
- Ensures full distribution coverage with fewer samples
- Often achieves convergence 10x faster
Most LCA software offers this as an option.
Global Sensitivity Analysis
Beyond local sensitivity, global methods explore the entire parameter space:
Sobol' indices: Decompose variance into first-order and interaction effects
Morris method: Efficient screening for many parameters
These reveal non-linear effects and parameter interactions missed by local sensitivity.
Bayesian Approaches
For incorporating prior knowledge and updating with new data:
- Prior distributions reflect existing knowledge
- Likelihood function incorporates new observations
- Posterior distribution combines both
Advanced topic requiring specialized tools (e.g., PyMC, Stan).
Key Takeaways
- Choose distributions based on available information—lognormal is often appropriate
- Focus uncertainty analysis on influential parameters
- Run enough iterations for stable results (10,000 is typical)
- For comparisons, calculate probability of outperformance
- Report confidence intervals, not just point estimates
- Contribution to variance identifies priorities for data improvement
Practice Exercise
For a simplified product system with three uncertain inputs:
- Material A: Lognormal(10 kg, σg=1.3)
- Energy: Triangular(5, 8, 15 kWh)
- Transport: Uniform(100, 500 km)
Emission factors (assume known):
- Material A: 2.5 kg CO₂/kg
- Energy: 0.5 kg CO₂/kWh
- Transport: 0.1 kg CO₂/km
- Calculate the deterministic GWP (using mean/mode values)
- Set up and run 1,000 Monte Carlo iterations
- Report mean, median, and 95% CI
- Which parameter contributes most to variance?
What's Next?
The next lesson explores the distinction between consequential and attributional LCA—two fundamentally different approaches to modeling that answer different questions about environmental impacts.
Further Reading
- Heijungs, R. (2020). On the Number of Monte Carlo Runs in Comparative Probabilistic LCA. International Journal of Life Cycle Assessment.
- Saltelli, A., et al. (2008). Global Sensitivity Analysis: The Primer. Wiley.
- Groen, E.A., & Heijungs, R. (2017). Ignoring Correlation in Uncertainty and Sensitivity Analysis in Life Cycle Assessment. International Journal of Life Cycle Assessment.