Print(ggMarginal((a, b, graph.sys = "ggplot2"), I would like to point to the ggExtra package, which can be used to display marginal distributions at ggplot2-plots like so: library(ggExtra) There is a lot of worthwhile additions available on CRAN. Find an example of an ggplot2 combined with a ggplot2 regression line and regression line confidence intervall on this poster in fig 3: Evans R, Gonnermann U, Koch A, Lehnert B, GMS Curr Posters Otorhinolaryngol Head Neck Surg 2015 11:Doc310 (20150416). ![]() Of course, there are countless ways to build on top of such a plot. Hadley Wickhams announcement of the geom_count geom: in more detail: However, starting from version 2.0, ggplot2 features an alternative with the geom_count, which draws bigger dots if there is more than one data point at a given location as in print( (A, B, graph.sys = "ggplot2", geom_count = TRUE) ) Unfortunately, this option does not exist with ggplot2 output. In base graphics BlandAltmanLeh features the Bland Altman Plot as a sunflower plot (A, B, sunflower=TRUE) Of course you could always calculate just the statistics with bland-altman.stats(), then add some jitter to the data points and plot this yourself. The BlandAltmanLeh package offers two solutions to that problem, one for base graphics and one for ggplot2. There are 21 data points visible even though there are 46 data points contained. ![]() Obviously there is a lot of ties in these data. Thus, you have the full flexibility of the R graphic systems but no need to worry about details like missing data etc. Legend(x = "topright", legend = c("male","female"), fill = 1:2) ![]() Sub=paste("critical difference is", round(ba.stats$critical.diff,4)), Plot(ba.stats$means, ba.stats$diffs, col=sex, If you want to make a specialty Bland Altman Plot of your own, you can still use the BlandAltmanLeh package to compute the statistics behind the as in this little example, where male and female data are to be drawn in different colors: A <- c(-0.358, 0.788, 1.23, -0.338, -0.789, -0.255, 0.645, 0.506, library(BlandAltmanLeh)ī(A, B, main="This is a Bland Altman Plot", xlab="Means", ylab="Differences") There also is less inclination to tilt one’s head as there is no need to judge deviations from a diagonal line.Īs the differences are what we are looking for, three additional lines with information on the differences are added: the mean of the differences and 2 (1,96 resp.) standard deviations above and below that. plot((A+B)/2, A-B, main="Mean-Difference-Plot")Īs can easily be seen, the dots are scattered over more “space”, thus using the space better. Bland and Altman (and apparently Tukey before them) propose a different approach, where the x axis is the mean of two measurements each and the y axis is the difference between them. Finally, the choice of which measurement is placed on the horizontal and which on the vertical axis is often arbitrary. ![]() Deviations from identity are displayed on a diagonal line which may not be what our brain recognises best. As the data will mostly be placed on a diagonal line, most of the space in the diagram is wasted. This is a useful plot but may often not be optimal. Your first attempt to inspect these data may be a scatter plot like plot(A, B, main="Scatter plot") Let’s say you have measured the following dependend measurements. Imagine, you’ve measured some parameter with two different measurements at different times or under differing conditions. What’s the main idea behind Bland-Altman plots?
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |