LoginSignup
1
2

More than 5 years have passed since last update.

回帰分析手順

Last updated at Posted at 2018-04-22

回帰分析手順

以下の仮説が成り立つと仮定して分析を行う

「説明変数$ x $のときの目的変数$ y $」は、
平均が$ Ax+B $で標準偏差が$ \sigma $の正規分布に従う

$ Ax+B $:母回帰

単回帰式

 y = ax + b 

グラフ化

$ x $と$ y $をグラフ化する

回帰式を求める

$ y = ax + b $の $ a $と$ b $を求める
例)最小二乗法

最小二乗法

残差平方和$ \sum(y-\hat{y})^2 $が最小になる$ a $と$ b $を求める
$ y $は実測値、$ \hat{y} $は予測値

\begin{align}
a &= \frac{S_{xy}}{S_{xx}}\\
b &= \bar{y}-\bar{x}a
\end{align}

$ S_{xx} $は$ x $ の偏差平方和
$ S_{xy} $は$ x $と$ y $の偏差積和
$ \bar{y} $、$ \bar{x} $はそれぞれ$ y $と$ x $の平均値

\begin{align}
S_{xx} &= \sum^n_{i=1}(x_i-\bar{x})^2\\
S_{xy} &= \sum^n_{i=1}(x_i-\bar{x})(y_i-\bar{y})
\end{align}

回帰式の精度確認

重相関係数

R = \frac{S_{y\hat{y}}}{\sqrt{S_{yy} \times S_{\hat{y}\hat{y}}}}

$ S_{y\hat{y}} $は$ y $と$ \hat{y} $ の偏差積和
$ S_{yy} $は$ y $の偏差平方和

\begin{align}
S_{y\hat{y}} &= \sum^n_{i=1}(y_i-\bar{y})(\hat{y_i}-\bar{\hat{y}})\\
S_{yy} &= \sum^n_{i=1}(y_i-\bar{y})^2\\
S_{\hat{y}\hat{y}} &= \sum^n_{i=1}(\hat{y_i}-\bar{\hat{y}})^2
\end{align}

決定係数

重相関係数の二乗($ R^2 $)
寄与率ともいわれる
0から1までの値をとり、1に近づくほど精度が高い

以下の式も成り立つ

R^2 = 1 - \frac{S_e}{S_{yy}}

回帰係数の検定

母回帰を推定

予測

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2