Salut,
je dois calculer une matrice des corrélations. j'ai écrit un code mais ça ne marche pas, enfin celui de la matrice des corrélations. en fait je crée un tableau et à partir de celui ci déterminer la matrice des covariances et des corrélations. si je pouvais avoir un p'tit coup de main svp.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Function matrice_covariance(T, n, p) As Long
Dim COV() As Integer
Dim MC() As Integer
Dim k As Integer
Dim l, i As Integer
Dim s As Long
 
ReDim COV(1 To p, 1 To p) As Integer
ReDim MC(1 To p) As Integer
For k = 1 To p
 
For l = 1 To p
 
s = 0
 
For i = 1 To n
 
s = s + T(i, k) * T(i, l)
 
Next i
 
COV(k, l) = s \ n - MC(k) * MC(l)
 
matrice_covariance = COV(k, l)
 
Next l
 
 
Next k
 
End Function
__________________________

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Sub matrice_correlation(n, p As Integer)

Dim COR() As Integer
Dim j, i As Integer
Dim COV() As Integer
Dim ET_L() As Integer
Dim ET_C() As Integer
Dim k, l As Integer

ReDim COR(1 To p, 1 To p) As Integer
ReDim COV(1 To p, 1 To p) As Integer
ReDim ET_L(1 To n) As Integer
ReDim ET_C(1 To p) As Integer


For i = 1 To n

For j = 1 To p



COR(i, j) = COV(i, j) \ ET_L(i) * ET_C(j) ça bloque à ce niveau
Next j

 
Next i

End Sub