返回题库

概率 条件独立

Prob Conditional Independence

专题
Probability / 概率
难度
L2
来源
MyntBit

题目详情

分析两个算法交易策略 A 和 B 在 VIX 指数超过 20 的日子上的表现。设 C 为某日 VIX 超过 20 的事件。观察到在给定 C 的条件下,策略 A 和 B 的收益是条件独立的。

任务:设 A 为策略 A 盈利的事件,B 为策略 B 盈利的事件。已知 P(A|C)=0.6,P(B|C)=0.5,P(C)=0.3。利用条件独立计算 P(A∩B|C) = P(A|C)×P(B|C) = 0.30,以及 P(A∩B) = P(A∩B|C)×P(C) + P(A∩B|C')×P(C')。

英文原题

Suppose you are analyzing the performance of two algorithmic trading strategies, A and B, on days when the VIX index is above 20. Let C be the event that the VIX index is above 20 on a given day. You observe that strategies A and B's returns are conditionally independent given C.
Specifically, let A be the event that strategy A is profitable on a given day, and let B be the event that strategy B is profitable on the same day. You are told that P(ABC)=P(AC)P(BC)P(A \cap B | C) = P(A | C) P(B | C).
Does this c

解析

问题分析

Suppose you are analyzing the performance of two algorithmic trading strategies, A and B, on days when the VIX index is above 20. Let C be the event that the VIX index is above 20 on a given day. You observe that strategies A and B's returns are conditionally independent given C.
Specifically, let A

解法

根据题目要求实现相应功能。核心逻辑需要:

// 核心数据结构和方法——根据题目 API 约定实现
// 1. 确定状态表示——选择支持所需操作的数据结构
// 2. 实现核心算法——确保 O(·) 时间复杂度和正确性
// 3. 处理边界条件——空输入、极值参数、并发访问

验证

用具体输入验证:构造已知输入的测试用例,确认输出匹配预期结果。

复杂度与边界

  • 时间复杂度:取决于选用的算法
  • 空间复杂度:取决于数据规模
  • 关键边界条件:空输入、极值参数、并发场景下的正确性保证

英文解析

Analysis

Suppose you are analyzing the performance of two algorithmic trading strategies, A and B, on days when the VIX index is above 20. Let C be the event that the VIX index is above 20 on a given day. You observe that strategies A and B's returns are conditionally independent given C. This means P(A,B|C) = P(A|C) * P(B|C). However, unconditional independence P(A,B) = P(A) * P(B) may not hold, because both strategies depend on the same market regime C. This is an example of explaining away: C is a common cause of both A and B, creating an unconditional correlation despite conditional independence.

Solution

struct ProbParams { double p_c, p_a_given_c, p_a_given_not_c, p_b_given_c, p_b_given_not_c; };
double computeUnconditionalCorrelation(const ProbParams& p) {
    double p_a = p.p_c * p.p_a_given_c + (1 - p.p_c) * p.p_a_given_not_c;
    double p_b = p.p_c * p.p_b_given_c + (1 - p.p_c) * p.p_b_given_not_c;
    double p_ab = p.p_c * p.p_a_given_c * p.p_b_given_c  // P(A,B|C)
                + (1 - p.p_c) * p.p_a_given_not_c * p.p_b_given_not_c;  // P(A,B|not C)
    return p_ab - p_a * p_b;  // Positive = correlated despite conditional independence
}

Complexity & Edge Cases

  • Time complexity: O(1)
  • Space complexity: O(1)
  • Edge cases: (1) If P(A|C) = P(A|not C), A is independent of C and truly independent of B (2) Correlation sign depends on how C affects both variables (3) Explaining away requires C to affect both A and B in the same direction

Verification

Set P(C)=0.5, P(A|C)=0.8, P(A|not C)=0.3, P(B|C)=0.7, P(B|not C)=0.2. Compute unconditional correlation - should be positive despite conditional independence.

Key Considerations

Conditional independence with unconditional correlation is fundamental to Bayesian networks in finance. Two strategies may appear correlated because they both respond to the same market regime, but within a regime they are independent. This insight is critical for portfolio construction: diversification should account for regime-dependent correlations, not just unconditional correlations.