2008年11月4日火曜日

Power Law:(12)Graph,LN-LN in R

(2008/10/30)
Rで両対数グラフを出力する。
Both logarithm graph is output by R.
~~~
[1]例:Rの動作確認用
[1]Example:To confirm the operation of R
http://www.yukun.info/blog/2008/09/r-read-csv-file.html

読み込むCSVファイルは2007年度のセリーグの打撃成績の順位です。
The read CSV file is an order of the batting result of Central League in fiscal year 2007.

参考:2007年度 セントラル・リーグ 個人打撃成績(規定打席以上)
Reference: Central League individual batting result in fiscal year 2007(more than regulated at bat)

batting2007.csv
順位,打率,安打
Order, batting average, and safe hit
===
order,batting_avg,safe_hit
1,0.346,193
2,0.343,204
3,0.318,172
4,0.313,177
5,0.31,175
6,0.308,155
7,0.302,122
8,0.302,118
9,0.3,120
10,0.3,139
===

> data <- read.csv("batting2007.csv");
> data
order batting_avg safe_hit
1 1 0.346 193
2 2 0.343 204
3 3 0.318 172
4 4 0.313 177
5 5 0.310 175
6 6 0.308 155
7 7 0.302 122
8 8 0.302 118
9 9 0.300 120
10 10 0.300 139
>

ノーマル出力,Normal output

>plot(data$order, data$batting_avg)


両対数出力,Both logarithm output

>plot(data$order, data$batting_avg, log="xy")


y軸がlogになっていないような?
Isn't y axis log?
(2008/10/30)
データの幅が狭いと、対数にならない。
When the width of data is narrow, it doesn't become a logarithm.

~~~
[2]はじめから、LN計算してから、プロットする。
After LN is calculated from the start, it plots it.

常用対数,Common logarithm
>plot(log10(data$order), log10(data$batting_avg))


自然対数,Napierian logarithm
>plot(log(data$order), log(data$batting_avg))


これらもべき乗則になっています。
These are Power Laws.
~~~
end

0 件のコメント: