Skip to content

Instantly share code, notes, and snippets.

@monhime
Last active March 9, 2020 22:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save monhime/f2b6013bc447e0c510d321e713cfdb10 to your computer and use it in GitHub Desktop.
Save monhime/f2b6013bc447e0c510d321e713cfdb10 to your computer and use it in GitHub Desktop.
POSTからツイートまでの時間差の分析
%% 計算
% POSTからツイートまでの時間差のベクトル
% 除外した外れ値:2.079s(301)
% 上から301,334,448(今後各競技ごとに分けたい時用に分けておく)
r = [1.211, 1.178, 1.251,1.232,...
1.159, 1.018, 1.139,1.293,1.149,...
1.158, 1.183, 1.102,1.249,1.211];
% ヒストグラム・確率分布を表示
bin = round(log2(length(r))+1); % スタージェスの公式
histfit(r,bin);% rを正規分布にフィット(入力2はビンの数)
xlabel({'POSTからツイートまでの時間差 [s]'});
ylabel({'要素数'});
pd = fitdist(r','Normal');%入力は列ベクトル
disp(pd); % フィットした確率分布の情報
%ある値t1での正規分布pdのcdf値p1
t1 = 1.138;
p1 = cdf(pd,t1);
str1 = "t="+string(t1)+"sでのcdf値p="+string(p1);
disp(str1);
% cdf値がp2となる正規分布pdでの値t2
p2 = 0.10;
t2 = icdf(pd,p2);
str2 = "cdf値p="+string(p2)+"となるt="+string(t2);
disp(str2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment