# 2009 年 12 月 29 日作成 # Type "lam<-simu.large.cov(1000,8,10)" for example simu.large.cov<-function(rep.no,n,p){ smaller<-min(n,p) lam<-matrix(rep(0,rep.no*smaller),rep.no,smaller) for (i in 1:rep.no){ xw<-matrix(rep(0,n*p),n,p) for (j in 1:p){ xw[,j]<-rnorm(n,0,1) } #xw w<-t(xw)%*%xw #w eigen.w<-eigen(w) #eigen.w eigenvalue<-c(eigen.w$values)/n lam[i,]<-eigenvalue[1:smaller] } return(lam) } # Drawing graphs of marginal density # Type " den.graph(lam,4,4)" for example den.graph<-function(lam,hh,ww){ plot(density(lam[,1]),xlim=c(0,ww),ylim=c(0,hh),xlab="",ylab="",main="density of eigenvalues of MLE") par(new=T) for (j in 2:smaller){ par(new=T) plot(density(lam[,j]),xlim=c(0,ww),ylim=c(0,hh),xlab="",ylab="",col=j,main="") } }