The correlation problem
Given three random variables A, B, C and given bounds on two of the three correlation coefficients:
-0.2 <= ρ_AB <= -0.1
0.4 <= ρ_BC <= 0.5
We can use the following property of the correlations to determine bounds on ρ_AC by solving a SDP:
| 1 ρ_AB ρ_AC |
| ρ_AB 1 ρ_BC | ≽ 0
| ρ_AC ρ_BC 1 |
using JuMP
import SCS
function example_corr_sdp()
model = Model(SCS.Optimizer)
set_silent(model)
@variable(model, X[1:3, 1:3], PSD)
# Diagonal is 1s
@constraint(model, X[1, 1] == 1)
@constraint(model, X[2, 2] == 1)
@constraint(model, X[3, 3] == 1)
# Bounds on the known correlations
@constraint(model, X[1, 2] >= -0.2)
@constraint(model, X[1, 2] <= -0.1)
@constraint(model, X[2, 3] >= 0.4)
@constraint(model, X[2, 3] <= 0.5)
# Find upper bound
@objective(model, Max, X[1, 3])
optimize!(model)
println("An upper bound for X[1, 3] is $(value(X[1, 3]))")
# Find lower bound
@objective(model, Min, X[1, 3])
optimize!(model)
println("A lower bound for X[1, 3] is $(value(X[1, 3]))")
return
end
example_corr_sdp()
An upper bound for X[1, 3] is 0.8719220303159311
A lower bound for X[1, 3] is -0.9779989594171764
This tutorial was generated using Literate.jl. View the source .jl
file on GitHub.