Skip to content

Instantly share code, notes, and snippets.

@piroyoung
Created December 8, 2013 09:47
Show Gist options
  • Save piroyoung/7855267 to your computer and use it in GitHub Desktop.
Save piroyoung/7855267 to your computer and use it in GitHub Desktop.
testgitst
#標本平均,普遍分散のヒストグラム
setwd("~/Desktop")
Num.repeat <- 1.0 * 10^5
List.flex <- c(2,3,4,5,6,7)
Tran <- "40"
List.color<- c("#0000ff","#3300cc","#660099","#990066","#cc0033","#ff0000")
Breaks <- 1000
List.colortran <- paste(List.color,Tran,sep ="")
Make.kai2 <- function(Flex,Rep)
{
Estimator.var <- numeric(length = Rep)
for(i in 1:Rep ){
X <- rnorm(n = Flex , mean = 0 , sd = 1)
Estimator.var[i] <- sum(X^2)
}
Estimator.var
}
jpeg("Hist.jpg" ,pointsize = 36, width = 2560, height = 1600)
U.var <- Make.kai2(List.flex[1],Num.repeat)
hist(U.var, col = List.colortran[1] ,
border = List.colortran[1],
bg = "#000000",
xlim = c(0.5,15),
ylim = c(0,(Num.repeat / Breaks) * 20 ),
breaks = Breaks)
for(i in 2:6)
{
U.var <- Make.kai2(List.flex[i],Num.repeat)
hist(U.var,col = List.colortran[i] ,
border = List.colortran[i] ,
bg = "#000000",
xlim = c(0.5,15),
ylim = c(0,(Num.repeat / Breaks) * 20 ),
breaks = Breaks ,
add = TRUE)
}
dev.off()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment