Bonjour à tou-te-s,
OK c'est beaucoup trop tard pour répondre à cette question, mais ce prblème m'amusait, donc j'ai essayé de le coder en suivant les conseils éclairés d'ambrosio :
Code:
# Fonction de génération des b échantillons bootstrap
projet <- function(m=0,s=1,N=1000,b=50){
u <-matrix(sample(rnorm(N,m,s), N*b, replace=T),ncol=b)
list("moy" = apply(u,2,mean),"dev" = apply(u,2,sd))
}
# Estimation des moyenne et écart-type
m <- 0; s <- 1
boot50 <- projet(m=m,s=s)
moy50 <- boot50$moy ; dev50 <- boot50$dev
boot500 <- projet(m=m,s=s,b=500)
moy500 <- boot500$moy ; dev500 <- boot500$dev

# Affichage
maxigraf1 <- max(c(hist(moy50,freq=FALSE)$intensities,hist(moy500,freq=FALSE)$intensities))
maxigraf2 <- max(c(hist(dev50,freq=FALSE)$intensities,hist(dev500,freq=FALSE)$intensities))
graphics.off()
layout(1:2)
graf1 <- hist(c(moy50,moy500,m),ylim=range(0,maxigraf1),freq=FALSE,col=NA,border=NA,xlab="",ylab="",main="")
hist(moy50 ,add=TRUE,border=1,freq=FALSE,breaks=graf1$breaks)
hist(moy500,add=TRUE,border=2,freq=FALSE,breaks=graf1$breaks)
abline(v=m,lty=2,col=3)
graf2 <- hist(c(dev50,dev500,s),ylim=range(0,maxigraf2),freq=FALSE,col=NA,border=NA,xlab="",ylab="",main="")
hist(dev50 ,add=TRUE,border=1,freq=FALSE,breaks=graf2$breaks)
hist(dev500,add=TRUE,border=2,freq=FALSE,breaks=graf2$breaks)
abline(v=s,lty=2,col=3)
L'affichage des histogrammes me rend le plus de place parce que je ne suis pas très doué pour afficher plusieurs choses différentes sur le même graphe...
Encore désolé pour le retard à l'allumage,
V.