\(統計計算\)\(1\ \ \ データの集計\)\(2\ \ \ 共分散と相関係数\)\(3\ \ \ 回帰直線\)\(4\ \ \ 確率分布\ \ \ 
      確率密度関数\ \ \ 累積分布\ \ \ 
      累積確率密度関数\)

\(\(\(\(1\ \ \ データの集計

                
                \ \ \ \ \ \ \ \ {61, 88, 94, 96, 53, 50, 87, 69, 95, 71, 

                  	\ \ \ \ \ \ \ \ 95, 69, 52, 94, 99, 57, 94, 74, 64, 51, 

                  	\ \ \ \ \ \ \ \ 80, 57, 75, 72, 52, 77, 81, 85, 58, 65, 

                  	\ \ \ \ \ \ \ \ 88, 55, 74, 98, 82, 80, 88, 91, 92, 50, 

                  	\ \ \ \ \ \ \ \ 62, 72, 99, 93, 56, 91, 80, 60, 51, 67}

                \ \ \ \ \ A, \ B, \ C, \ 
                F\ \ の評価をする

                \ \ \ \ 
                平均値\ \ \ 最大値\ \ \ 
                  最小値\ \ \ 中央値 
                  \((メデ\)ィ\) アン)\)\ \ 
          最頻値 \((モード)\)

        \ \ \ \ 階層とヒストグラム

        \ \ \ \ 降順のソーティ\) ング\)\(\ \ \ 分散と標準偏差\)

A = Table[k, {k, 1, 50}];
\(\ \ \(B = {61, 88, 94, 96, 53, 50, 87, 69, 95, 
          71, 
	\ \ \ \ \ \ \ \ 95, 69, 52, 94, 99, 57, 94, 74, 64, 
          51, 
	\ \ \ \ \ \ \ \ 80, 57, 75, 72, 52, 77, 81, 85, 58, 
          65, 
	\ \ \ \ \ \ \ \ 88, 55, 74, 98, 82, 80, 88, 91, 92, 
          50, 
	\ \ \ \ \ \ \ \ 62, 72, 99, 93, 56, 91, 80, 60, 51, 
          67};\)\)
AB = Table[{k, B[[k]]}, {k, 1, 50}]

ABC = 
      Table[{k, B[[k]], 
          If[B[[k]] >= 80, "A", 
            If[B[[k]] >= 70, "B", 
              If[B[[k]] >= 60, "C", "F"]]] }, {k, 1, 
          50}]

<< Statistics`Master`

Mean[B] // N
Max[B]
Min[B]
Median[B] // N
Mode[B]

BS = BinCounts[B, {0, 100, 10}]

BSrev = BinCounts[B, {0, 100, 9.999}]

BS2 = {13, 7, 10, 20};

<< Graphics`Master`

\(\(\(BarChart[BS2, BarValues -> False, 
      BarLabels -> {"F", "C", "B", "A"}]\)\(
\)
    \(	\)\)\)

Reverse[Sort[B]]

sigma = StandardDeviationMLE[B] // N

Print["\:5206\:6563 = ", sigma^2]

\(2\ \ \ 共分散と相関係数\)\(\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {{97, 85}, {69, 68}, {94, 74}, {84, 71}, {
        54, 58}, 

      \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {69, 66}, {58, 61}, {57, 72}, {75, 
        78}, {61, 53}}\ \ \ \ \ \ \ \)

\(\(AB = \ \ {{97, 85}, {69, 68}, {94, 74}, {84, 71}, {54, 
            58}, 
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {69, 66}, {58, 
            61}, {57, 72}, {75, 78}, {61, 53}}\ ;\)\ \ \)
A = Table[AB[[k]][[1]], {k, 1, 10}]  ;
B = Table[AB[[k]][[2]], {k, 1, 10}]  ;
Print["\:5171\:5206\:6563 = ", CovarianceMLE[A, B] // N]
Print["\:76f8\:95a2\:4fc2\:6570 = ", 
      Correlation[A, B] // N]

\(3\ \ \ 回帰直線と散布図\)      {{2, 53}, {3, 67}, {4, 79}, {5, 88}, {6, 107}, {8, 101}}

dat = {{2, 53}, {3, 67}, {4, 79}, {5, 88}, {6, 107}, {8, 
            101}};

lp = ListPlot[dat]

Fit[dat, {1, x}, x]

kai = Plot[41.9 + 8.7 x, {x, 0, 9}, PlotRange -> {40, 120}]

Show[lp, kai, PlotRange -> {40, 120}]

\(4\ \ \ 確率分布\ \ \ 
      確率密度関数\ \ \ 累積分布\ \ \ 
      累積確率密度関数\)\(\ \ \ \ \ \ \ \ \ \ 
    ２項分布\ \ \ \ \ \ 
      ポアソン分布\ \ \ \ \ \ \ \ 
      正規分布\)\(\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 
    カイ２乗分布\ \ \ \ \ \ \ \ t分布\)

<< Statistics`Master`

\(p = 0.3; \ \ n = 10; 

    f[x_] := Binomial[n, x]\ p^x\ \ \((1 - p)\)^\((n - x)\); 

    ListPlot[Table[{x, f[x]}, {x, 0, n}], PlotJoined -> True]\)

\(m = 3; 
po[x_] := \(m\^x\/\(x!\)\) E\^\(-m\); 

    Plot[po[x], {x, 0, 10}]\)

Plot[PDF[NormalDistribution[0, 1], x], {x, -3, 3}]

Plot[CDF[NormalDistribution[0, 1], x], {x, -3, 3}]

Quantile[NormalDistribution[0, 1], 1 - 0.025]

\(n = 3; 
Plot[PDF[ChiSquareDistribution[n], x], {x, 0, 10}]\)

Quantile[ChiSquareDistribution[n], 1 - 0.05]

\(n = 30; 
Plot[PDF[StudentTDistribution[n], t], {t, \(-3.5\), 3.5}]\)

Quantile[StudentTDistribution[30], 1 - 0.05/2]