Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to plot a boxplot from previously-calculated statistics easily (in R?) [duplicate]

Possible Duplicate:
Draw bloxplots in R given 25,50,75 percentiles and min and max values

I have a number of sets of summary statistics from various datasets: max, min, mean, median etc. I'd like to plot box-plots of these - or at least, similar plots to boxplots (I don't have UQ and LQ stats, although it may be possible to get those).

I don't have the original data, so I can't just use the boxplot function in R. Is there an easy way to do this in R when you just have the summary statistics? If not, is there an easy way to do this using another free tool?

like image 358
robintw Avatar asked May 03 '12 18:05

robintw


People also ask

How do you make a boxplot from a data set in R?

In R, boxplot (and whisker plot) is created using the boxplot() function. The boxplot() function takes in any number of numeric vectors, drawing a boxplot for each vector. You can also pass in a list (or data frame) with numeric vectors as its components.

Can boxplot be used for comparing different data sets?

Boxplots are particularly useful for assessing quickly the location, dispersion, and symmetry or skewness of a set of data, and for making comparisons of these features in two or more data sets.

What type of data is best for a box plot?

Box plots are used to show distributions of numeric data values, especially when you want to compare them between multiple groups. They are built to provide high-level information at a glance, offering general information about a group of data's symmetry, skew, variance, and outliers.

Why would a box plot be the best data display for the results?

A box plot is ideal for comparing distributions because the centre, spread and overall range are immediately apparent. Figure 4.5. 2.1 shows how to build the box and whisker plot from the five-number summary.

What is the formula in a boxplot in R?

Syntax. The basic syntax to create a boxplot in R is − boxplot(x, data, notch, varwidth, names, main) Following is the description of the parameters used − x is a vector or a formula. data is the data frame.


1 Answers

The boxplot function in R uses a low-level function called bxp which accepts summary statistics. A simple example (lower whisker=1, 1st quartile=2, median=3, 3rd quartile=4, upper whisker=5) would look like this:

summarydata<-list(stats=matrix(c(1,2,3,4,5),5,1), n=10)
bxp(summarydata)

If you want to know more about the data structure that bxp accepts as input, look at the return value of the high-level boxplot function for some dummy data, i.e. try

sd<-boxplot(dummydata)
str(sd)
like image 183
psj Avatar answered Sep 27 '22 19:09

psj