量的表現 quantitation

22
量量量量 Quantitation

Upload: elysia

Post on 14-Jan-2016

43 views

Category:

Documents


0 download

DESCRIPTION

量的表現 Quantitation. 分布 Distribution. 1峰性分布. 2峰性分布. 2次元分布. 有限範囲の2次元分布. 1 次元分布 1-dimensional dist. 1 峰性分布 Unimodal dist. 平均・分散 Mean/Variance モーメント Moments モーメントの計算 How to calculate moments 値、値の増加率、増加率の増加率 Value, Increasing rate, Increasing rate of increasing rate - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: 量的表現  Quantitation

量的表現 Quantitation

Page 2: 量的表現  Quantitation

分布 Distribution

• 1峰性分布

Page 3: 量的表現  Quantitation

• 2峰性分布

Page 4: 量的表現  Quantitation

2次元分布

Page 5: 量的表現  Quantitation

有限範囲の2次元分布

Page 6: 量的表現  Quantitation

1 次元分布 1-dimensional dist.1 峰性分布 Unimodal dist.

• 平均・分散 Mean/Variance– モーメント Moments

• モーメントの計算– How to calculate moments

• 値、値の増加率、増加率の増加率– Value, Increasing rate, Increasing rate of increasing

rate– 微分・積分 Diffenrential/Integration– 確率分布・累積確率分布 Probability

distribution/Cumulative probability distribution

R2-1.R

Page 7: 量的表現  Quantitation

1 峰性分布を作るMake unimodal distribution

• N<-100• x<-rnorm(N)• hist(x)• plot(sort(x))

• x<-rnorm(N,mean=1,sd=1)• hist(x)• plot(sort(x))

Page 8: 量的表現  Quantitation

1 次元 2 峰性分布Two-dimensional di-modal dist.

• N1<-100;N2<-50• m1<-0;m2<-10;sd1<-1;sd2<-2• x1<-rnorm(N1,mean=m1,sd=sd1)• x2<-rnorm(N2,mean=m2,sd=sd2)• x<-c(x1,x2)• hist(x)• plot(sort(x))

Page 9: 量的表現  Quantitation

2 次元 1 峰性分布Two-dimensional unimodal dist.

• N<-1000• x1<-rnorm(N)• x2<-rnorm(N)• plot(x1,x2)

Page 10: 量的表現  Quantitation

2 次元 1 峰性分布Two-dimensional unimodal dist.

• 軸ごとに平均をかえてみる Change mean of x1 and x2

• 軸ごとに分散をかえてみる Change var/sd of x1 and x2

• N<-1000• x1<-rnorm(N,mean=0,sd=1)• x2<-rnorm(N,mean=10,sd=4)• xlim<-ylim<-c(min(x1,x2),max(x1,x2))• plot(x1,x2,xlim=xlim,ylim=ylim)

Page 11: 量的表現  Quantitation

多次元 1 峰性分布Poly-dimensional unimodal dist.

• N<-500• m1<-0;m2<-10;m3<-30;• sd1<-1;sd2<-4;sd3<-10• x1<-rnorm(N,mean=m1,sd=sd1)• x2<-rnorm(N,mean=m2,sd=sd2)• x3<-rnorm(N,mean=m3,sd=sd3)• plot(as.data.frame(cbind(x1,x2,x3)))• library(rgl)• plot3d(x1,x2,x3)• 軸の値に注意 Note values on axes displayed

Page 12: 量的表現  Quantitation

多次元多峰性分布Poly-dimensional polymodal dist.

• N<-1000• m1<-0;m2<-10;m3<-30;• sd1<-1;sd2<-4;sd3<-10• x1<-rnorm(N,mean=m1,sd=sd1)• x2<-rnorm(N,mean=m2,sd=sd2)• x3<-rnorm(N,mean=m3,sd=sd3)

