nanmean of a variable that should meet 2 conditions

조회 수: 1 (최근 30일)
Danielle Leblance
Danielle Leblance 2017년 2월 1일
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개)

카테고리

Help CenterFile Exchange에서 Statistics and Machine Learning Toolbox에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by