# 2005 年 01 月 18 日作成 # MLE の固有根の密度関数の作図 rep.no<-10000 ell.largest<-rep(0,rep.no) ell.2nd<-rep(0,rep.no) ell.3rd<-rep(0,rep.no) ell.smallest<-rep(0,rep.no) for (i in 1:rep.no){ xw.1<-rnorm(10,0,1) xw.2<-rnorm(10,0,1) xw.3<-rnorm(10,0,1) xw.4<-rnorm(10,0,1) xw<-matrix(c(xw.1,xw.2,xw.3,xw.4),10,4) #xw w<-t(xw)%*%xw #w eigen.w<-eigen(w) #eigen.w lam<-c(eigen.w$values) hmat<-matrix(eigen.w$vectors,4,4) #lam; hmat ell.largest[i]<-lam[1]/10; ell.2nd[i]<-lam[2]/10; ell.3rd[i]<-lam[3]/10; ell.smallest[i]<-lam[4]/10 } plot(density(ell.largest),xlim=c(0,4),ylim=c(0,3.0),xlab="",ylab="",main="density of eigenvalues of MLE(dim=4,n=10)") par(new=T) plot(density(ell.2nd),xlim=c(0,4),,xlab="",ylab="",ylim=c(0,3.0),main="") par(new=T) plot(density(ell.3rd),xlim=c(0,4),,xlab="",ylab="",ylim=c(0,3.0),main="") par(new=T) plot(density(ell.smallest),xlim=c(0,4),,xlab="",ylab="",ylim=c(0,3.0),main="") mean(ell.1d);mean(ell.2d) var(ell.1d); mean(ell.2d) mean(ell.1);mean(ell.2) var(ell.1); mean(ell.2)