Modérateur : Groupe des modérateurs
Code : Tout sélectionner
image(cor(data))
Code : Tout sélectionner
bitmap("/home/rom/cor","png256",width=10,height=10,res=72,pointsize=12)
pairs(tab[,c(1,2)], lower.panel=panel.smooth, upper.panel=testCorr)
dev.off()
Code : Tout sélectionner
panel.cor <- function(echantillon1, echantillon2, digits=2, prefix="", cex.cor)
{
usr <- par("usr"); on.exit(par(usr))
par(usr = c(0, 1, 0, 1))
r <- abs(cor(echantillon1, echantillon2))
txt <- format(c(r, 0.123456789), digits=digits)[1]
txt <- paste(prefix, txt, sep="")
if(missing(cex.cor)) cex <- 0.8/strwidth(txt)
test <- cor.test(echantillon1, echantillon2)
# borrowed from printCoefmat
Signif <- symnum(test$p.value, corr = FALSE, na = FALSE,
cutpoints = c(0, 0.001, 0.01, 0.05, 0.1, 1),
symbols = c("***", "**", "*", ".", " "))
text(0.5, 0.5, txt, cex = cex * r)
text(.8, .8, Signif, cex=cex, col=2)
png("/home/rom/cor",width=10,height=10,res=72,pointsize=12)
tabCo=data.frame(echantillon1, echantillon2)
pairs(tabCo[,c(1,2)],
lower.panel=panel.smooth, upper.panel=panel.cor)
dev.off()
graphics.off()
}
Code : Tout sélectionner
testCorr <- function(nomFichier , type_image , donnees , NbVariables)
{
panel.cor <- function(echantillon1, echantillon2, digits=1, prefix="", cex.cor)
{
usr <- par("usr"); on.exit(par(usr))
par(usr = c(0, 1, 0, 1))
r <- abs(cor(echantillon1, echantillon2))
txt <- format(c(r, 0.123456789), digits=digits)[1]
txt <- paste(prefix, txt, sep="")
if(missing(cex.cor)) cex <- 0.8/strwidth(txt)
test <- cor.test(echantillon1, echantillon2)
# borrowed from printCoefmat
Signif <- symnum(test$p.value, corr = FALSE, na = FALSE,
cutpoints = c(0, 0.5, 0.7, 0.85, 0.95, 1),
symbols = c("***","**","*","."," "))
# col = c("green", "blue","orange","yellow","white"))
# -> dans ce genre mais ça ne marche pas ;-) : une idée ?
if (txt > 0.5)
text(0.5, 0.5, txt, cex = cex * r)
else
text(0.5, 0.5, txt, cex = 8 * cex * r)
text(.75, .8, Signif, cex=cex, col=2)
}
bitmap(nomFichier,type_image,width=10,height=10,res=72,pointsize=12)
pairs(donnees[,c(1:NbVariables)],lower.panel=panel.smooth, upper.panel=panel.cor)
dev.off()
graphics.off()
}
Romain Lecachey a écrit :Code : Tout sélectionner
Signif <- symnum(test$p.value, corr = FALSE, na = FALSE,
cutpoints = c(0, 0.5, 0.7, 0.85, 0.95, 1),
symbols = c("***","**","*","."," "))
# col = c("green", "blue","orange","yellow","white"))
# -> dans ce genre mais ça ne marche pas ;-) : une idée ?
if (txt > 0.5)
text(0.5, 0.5, txt, cex = cex * r)
else
text(0.5, 0.5, txt, cex = 8 * cex * r)
text(.75, .8, Signif, cex=cex, col=2)
Code : Tout sélectionner
Signif <- symnum(test$p.value, corr = FALSE, na = FALSE,
cutpoints = c(0, 0.5, 0.7, 0.85, 0.95, 1),
symbols = c("green", "blue","orange","yellow","white"))
polygon(c(0,1,1,0),c(0,0,1,1),border="black",col=Signif)
Retourner vers « Questions en cours »
Utilisateurs parcourant ce forum : Aucun utilisateur enregistré et 1 invité