r - Barplot with significant differences and interactions? -


I use a Barplot with your data and ANOVA statistics would visualize the joints, it is important that significant differences Get a signal of the conversation. How can you create such a conspiracy by using R?

This is what I would like:

Important difference:

 significant difference

key interactions:

 critical dialogue the

bACKGROUND

I currently Using the barplot 2 {ggplots} at the plot time and confidence interval, but I would like to use any package / process to do the job I'm ready. To get the data I currently TukeyHSD {stats} or pairwise.t.test {for stats} difference and ANOVA functions ( aov ezANOVA {ez} , gls {nlme} ).

Just to give you an idea, this is my current conspiracy: Barlot 2 with CIS

As you type the function barplot2 () from the library Gplots , give examples using this approach.

First of all, the barplot2 () function in the form of a barlot given in the help file. The duplicate confidence interval value is ci.l and ci.u the barplot must be saved as an object.

  hh < - T (VADETH) [1: 2, 5: 1] margarol & lt; - "Gray 20" CIL. LT <- HH * 0.85 Ci.u < - hh * 1.15 mp & lt; - barplot2 (hh, beside = TRUE, col = c ( "gray12", "gray82"), Legend = colnames (VADeaths) [1: 2], ylim = c (0, 100), cex.names = 1.5, Plot.ci = TRUE, ci.l = ci.l, ci.u = ci.u)   

If you see the object MP , all in it X coordinates for the bar are included. [2], 2.5 5.5 8.5 11.5 14.5

/ Code>

Now I use high confidence interval values ​​to calculate the coordinates for the y values ​​of segments. Segments will start from the position which is greater than 1, at the end of the confidence interval. There are four rows in y.cord - the first and second lines correspond to the first time and the other two rows for the second time, calculating the highest Y value each time for the maximum values ​​of confidence interval for the pair She goes. The x.cord values ​​repeat only the values ​​that are in the mp objects, every 2 times.

  y.cord & lt; -rbind (CIU [1,] + 1), C (CIU, 2, max) +5), C (Apply CI, 2, Max) +5), CI .U [2,] + 1)) x.cord & lt; -apply (mp, 2, function (x) representative (x, each = 2))   

Barplot is used index () five line segments To create (because at this time there are 5 groups)

  sapply (1: 5, function (x) line using the coordinate coordinates (x.cord [, x], y.cord [, X]))   

To plot texts on the segments, calculate X and Y coordinates, where x is the midpoint of x values ​​and y values ​​of Calculation Each time the pair is done with the intervals of some constants of confidence. Then use the function text () to add the information.

  x.text & lt; -col means (mp) y.text & lt; -apply (ci.u, 2, max) +7 text (c ("(", "**", "**", "***", "ns", "***"), x = X.text, y = y.text)   

Enter image details here

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -