1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

偏差値をPythonを使って求める方法

Posted at

今回は偏差値について紹介していきたいと思います!

内容はこちらの本を参考にしています!


偏差値ってなに?

ある集団の中での自分の学力を示すものです。

偏差値50が平均で平均からのどの程度の差があるかがわかります。

なので、同じ点数でも頭が悪い集団だと、自分の偏差値は上がり、頭が良い集団だと偏差値は下がります。

求め方

ここからは5人の人がテストを受けた時の偏差値を求めていきます。
image.png

1 全体の平均を求める

(40+50+60+70+80)÷5=60

2 偏差と偏差の2乗を求める

偏差とはその人の点数と平均点の差です。

偏差 偏差の2乗
赤 60-40=20 20×20=400
オレンジ 60-50=10 10×10=100
黄色 60-60=0 0×0=0
緑 70-60=10 10×10=100
青 80-60=20 20×20=400

3 分散を求める

分散とは偏差の2乗の平均です。

(400+100+0+100+400)÷5=200

4 分散の平方根を計算し、標準偏差を求める

標準偏差というのは分散の平方根です。

200の平方根=14.1421...

標準偏差は14.14と決まります。

5 偏差値を求める

やっと来ました。

偏差値の公式はこうなります。
image.png

式にすると ((点数-平均点)÷標準偏差)×10+50です。

計算を略しますが5人の偏差値は

赤 35.9
オレンジ 42.9
黄色 50
緑 57.1
青 64.1

です。

Pythonで求めたい!

Pythonで書てみました。

ぜひ使ってみてください。

import math
def calculate_deviation_value(data):
 mean = sum(data) / len(data)
 variance = sum((x - mean) ** 2 for x in data) / len(data)
 std_dev = math.sqrt(variance)
 
 deviation_values = [(x - mean) / std_dev * 10 + 50 for x in data]
 return deviation_values

まとめ

偏差値の求め方について紹介しました。
この記事を元に実際に偏差値を計算してみましょう。

1
1
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
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?