0

私は現在、日付のデータセット、会社の識別子、関心のある値を csv ファイルに持っています。会社識別子と値は両方とも数値です。私のデータは現在フラットファイル形式であるため、現在次のような行があります

companyid date value

1111 09/14/1986 1234

1111 10/14/1986 5678

1111 11/14/1986 9012

つまり、フラット ファイル形式の時系列があります。各企業の時系列オブジェクトを構築して、このデータを要約したいと思います。次に、すべての企業で集計された、各時点での値の特定の分位点の時系列プロットを作成したいと思います。他に指摘すべきことは、companyid/date のペアは一意であるため、データセットに重複がなく、データは既に companyid と日付でソートされていることです。

これまでに試したことは次のとおりです。

% col 1 = companyid, col 2 = date, col 3 = value
[rows, cols] = size(data);
distinct_comp = 0;
for ii=1:rows
    if data(ii, 1) ~= data(ii-1,1)
        distinct_comp = distinct_comp + 1;
    end
end
disp distinct_comp

%Create initial time series object and place data(1,3) and data(1,2) inside
for jj = 2:rows
    if data(jj,1)==data(jj-1,1)
        % Add data (jj,2) and data(jj, 3) to existing time series object
    else
        % Create new time series object and add data(jj,2) and data(jj,3)
    end
end
% disp number of time-series objects to check if same as distinct_comp
4

0 に答える 0