• N<-2000• m1<-20;m2<-20;m3<-20;• sd1<-1;sd2<-1;sd3<-1• y1<-rnorm(N,mean=m1,sd=sd1)• y2<-rnorm(N,mean=m2,sd=sd2)• y3<-rnorm(N,mean=m3,sd=sd3)

• N<-500• m1<-10;m2<-50;m3<-20;• sd1<-5;sd2<-4;sd3<-1• z1<-rnorm(N,mean=m1,sd=sd1)• z2<-rnorm(N,mean=m2,sd=sd2)• z3<-rnorm(N,mean=m3,sd=sd3)

• w1<-c(x1,y1,z1)• w2<-c(x2,y2,z2)• w3<-c(x3,y3,z3)• library(rgl)• plot3d(w1,w2,w3)

Page 13: 量的表現  Quantitation

データプロットを眺める最適視点を探す

Find “best” spot to look at the data plot

Page 14: 量的表現  Quantitation

亜集団の混合Mixture of subpopulations

R7-5.R

Page 15: 量的表現  Quantitation

• # 偏った集団構成 (100 人規模の亜集団4つと 10 人規模の亜集団を 20個 ) で

• #100 項目のデータを作成• Nm<-100 # 項目数• # 亜集団別の人数発生 (100 人くらいの 4 亜集団と 20 人くらいの 10 亜

集団 )• Ns<-c(rpois(4,100),rpois(20,10)) • Npop<-length(Ns) # 亜集団数• M<-NULL # 全データを納める行列• # 亜集団別に平均を振ってシミュレーション• for(j in 1:Npop){• tmpM<-matrix(rep(0,Nm*Ns[j]),ncol=Nm)• for(i in 1:Nm){ # 項目ごとのループ• af<-rnorm(1) # 項目の亜群期待値• tmpM[,i]<-rnorm(Ns[j],af) # 亜集団別のデータ• }• # 全データ行列に格納• M<-rbind(M,tmpM)• }

# データを標準化wholemean<-mean(M)M<-M-wholemean # 全平均が0 になるようにmu<-apply(M,2,mean) # 列平均M<-t(t(M)-mu) # 列平均が 0 になるように

R7-5.R

Page 16: 量的表現  Quantitation

# 固有値分解svdout<-svd(M)M2<-svdout$u%*%diag(svdout$d) # 分解後データ行列par(mfcol=c(1,2))# 固有値分解前後を image() プロットimage(1:sum(Ns),1:Nm,M,xlab=" サンプル( 大集団→小集団 )",ylab=" 項目 ")image(1:sum(Ns),1:Nm,M2,xlab=" サンプル ( 大集団→小集団 )",ylab="PCA 後 eigen 項目 ")

# 固有値分解前後を image() プロットimage(1:sum(Ns),1:Nm,M,xlab=" サンプル( 大集団→小集団 )",ylab=" 項目 ")

Page 17: 量的表現  Quantitation

亜集団の混合Mixture of subpopulations

R7-5.R

Page 18: 量的表現  Quantitation

適切な軸Appropriate axes

Page 19: 量的表現  Quantitation

データを読む“ Read” data

• 記述する・説明する Description, Explanation

• 少ない変数で説明する Describe with a few variables

• 残りは「ランダム」と考える The rest is “at random”

Page 20: 量的表現  Quantitation

SSw=SSb+SSi

Page 21: 量的表現  Quantitation

• SSb が大きければ、「群の違いが大きい」– When SSb is larger, “difference among groups is

larger”

• サンプル数が異なるとき– When No. samples is different

• サンプル数について一般化– Generalization for No. samples– 自由度 degrees of freedom

分散分析 ANOVA SSw=SSb+SSi

Page 22: 量的表現  Quantitation

固有値分解・主成分分析Eigenvalue decomposition ・Principal Component Analysis

(PCA)• 正規直交基底

Orthonormal base• どうして「直交」  Why

orthogonal?• 分散が基底成分の分散に

分解できるから Because variance is decomposed into component variances of directions

R7-5.R