make.echant.norm<-function(mu=0,sigma=1,li,co,matrice=NULL){ # création (à la Rcmd) d'un échantillon normal # ********************************************************* # make.echant.norm(mu=0,sigma=1,li,co,matrice=NULL) : # * Variables d'entrées : # * mu et sigma : les paramètres de la loi normale (moyenne et écart-type) # par défaut respectivement égaux à 0 et 1. # * li,co : nombre de lignes et de colonnes # * matrice : optionnelle (égale à NULL par défaut) pour IMPOSER Un tirage # * Variables de sortie : # * une matrice rectangulaire li x co contenant les tirages # 2007 by Jérôme BASTIEN # Université Claude Bernard Lyon I, UFRSTAPS, Laboratoire CRIS, Villeurbanne # E-Mail : jerome.bastien@univ-lyon1.fr if (is.null(matrice)) {EchantillonsNormaux <- as.data.frame(matrix(rnorm(li*co, mean=mu, sd=sigma), ncol=co))} else {EchantillonsNormaux <- as.data.frame(matrice)} rownames(EchantillonsNormaux) <- paste("sample", 1:li, sep="") colnames(EchantillonsNormaux) <- paste("obs", 1:co, sep="") EchantillonsNormaux$mean <- rowMeans(EchantillonsNormaux[,1:co]) EchantillonsNormaux$sd <- apply(EchantillonsNormaux[,1:co], 1, sd) return(EchantillonsNormaux) }