nanmean of a variable that should meet 2 conditions
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
I have a matrix with time observations that are labelled as 1 till 92 for every firm in the matrix. S, assume time 1 refers to march 1996, then every firm in the matrix has a time 1 that refers to march 1996. I tried to take the average of each time period in the matrix by running the following
for m=1:92
B(m:92:end,1)=nanmean(A(m:92:end,1));
end
the issue is that I have different size groups that are equals to 1(large firms), 2(medium size) and 3 (small) and the data is stored in A second column
how can i take the average of each time period for each size group? (i.e when A(i,1)=1 and A(i,2)=3 I want B (i,1) to be the nanmean of the first column of A that have time 1 and size 3 where i is the row number.
0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Shifting and Sorting Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!