QQ Assignment: More than Two Data

I would like to build a QQ graph similar to this image:

http://i.stack.imgur.com/OmyCu.png

I managed to get a QQ plot using two samples, but I do not know how to add a third plot. Here is my result:

http://i.stack.imgur.com/6VkgA.png

Here is the code I used:

qqplot(table$Bedouin, table$Tunisia, xlim = c(-0.25,0.25), ylim = c(-025,0.25)) 

There are other groups in my table data frame that I would like to add. But I can not.

Thanks in advance.

+7
source share
2 answers

I assume that you are looking for a scatter chart of sorted values, since all variables are stored in a single data frame.

Dataset example:

 set.seed(10) dat <- data.frame(A = rnorm(20), B = rnorm(20), C = rnorm(20)) 

This is a way to create a graph with the basic functions of R:

 # create a QQ-plot of B as a function of A qqplot(dat$A, dat$B, xlim = range(dat), ylim = range(dat), xlab = "A", ylab = "B/C") # create a diagonal line abline(a = 0, b = 1) # add the points of C points(sort(dat$A), sort(dat$C), col = "red") # create a legend legend("bottomright", legend = c("B", "C"), pch = 1, col = c("black", "red")) 

enter image description here

+8
source

You can add a line

 par(new=TRUE) 

Then use qqplot () again to overlay the first chart as follows:

 set.seed(10) dat <- data.frame(A = rnorm(20), B = rnorm(20), C = rnorm(20)) # create a QQ-plot of B as a function of A qqplot(dat$A, dat$B, xlim = range(dat), ylim = range(dat), xlab = "Distribution A", ylab = "Other distributions") # set overplotting par(new=TRUE) # create a QQ-plot of B as a function of C qqplot(dat$A, dat$C, xlim = range(dat), ylim = range(dat), xlab = "Distribution A", ylab = "Other distributions", col = "red") # create a diagonal line abline(a = 0, b = 1) # create a legend legend("bottomright", legend = c("B", "C"), pch = 1, col = c("black", "red")) 
0
source

Source: https://habr.com/ru/post/959078/


All Articles