不毛を承知の上であえて挑戦してみました。
データ生成
z_axis<-rnorm(100,mean=0, sd=1)
x_axis<-rnorm(100,mean=0, sd=1)
y_axis<-rnorm(100,mean=0, sd=1)SND100 <- data.frame(X=x_axis, Y=y_axis,Z=z_axis)
library(xtable)
print(xtable(SND100), type = "html")
X | Y | Z | |
---|---|---|---|
1 | 0.38 | -0.55 | -0.33 |
2 | -0.32 | 0.17 | -0.77 |
3 | -1.02 | -1.64 | 0.29 |
4 | 1.24 | -0.64 | -0.01 |
5 | 2.11 | -0.87 | -0.41 |
6 | -1.04 | 0.76 | 0.14 |
7 | 0.29 | 0.60 | -2.31 |
8 | -0.68 | -1.35 | -0.18 |
9 | -1.90 | -0.14 | 0.76 |
10 | 0.71 | -0.45 | -2.19 |
11 | -0.28 | 0.46 | 0.15 |
12 | -1.34 | 0.43 | -0.11 |
13 | -0.14 | 1.25 | 1.74 |
14 | -0.18 | -1.43 | 0.22 |
15 | -0.67 | 0.89 | 0.30 |
16 | -0.10 | -0.34 | 0.67 |
17 | 0.41 | 0.46 | 0.20 |
18 | 0.15 | -0.39 | -0.61 |
19 | 0.41 | -1.20 | -1.22 |
20 | -1.54 | -1.23 | -0.84 |
21 | -0.07 | -1.22 | 0.54 |
22 | -0.31 | -0.12 | 0.47 |
23 | 0.41 | -0.42 | -1.10 |
24 | 2.20 | 0.80 | -1.07 |
25 | 0.39 | -0.01 | -0.73 |
26 | 2.10 | -0.58 | 1.21 |
27 | -3.26 | -0.64 | 2.82 |
28 | -0.49 | -0.21 | 1.75 |
29 | -0.73 | 0.13 | -0.88 |
30 | -1.23 | 0.54 | 1.14 |
31 | -0.00 | 0.20 | -0.76 |
32 | 0.31 | -1.20 | 1.42 |
33 | 0.38 | -0.22 | 0.93 |
34 | 1.50 | -2.22 | -0.41 |
35 | 0.81 | -0.14 | 1.15 |
36 | -0.52 | 1.26 | 1.51 |
37 | -0.83 | -0.33 | 0.96 |
38 | -0.70 | -0.36 | -0.06 |
39 | -0.48 | -0.36 | -0.55 |
40 | 0.11 | -0.16 | -0.40 |
41 | -0.26 | 0.51 | 1.93 |
42 | 0.57 | -0.29 | 0.71 |
43 | 0.14 | 0.54 | 0.93 |
44 | 0.65 | 0.19 | 0.29 |
45 | -0.11 | -1.50 | 2.60 |
46 | 1.61 | 1.98 | 0.32 |
47 | -0.30 | -0.98 | 0.03 |
48 | 1.18 | -1.08 | -1.64 |
49 | 0.67 | 0.72 | -1.22 |
50 | -0.52 | -0.72 | -0.33 |
51 | -0.06 | -0.61 | -0.74 |
52 | -0.23 | -1.46 | -1.21 |
53 | 1.48 | -0.68 | 0.48 |
54 | -0.23 | -0.81 | -0.21 |
55 | 0.78 | 0.44 | 0.51 |
56 | 0.35 | -0.82 | -0.36 |
57 | 0.39 | -1.16 | -1.07 |
58 | -0.65 | -0.08 | 0.54 |
59 | -0.29 | 0.68 | 1.07 |
60 | -1.51 | 1.46 | -0.94 |
61 | -0.16 | -1.02 | 1.48 |
62 | -1.00 | -0.37 | 0.71 |
63 | 1.56 | 0.81 | 1.63 |
64 | 1.12 | -0.49 | -0.19 |
65 | -0.60 | -0.30 | -1.47 |
66 | 0.94 | 1.58 | -0.07 |
67 | 0.52 | -1.35 | 1.15 |
68 | -0.11 | 0.80 | -2.16 |
69 | 0.94 | 0.19 | 0.24 |
70 | 0.41 | 0.23 | -0.52 |
71 | -0.67 | 0.19 | 0.23 |
72 | -1.57 | -1.20 | 0.50 |
73 | -1.33 | 1.17 | 1.29 |
74 | 1.73 | -3.03 | -1.80 |
75 | 1.50 | 1.60 | -0.07 |
76 | 0.10 | 0.68 | 0.70 |
77 | 0.10 | -0.94 | -0.36 |
78 | 1.08 | 0.44 | -0.09 |
79 | 1.13 | 0.48 | 0.15 |
80 | -0.81 | 1.51 | -0.64 |
81 | 0.87 | 0.61 | 0.99 |
82 | 0.18 | -0.54 | 0.81 |
83 | 0.03 | 0.91 | 0.27 |
84 | -0.75 | 1.18 | 1.66 |
85 | 0.96 | -0.62 | -0.28 |
86 | 0.08 | 0.60 | -1.03 |
87 | -1.05 | 0.29 | 0.86 |
88 | -0.95 | 0.28 | -1.19 |
89 | 0.14 | -1.48 | -1.05 |
90 | -0.52 | -1.17 | -0.22 |
91 | 0.10 | -2.33 | 3.50 |
92 | 0.24 | -0.12 | 1.07 |
93 | 0.47 | 0.54 | 1.15 |
94 | 0.18 | 1.52 | -1.04 |
95 | 0.85 | -1.97 | -1.71 |
96 | 0.98 | -0.50 | 0.25 |
97 | -2.26 | -0.75 | -0.66 |
98 | 1.88 | -1.59 | 1.63 |
99 | -0.67 | 0.42 | -0.79 |
100 | 0.79 | 1.75 | 0.09 |
2次元空間での作図例
X-Y座標
plot(SND100$X,SND100$Y,type="p",xlim=c(-4,4),ylim=c(-4,4),main="Standard Normal Distribution",xlab="X",ylab="Y")
X-Z座標
plot(SND100$X,SND100$Z,type="p",xlim=c(-4,4),ylim=c(-4,4),main="Standard Normal Distribution",xlab="X",ylab="Z")
Y-Z座標
plot(SND100$Y,SND100$Z,type="p",xlim=c(-4,4),ylim=c(-4,4),main="Standard Normal Distribution",xlab="Y",ylab="Z")
3次元空間での作図例
library(rgl)
plot3d(SND100$X,SND100$Y,SND100$Z,type="p",xlim=c(-4,4),ylim=c(-4,4),zlim=c(-4,4),main="Standard Normal Distribution",xlab="X",ylab="Y",zlab="Z")
movie3d(spin3d(axis=c(0,0,1),rpm=5),duration=10,fps=25,movie="~/Desktop/test01A")
この「中央にゴチャッと固まってる感じ」こそが正規分布の正規分布たる所以。
X軸のQQプロット検収
qqnorm(SND100$X)
qqline(SND100$X, lwd=2, col="red" )
Y軸のQQプロット検収
qqnorm(SND100$Y)
qqline(SND100$Y, lwd=2, col="red" )
Z軸のQQプロット検収
qqnorm(SND100$Z)
qqline(SND100$Z, lwd=2, col="red" )
統計データ諸元
01.基本的諸元…summary()関数等を使えばまとめて参照可能だが、xtable関数への内容引き渡しなどが上手くいかない。
- 最小値(Min)
- 第 1 四分位点(1st Quartile)
- 中央値(Median)
- 平均(Mean)
- 第 3 四分位点(3rd Quartile)
- 最大値(Max)
X | Y | Z | |
---|---|---|---|
X | Min. :-3.25519 | Min. :-3.0304 | Min. :-2.3080 |
X.1 | 1st Qu.:-0.54374 | 1st Qu.:-0.8120 | 1st Qu.:-0.6748 |
X.2 | Median : 0.09669 | Median :-0.1851 | Median : 0.1189 |
X.3 | Mean : 0.06226 | Mean :-0.1613 | Mean : 0.1013 |
X.4 | 3rd Qu.: 0.68266 | 3rd Qu.: 0.5401 | 3rd Qu.: 0.8210 |
X.5 | Max. : 2.19588 | Max. : 1.9791 | Max. : 3.5016 |
02.散布度基準①-範囲(Range)…最大値(Max)-最小値(Min)
SND100_Range <- data.frame(X=max(SND100$X)-min(SND100$X), Y=max(SND100$Y)-min(SND100$Y),Z=max(SND100$Z)-min(SND100$Z))
library(xtable)
print(xtable(SND100_Range), type = "html")
X | Y | Z | |
---|---|---|---|
1 | 5.45 | 5.01 | 5.81 |
03.最頻値(Mode)…大数の法則(LLN…Law of Large Numbers)の影響を色濃く受ける。
N=100の場合(揺らぎも激しい)
N=100000の場合(ほとんど揺らがない)
最頻値(x)
hx <- hist(SND100$X,breaks=10)
n <- length(hx$counts) # 階級の数
class_names <- NULL # 階級の名前格納用
for(i in 1:n) {
class_names[i] <- paste(hx$breaks[i], "~", hx$breaks[i+1])
}
hx_table <- data.frame(class=class_names, frequency=hx$counts)library(xtable)
print(xtable(hx_table), type = "html")
class | frequency | |
---|---|---|
1 | -3.5 ~ -3 | 1 |
2 | -3 ~ -2.5 | 0 |
3 | -2.5 ~ -2 | 1 |
4 | -2 ~ -1.5 | 4 |
5 | -1.5 ~ -1 | 7 |
6 | -1 ~ -0.5 | 15 |
7 | -0.5 ~ 0 | 19 |
8 | 0 ~ 0.5 | 24 |
9 | 0.5 ~ 1 | 14 |
10 | 1 ~ 1.5 | 7 |
11 | 1.5 ~ 2 | 5 |
12 | 2 ~ 2.5 | 3 |
最頻値(y)
hy <- hist(SND100$Y,breaks=10)
n <- length(hy$counts) # 階級の数
class_names <- NULL # 階級の名前格納用
for(i in 1:n) {
class_names[i] <- paste(hy$breaks[i], "~", hy$breaks[i+1])
}
hy_table <- data.frame(class=class_names, frequency=hy$counts)library(xtable)
print(xtable(hy_table), type = "html")
class | frequency | |
---|---|---|
1 | -3.5 ~ -3 | 1 |
2 | -3 ~ -2.5 | 0 |
3 | -2.5 ~ -2 | 2 |
4 | -2 ~ -1.5 | 3 |
5 | -1.5 ~ -1 | 15 |
6 | -1 ~ -0.5 | 15 |
7 | -0.5 ~ 0 | 21 |
8 | 0 ~ 0.5 | 16 |
9 | 0.5 ~ 1 | 16 |
10 | 1 ~ 1.5 | 5 |
11 | 1.5 ~ 2 | 6 |
最頻値(z)
hz <- hist(SND100$Z,breaks=10)
n <- length(hz$counts) # 階級の数
class_names <- NULL # 階級の名前格納用
for(i in 1:n) {
class_names[i] <- paste(hz$breaks[i], "~", hz$breaks[i+1])
}
hz_table <- data.frame(class=class_names, frequency=hz$counts)library(xtable)
print(xtable(hz_table), type = "html")
class | frequency | |
---|---|---|
1 | -2.5 ~ -2 | 3 |
2 | -2 ~ -1.5 | 3 |
3 | -1.5 ~ -1 | 11 |
4 | -1 ~ -0.5 | 13 |
5 | -0.5 ~ 0 | 18 |
6 | 0 ~ 0.5 | 17 |
7 | 0.5 ~ 1 | 15 |
8 | 1 ~ 1.5 | 10 |
9 | 1.5 ~ 2 | 7 |
10 | 2 ~ 2.5 | 0 |
11 | 2.5 ~ 3 | 2 |
12 | 3 ~ 3.5 | 0 |
13 | 3.5 ~ 4 | 1 |
頻度ポリゴンを描く関数 hist2d() (パッケージ:gplots)
X軸-Y軸
library(gplots)
SND_hist2d<-function(x){
# 遠近法プロット (persp) のためのデータをhist2d() を使用して作成
h2d <- hist2d(SND100$X, SND100$Y, show=FALSE, same.scale=TRUE, nbins=c(20,30))
# 遠近法プロット (persp) 描画
persp( h2d$x, h2d$y, h2d$counts,
ticktype="detailed", theta=x, phi=30,
expand=0.5, shade=0.5, col="cyan", ltheta=-30,main="SND with hist2d()",xlab="x",ylab="y",zlab="counts")}
#アニメーション
library("animation")
Time_Code=seq(0,350,length=36)
saveGIF({
for (i in Time_Code){
SND_hist2d(i)
}
}, interval = 0.1, movie.name = "SND_hist2d.gif")
X軸-Z軸
library(gplots)
SND_hist2d<-function(x){
# 遠近法プロット (persp) のためのデータをhist2d() を使用して作成
h2d <- hist2d(SND100$X, SND100$Z, show=FALSE, same.scale=TRUE, nbins=c(20,30))
# 遠近法プロット (persp) 描画
persp( h2d$x, h2d$y, h2d$counts,
ticktype="detailed", theta=x, phi=30,
expand=0.5, shade=0.5, col="cyan", ltheta=-30,main="SND with hist2d()",xlab="x",ylab="z",zlab="counts")}
#アニメーション
library("animation")
Time_Code=seq(0,350,length=36)
saveGIF({
for (i in Time_Code){
SND_hist2d(i)
}
}, interval = 0.1, movie.name = "SND_hist2d.gif")
Y軸-Z軸
library(gplots)
SND_hist2d<-function(x){
# 遠近法プロット (persp) のためのデータをhist2d() を使用して作成
h2d <- hist2d(SND100$Y, SND100$Z, show=FALSE, same.scale=TRUE, nbins=c(20,30))
# 遠近法プロット (persp) 描画
persp( h2d$x, h2d$y, h2d$counts,
ticktype="detailed", theta=x, phi=30,
expand=0.5, shade=0.5, col="cyan", ltheta=-30,main="SND with hist2d()",xlab="y",ylab="z",zlab="counts")}
#アニメーション
library("animation")
Time_Code=seq(0,350,length=36)
saveGIF({
for (i in Time_Code){
SND_hist2d(i)
}
}, interval = 0.1, movie.name = "SND_hist2d.gif")
カーネル密度推定を行う関数 bkde2D() (パッケージ:KernSmooth)
カーネル密度推定(kernel density estimation) - Wikipedia
*これはあまり役に立たなそう。
library(MASS)# 関数 width.SJ() を使うので KernSmooth を呼び出し
library(KernSmooth) # 関数 bkde2D() を使うので KernSmooth を呼び出しSND_bkde2D<-function(x){
# 遠近法プロット (persp) のためのデータをhist2d() を使用して作成
f1 <- bkde2D(cbind(SND100$X, SND100$Y), bandwidth=c(width.SJ(SND100$X, method = "dpi"), width.SJ(SND100$Y, method = "dpi")))
# 遠近法プロット (persp) 描画
persp(f1$fhat, phi = 30, theta = x, d = 5)}
#アニメーション
library("animation")
Time_Code=seq(0,350,length=36)
saveGIF({
for (i in Time_Code){
SND_bkde2D(i)
}
}, interval = 0.1, movie.name = "SND_bkde2D.gif")
04.偏差(Deviation)…データの各数値より、その平均を引いた残り。標本分散(Sample Dispersion)/不偏分散(Unbiased Dispersion)、標準偏差(Standard Deviation)/平均偏差(Mean Deviation)、Z得点(Z Value)/偏差値(Deviation Value)算出に使われる。
SND100_deviation<-data.frame(X=SND100$X-mean(SND100$X), Y=SND100$Y-mean(SND100$Y),Z=SND100$Z-mean(SND100$Z))
library(xtable)
print(xtable(SND100_deviation), type = "html")
X | Y | Z | |
---|---|---|---|
1 | 0.32 | -0.39 | -0.43 |
2 | -0.38 | 0.33 | -0.87 |
3 | -1.08 | -1.48 | 0.18 |
4 | 1.18 | -0.47 | -0.11 |
5 | 2.05 | -0.70 | -0.51 |
6 | -1.10 | 0.92 | 0.04 |
7 | 0.22 | 0.76 | -2.41 |
8 | -0.74 | -1.19 | -0.28 |
9 | -1.96 | 0.02 | 0.65 |
10 | 0.65 | -0.29 | -2.29 |
11 | -0.34 | 0.63 | 0.05 |
12 | -1.40 | 0.59 | -0.21 |
13 | -0.20 | 1.41 | 1.64 |
14 | -0.24 | -1.27 | 0.12 |
15 | -0.73 | 1.05 | 0.20 |
16 | -0.17 | -0.18 | 0.57 |
17 | 0.34 | 0.62 | 0.10 |
18 | 0.09 | -0.23 | -0.71 |
19 | 0.35 | -1.04 | -1.32 |
20 | -1.61 | -1.07 | -0.94 |
21 | -0.13 | -1.06 | 0.44 |
22 | -0.37 | 0.04 | 0.37 |
23 | 0.35 | -0.26 | -1.20 |
24 | 2.13 | 0.96 | -1.17 |
25 | 0.33 | 0.15 | -0.83 |
26 | 2.04 | -0.42 | 1.11 |
27 | -3.32 | -0.48 | 2.72 |
28 | -0.55 | -0.04 | 1.64 |
29 | -0.79 | 0.30 | -0.98 |
30 | -1.29 | 0.70 | 1.04 |
31 | -0.06 | 0.36 | -0.87 |
32 | 0.25 | -1.03 | 1.32 |
33 | 0.32 | -0.06 | 0.83 |
34 | 1.44 | -2.06 | -0.51 |
35 | 0.75 | 0.02 | 1.05 |
36 | -0.58 | 1.42 | 1.41 |
37 | -0.89 | -0.17 | 0.85 |
38 | -0.76 | -0.20 | -0.16 |
39 | -0.54 | -0.20 | -0.65 |
40 | 0.05 | -0.00 | -0.50 |
41 | -0.33 | 0.67 | 1.83 |
42 | 0.51 | -0.13 | 0.61 |
43 | 0.08 | 0.71 | 0.83 |
44 | 0.59 | 0.35 | 0.19 |
45 | -0.17 | -1.34 | 2.49 |
46 | 1.55 | 2.14 | 0.22 |
47 | -0.36 | -0.82 | -0.07 |
48 | 1.12 | -0.92 | -1.74 |
49 | 0.61 | 0.88 | -1.33 |
50 | -0.59 | -0.56 | -0.43 |
51 | -0.13 | -0.45 | -0.84 |
52 | -0.30 | -1.30 | -1.31 |
53 | 1.42 | -0.52 | 0.38 |
54 | -0.29 | -0.65 | -0.32 |
55 | 0.72 | 0.60 | 0.41 |
56 | 0.29 | -0.66 | -0.46 |
57 | 0.33 | -1.00 | -1.17 |
58 | -0.71 | 0.08 | 0.44 |
59 | -0.35 | 0.84 | 0.97 |
60 | -1.58 | 1.62 | -1.04 |
61 | -0.22 | -0.86 | 1.37 |
62 | -1.06 | -0.21 | 0.60 |
63 | 1.49 | 0.97 | 1.53 |
64 | 1.06 | -0.33 | -0.29 |
65 | -0.66 | -0.13 | -1.57 |
66 | 0.88 | 1.74 | -0.17 |
67 | 0.46 | -1.18 | 1.05 |
68 | -0.18 | 0.96 | -2.26 |
69 | 0.88 | 0.35 | 0.14 |
70 | 0.34 | 0.39 | -0.62 |
71 | -0.74 | 0.36 | 0.13 |
72 | -1.63 | -1.04 | 0.40 |
73 | -1.39 | 1.33 | 1.19 |
74 | 1.67 | -2.87 | -1.90 |
75 | 1.44 | 1.76 | -0.17 |
76 | 0.03 | 0.84 | 0.60 |
77 | 0.04 | -0.77 | -0.46 |
78 | 1.02 | 0.60 | -0.19 |
79 | 1.07 | 0.64 | 0.05 |
80 | -0.88 | 1.67 | -0.74 |
81 | 0.81 | 0.77 | 0.89 |
82 | 0.12 | -0.38 | 0.71 |
83 | -0.03 | 1.08 | 0.17 |
84 | -0.81 | 1.34 | 1.56 |
85 | 0.89 | -0.46 | -0.38 |
86 | 0.02 | 0.76 | -1.13 |
87 | -1.11 | 0.45 | 0.76 |
88 | -1.01 | 0.44 | -1.29 |
89 | 0.08 | -1.32 | -1.15 |
90 | -0.59 | -1.01 | -0.32 |
91 | 0.03 | -2.17 | 3.40 |
92 | 0.18 | 0.04 | 0.97 |
93 | 0.41 | 0.70 | 1.05 |
94 | 0.12 | 1.68 | -1.14 |
95 | 0.78 | -1.81 | -1.81 |
96 | 0.92 | -0.34 | 0.15 |
97 | -2.32 | -0.59 | -0.76 |
98 | 1.82 | -1.43 | 1.52 |
99 | -0.73 | 0.58 | -0.89 |
100 | 0.73 | 1.91 | -0.01 |
05.散布度基準②その1-不偏分散(Unbiased Dispersion)…偏差^2の合計/(偏差数-1)
*このケースは標本抽出なのでこれでOK。「二乗する」というアイディアは自体は最小二乗法に由来し、平均値が代表値となる。
SND100_dispersion<-data.frame(X=sum(SND100_deviation$X^2)/(length(SND100_deviation$X)-1),Y=sum(SND100_deviation$Y^2)/(length(SND100_deviation$Y)-1),Z=sum(SND100_deviation$Z^2)/(length(SND100_deviation$Z)-1))
library(xtable)
print(xtable(round(SND100_dispersion, digits = 6)), type = "html")
X | Y | Z | |
---|---|---|---|
1 | 0.94 | 0.96 | 1.19 |
06.散布度基準③標準偏差(Standard Dispersion)/平均偏差(Mean Deviation)
◎標準偏差(Standard Dispersion)…分散の平方根
SND100_standard_dispersion<-sqrt(SND100_dispersion)
library(xtable)
print(xtable(round(SND100_standard_dispersion, digits = 6)), type = "html")
X | Y | Z | |
---|---|---|---|
1 | 0.97 | 0.98 | 1.09 |
◎平均偏差(Mean Deviation)…偏差の絶対値の平均
*知名度は今ひとつ。データの中央値が代表値となる。
SND100_Mean_Deviation<-data.frame(X=sum(abs(SND100_deviation$X))/(length(SND100_deviation$X)-1),Y=sum(abs(SND100_deviation$Y))/(length(SND100_deviation$Y)-1),Z=sum(abs(SND100_deviation$Z))/(length(SND100_deviation$Z)-1))
library(xtable)
print(xtable(round(SND100_Mean_Deviation, digits = 6)), type = "html")
X | Y | Z | |
---|---|---|---|
1 | 0.76 | 0.80 | 0.87 |
SND100_zvalue<-data.frame(X=SND100_deviation$X/SND100_standard_dispersion$X,Y=SND100_deviation$Y/SND100_standard_dispersion$Y,Z=SND100_deviation$Z/SND100_standard_dispersion$Z)
library(xtable)
print(xtable(round(SND100_zvalue, digits = 6)), type = "html")
X | Y | Z | |
---|---|---|---|
1 | 0.33 | -0.40 | -0.40 |
2 | -0.39 | 0.34 | -0.80 |
3 | -1.11 | -1.51 | 0.17 |
4 | 1.21 | -0.49 | -0.10 |
5 | 2.11 | -0.72 | -0.47 |
6 | -1.13 | 0.94 | 0.04 |
7 | 0.23 | 0.77 | -2.21 |
8 | -0.76 | -1.22 | -0.26 |
9 | -2.02 | 0.03 | 0.60 |
10 | 0.67 | -0.30 | -2.10 |
11 | -0.35 | 0.64 | 0.04 |
12 | -1.45 | 0.61 | -0.19 |
13 | -0.21 | 1.44 | 1.50 |
14 | -0.25 | -1.30 | 0.11 |
15 | -0.75 | 1.07 | 0.18 |
16 | -0.17 | -0.18 | 0.52 |
17 | 0.35 | 0.63 | 0.09 |
18 | 0.09 | -0.24 | -0.65 |
19 | 0.36 | -1.06 | -1.21 |
20 | -1.65 | -1.09 | -0.87 |
21 | -0.14 | -1.08 | 0.41 |
22 | -0.38 | 0.04 | 0.34 |
23 | 0.36 | -0.26 | -1.10 |
24 | 2.20 | 0.98 | -1.08 |
25 | 0.34 | 0.16 | -0.76 |
26 | 2.10 | -0.43 | 1.01 |
27 | -3.42 | -0.49 | 2.50 |
28 | -0.57 | -0.05 | 1.51 |
29 | -0.81 | 0.30 | -0.90 |
30 | -1.33 | 0.72 | 0.96 |
31 | -0.07 | 0.37 | -0.79 |
32 | 0.26 | -1.06 | 1.21 |
33 | 0.33 | -0.06 | 0.76 |
34 | 1.48 | -2.10 | -0.47 |
35 | 0.77 | 0.02 | 0.97 |
36 | -0.60 | 1.45 | 1.29 |
37 | -0.92 | -0.17 | 0.78 |
38 | -0.78 | -0.20 | -0.15 |
39 | -0.55 | -0.21 | -0.60 |
40 | 0.05 | -0.00 | -0.46 |
41 | -0.34 | 0.68 | 1.68 |
42 | 0.53 | -0.13 | 0.56 |
43 | 0.08 | 0.72 | 0.76 |
44 | 0.61 | 0.36 | 0.18 |
45 | -0.18 | -1.37 | 2.29 |
46 | 1.59 | 2.19 | 0.21 |
47 | -0.37 | -0.84 | -0.06 |
48 | 1.15 | -0.94 | -1.59 |
49 | 0.63 | 0.90 | -1.22 |
50 | -0.60 | -0.57 | -0.40 |
51 | -0.13 | -0.46 | -0.77 |
52 | -0.31 | -1.33 | -1.20 |
53 | 1.46 | -0.53 | 0.35 |
54 | -0.30 | -0.66 | -0.29 |
55 | 0.74 | 0.61 | 0.37 |
56 | 0.30 | -0.67 | -0.43 |
57 | 0.34 | -1.02 | -1.08 |
58 | -0.73 | 0.08 | 0.40 |
59 | -0.36 | 0.86 | 0.89 |
60 | -1.62 | 1.66 | -0.96 |
61 | -0.22 | -0.88 | 1.26 |
62 | -1.09 | -0.21 | 0.55 |
63 | 1.54 | 0.99 | 1.41 |
64 | 1.09 | -0.34 | -0.27 |
65 | -0.68 | -0.14 | -1.44 |
66 | 0.90 | 1.78 | -0.16 |
67 | 0.47 | -1.21 | 0.96 |
68 | -0.18 | 0.98 | -2.07 |
69 | 0.91 | 0.36 | 0.13 |
70 | 0.35 | 0.40 | -0.57 |
71 | -0.76 | 0.36 | 0.12 |
72 | -1.68 | -1.06 | 0.37 |
73 | -1.43 | 1.36 | 1.09 |
74 | 1.72 | -2.93 | -1.75 |
75 | 1.48 | 1.80 | -0.16 |
76 | 0.04 | 0.86 | 0.55 |
77 | 0.04 | -0.79 | -0.42 |
78 | 1.05 | 0.61 | -0.18 |
79 | 1.10 | 0.65 | 0.04 |
80 | -0.90 | 1.70 | -0.68 |
81 | 0.83 | 0.79 | 0.82 |
82 | 0.12 | -0.39 | 0.65 |
83 | -0.03 | 1.10 | 0.15 |
84 | -0.83 | 1.37 | 1.43 |
85 | 0.92 | -0.47 | -0.35 |
86 | 0.02 | 0.77 | -1.04 |
87 | -1.14 | 0.46 | 0.70 |
88 | -1.04 | 0.45 | -1.19 |
89 | 0.08 | -1.34 | -1.06 |
90 | -0.60 | -1.03 | -0.29 |
91 | 0.03 | -2.22 | 3.12 |
92 | 0.18 | 0.05 | 0.89 |
93 | 0.42 | 0.72 | 0.97 |
94 | 0.13 | 1.72 | -1.05 |
95 | 0.81 | -1.85 | -1.66 |
96 | 0.95 | -0.34 | 0.14 |
97 | -2.39 | -0.60 | -0.70 |
98 | 1.88 | -1.46 | 1.40 |
99 | -0.75 | 0.60 | -0.82 |
100 | 0.75 | 1.96 | -0.01 |
分布はそのまま。
*とりあえずX軸-Y軸
library(gplots)
SND_zvalue_hist2d<-function(x){
# 遠近法プロット (persp) のためのデータをhist2d() を使用して作成
h2d <- hist2d(SND100_zvalue$X,SND100_zvalue$Y, show=FALSE, same.scale=TRUE, nbins=c(20,30))
# 遠近法プロット (persp) 描画
persp( h2d$x, h2d$y, h2d$counts,
ticktype="detailed", theta=x, phi=30,
expand=0.5, shade=0.5, col="cyan", ltheta=-30,main="SND with hist2d()",xlab="x",ylab="y",zlab="counts")}
#アニメーション
library("animation")
Time_Code=seq(0,350,length=36)
saveGIF({
for (i in Time_Code){
SND_zvalue_hist2d(i)
}
}, interval = 0.1, movie.name = "SND_hist2d.gif")
08.偏差値(Deviation Value)…Z得点*10+50
SND100_Deviation_value=SND100_zvalue*10+50
library(xtable)
print(xtable(round(SND100_Deviation_value, digits = 6)), type = "html")
X | Y | Z | |
---|---|---|---|
1 | 53.32 | 46.05 | 46.04 |
2 | 46.09 | 53.39 | 42.00 |
3 | 38.88 | 34.89 | 51.70 |
4 | 62.12 | 45.15 | 48.98 |
5 | 71.09 | 42.81 | 45.31 |
6 | 38.70 | 59.38 | 50.39 |
7 | 52.31 | 57.74 | 27.89 |
8 | 42.37 | 37.84 | 47.41 |
9 | 29.79 | 50.25 | 56.01 |
10 | 56.70 | 47.02 | 28.97 |
11 | 46.46 | 56.39 | 50.43 |
12 | 35.54 | 56.06 | 48.11 |
13 | 47.91 | 64.40 | 65.01 |
14 | 47.48 | 37.00 | 51.08 |
15 | 42.48 | 60.70 | 51.79 |
16 | 48.29 | 48.19 | 55.19 |
17 | 53.54 | 56.33 | 50.92 |
18 | 50.91 | 47.64 | 43.48 |
19 | 53.58 | 39.41 | 37.87 |
20 | 33.47 | 39.08 | 41.34 |
21 | 48.65 | 39.17 | 54.07 |
22 | 46.17 | 50.41 | 53.39 |
23 | 53.56 | 47.37 | 39.00 |
24 | 71.97 | 59.81 | 39.23 |
25 | 53.39 | 51.55 | 42.39 |
26 | 70.99 | 45.69 | 60.14 |
27 | 15.84 | 45.13 | 74.99 |
28 | 44.35 | 49.55 | 65.09 |
29 | 41.88 | 53.03 | 40.97 |
30 | 36.73 | 57.16 | 59.57 |
31 | 49.35 | 53.71 | 42.06 |
32 | 52.55 | 39.43 | 62.10 |
33 | 53.31 | 49.39 | 57.64 |
34 | 64.78 | 28.95 | 45.29 |
35 | 57.73 | 50.20 | 59.67 |
36 | 44.02 | 64.55 | 62.92 |
37 | 40.83 | 48.31 | 57.85 |
38 | 42.15 | 48.00 | 48.49 |
39 | 44.47 | 47.93 | 44.00 |
40 | 50.54 | 49.96 | 45.38 |
41 | 46.65 | 56.82 | 66.78 |
42 | 55.25 | 48.67 | 55.59 |
43 | 50.82 | 57.22 | 57.58 |
44 | 56.07 | 53.59 | 51.77 |
45 | 48.22 | 36.32 | 72.90 |
46 | 65.91 | 71.88 | 52.05 |
47 | 46.30 | 41.63 | 49.37 |
48 | 61.54 | 40.58 | 34.06 |
49 | 56.29 | 59.02 | 37.84 |
50 | 43.96 | 44.28 | 46.02 |
51 | 48.70 | 45.39 | 42.30 |
52 | 46.94 | 36.71 | 38.00 |
53 | 64.59 | 44.70 | 53.46 |
54 | 47.04 | 43.38 | 47.10 |
55 | 57.44 | 56.10 | 53.73 |
56 | 52.98 | 43.26 | 45.75 |
57 | 53.36 | 39.77 | 39.22 |
58 | 42.68 | 50.80 | 54.04 |
59 | 46.40 | 58.59 | 58.93 |
60 | 33.77 | 66.61 | 40.44 |
61 | 47.76 | 41.24 | 62.62 |
62 | 39.05 | 47.87 | 55.55 |
63 | 65.38 | 59.89 | 64.05 |
64 | 60.91 | 46.60 | 47.30 |
65 | 43.17 | 48.63 | 35.60 |
66 | 59.02 | 67.76 | 48.41 |
67 | 54.72 | 37.89 | 59.63 |
68 | 48.19 | 59.84 | 29.26 |
69 | 59.05 | 53.61 | 51.25 |
70 | 53.55 | 54.01 | 44.30 |
71 | 42.42 | 53.64 | 51.18 |
72 | 33.20 | 39.40 | 53.69 |
73 | 35.70 | 63.56 | 60.88 |
74 | 67.20 | 20.67 | 32.52 |
75 | 64.81 | 67.98 | 48.43 |
76 | 50.36 | 58.64 | 55.53 |
77 | 50.42 | 42.08 | 45.78 |
78 | 60.48 | 56.11 | 48.24 |
79 | 61.01 | 56.52 | 50.43 |
80 | 40.98 | 67.05 | 43.18 |
81 | 58.35 | 57.88 | 58.18 |
82 | 51.22 | 46.11 | 56.47 |
83 | 49.68 | 60.99 | 51.54 |
84 | 41.65 | 63.71 | 64.31 |
85 | 59.21 | 45.29 | 46.47 |
86 | 50.22 | 57.73 | 39.63 |
87 | 38.59 | 54.64 | 57.00 |
88 | 39.56 | 54.55 | 38.12 |
89 | 50.84 | 36.56 | 39.42 |
90 | 43.97 | 39.72 | 47.08 |
91 | 50.35 | 27.83 | 81.21 |
92 | 51.85 | 50.46 | 58.90 |
93 | 54.18 | 57.20 | 59.65 |
94 | 51.26 | 67.18 | 39.51 |
95 | 58.07 | 31.49 | 33.42 |
96 | 59.49 | 46.55 | 51.39 |
97 | 26.12 | 43.98 | 43.04 |
98 | 68.76 | 35.36 | 63.99 |
99 | 42.49 | 55.95 | 41.81 |
100 | 57.52 | 69.56 | 49.93 |
やはり分布はそのまま。
*とりあえずX軸-Y軸
library(gplots)
SND_zvalue_hist2d<-function(x){
# 遠近法プロット (persp) のためのデータをhist2d() を使用して作成
h2d <- hist2d(SND100_Deviation_value$X,SND100_Deviation_value$Y, show=FALSE, same.scale=TRUE, nbins=c(20,30))
# 遠近法プロット (persp) 描画
persp( h2d$x, h2d$y, h2d$counts,
ticktype="detailed", theta=x, phi=30,
expand=0.5, shade=0.5, col="cyan", ltheta=-30,main="SND with hist2d()",xlab="x",ylab="y",zlab="counts")}
#アニメーション
library("animation")
Time_Code=seq(0,350,length=36)
saveGIF({
for (i in Time_Code){
SND_zvalue_hist2d(i)
}
}, interval = 0.1, movie.name = "SND_hist2d.gif")
簡単にいっちゃえば
— スワン (@SWSRfs) January 19, 2019
データに足されても偏差・分散・標準偏差は何も変わらない
データがA倍されたら、
偏差→A倍
分散→A²倍
標準偏差→|A|倍
です。
あとはこれ使って相関係数も出せるよ。
覚えれば瞬殺できるから覚えようぜ、データの分析なんかで点数落としたくない
この形式で中心極限定理(CLT=Central Limit Theorem)を視覚的により明瞭に捉えるには、もっと母数を大きくする必要があるんですね。
標準正規分布のデータ生成(N=100000)
x_axis<-rnorm(100000,mean=0, sd=1)
y_axis<-rnorm(100000,mean=0, sd=1)SND100000 <- data.frame(X=x_axis, Y=y_axis)
標準正規分布(N=100000)の描画
library(gplots)
SND100000_hist2d<-function(x){
# 遠近法プロット (persp) のためのデータをhist2d() を使用して作成
h2d <- hist2d(SND100000$X,SND100000$Y, show=FALSE, same.scale=TRUE, nbins=c(20,30))
# 遠近法プロット (persp) 描画
persp( h2d$x, h2d$y, h2d$counts,
ticktype="detailed", theta=x, phi=30,
expand=0.5, shade=0.5, col="cyan", ltheta=-30,main="SND with hist2d()",xlab="x",ylab="y",zlab="counts")}
#アニメーション
library("animation")
Time_Code=seq(0,350,length=36)
saveGIF({
for (i in Time_Code){
SND100000_hist2d(i)
}
}, interval = 0.1, movie.name = "SND100000_hist2d.gif")