3
In the example matrix below (daily stock returns) :
IBOV PETR4 VALE5 ITUB4 BBDC4 PETR3
[1,] -0.03981646 -0.027412907 -0.051282051 -0.05208333 -0.047300526 -0.059805285
[2,] -0.03000415 -0.030534351 -0.046332046 -0.03943116 -0.030090271 -0.010355030
[3,] -0.02241318 -0.026650515 0.000000000 -0.04912517 -0.077559462 0.005231689
[4,] -0.05584830 -0.072184194 -0.066126856 -0.04317056 -0.066704036 0.000000000
[5,] 0.01196833 -0.004694836 0.036127168 -0.00591716 -0.006006006 Inf
[6,] 0.02039587 0.039083558 0.009762901 0.01488095 0.024169184 0.011783189
I would like to replace the values 0 (Zero) and Inf by the value of the first column in the same row as 0 or Inf.
Any idea ?
Just so I’m clear, you want to trade 0 or infinity for the Ibovespa values?
– Carlos Cinelli
I want to exchange the 0 and Infinitos for the values of the Ibovespa on the same day. For example Vale5 in row 3 would be -0.022413418 The PETR3 in row 5 would be 0.01196833
– RiskTech