mydata<-read.csv ("pibh-mortinf.csv",header=T) attach(mydata) png(filename="c:/temp/pibh-mortinf1.png",width=600,height=600, bg="white") plot (PIBH1995,MORTINF1995, xlab="PIB/hab ($1995, sans PPA)", ylab="Mortalité infantile (‰)", log="xy") title ("PIB/h et mortalité infantile (1995)") y = log (MORTINF1995) x = log (PIBH1995) f<-lm(y ~ x) # # Bidouille pour tracer une droite sur un diagramme log-log # b = coef(f)[1] a = coef(f)[2] x1=100 y1 = exp(a * log(x1) + b) x2=50000 y2 = exp(a * log(x2) + b) lines (c (x1,x2), c(y1,y2)) R2=cor (y, x) ^ 2 text (200,5, as.expression (substitute(italic(R)^2==r,list(r=round(R2,3))))) dev.off()