Interaktionsplot mit Boxplot /SE kombiniert

Wie erstelle ich Grafiken, was ist zu beachten?

Moderatoren: EDi, jogo

Antworten
eimichae
Beiträge: 36
Registriert: Mo Okt 10, 2016 8:48 pm

Interaktionsplot mit Boxplot /SE kombiniert

Beitrag von eimichae »

Hallo zusammen,
Ich habe in ggplot2 einen Interaktionsplot erstellt. Dieser vergleicht die Mortalität von Käfern welche auf Bt und nicht-Bt (Non) Pflanzen gelbt haben und an pinheads (pins) oder nicht-pinheads gegessen haben (siehe Angehängte Grafik).
Nun würde ich gerne an jedem der 4 Punkte in der Grafik ein Mass für die Varianz angeben. Am besten einen kleinen Boxplot oder einen Balken der den SE anzeigt. Das Problem ist, das meine response variable (dead.id) binär ist (0/1).

Kann mir jemand weiterhelfen?
Vielen Dank,
Michi


Untenstehend findet ihr meinen Code sowie meinen Datensatz (dput)

CODE:

Code: Alles auswählen

#INTERACTION PLOT
ggplot(data = dta,
       aes(x = plant, y = dead.id, colour = pin, group=pin)) +
  stat_summary(fun.y=mean, geom="point")+
  stat_summary(fun.y=mean, geom="line")

dput(dta)


DATEN:
> dput(dta)
structure(list(sample = structure(c(1L, 1L, 1L, 2L, 3L, 3L, 3L,
4L, 4L, 4L, 5L, 6L, 6L, 6L, 7L, 7L, 8L, 8L, 8L, 9L, 9L, 9L, 10L,
10L, 10L, 11L, 11L, 12L, 12L, 12L, 13L, 13L, 13L, 14L, 14L, 14L,
15L, 15L, 16L, 16L, 16L, 17L, 17L, 17L, 18L, 18L, 18L, 19L, 19L,
19L, 20L, 20L, 21L, 22L, 22L, 22L, 23L, 23L, 23L, 24L, 24L, 24L,
25L, 26L, 26L, 26L, 27L, 27L, 27L, 28L, 28L, 29L, 29L, 29L, 30L,
30L, 30L, 31L, 31L, 31L, 32L, 32L, 32L, 33L, 33L, 34L, 34L, 34L,
35L, 35L, 35L, 36L, 36L, 36L, 37L, 37L, 37L, 38L, 38L, 38L, 39L,
39L, 39L, 40L, 40L, 40L, 41L, 41L, 42L, 42L, 42L, 43L, 44L, 44L,
44L, 45L, 45L, 45L, 46L, 46L, 47L, 48L, 48L, 48L, 49L, 49L, 50L,
50L, 50L, 51L, 51L, 51L, 52L, 52L, 53L, 53L, 53L, 54L, 54L, 54L,
55L, 55L, 55L, 56L, 56L, 56L, 57L, 57L, 57L, 58L, 58L, 58L, 59L,
59L, 59L, 60L, 60L, 60L, 61L, 61L, 61L, 62L, 62L, 62L, 63L, 63L,
63L, 64L, 64L, 64L, 65L, 65L, 65L, 66L, 66L, 67L, 67L, 67L, 68L,
68L, 68L, 69L, 69L, 69L, 70L, 70L, 70L, 71L, 71L, 71L, 72L, 72L,
72L, 73L, 73L, 73L, 74L, 74L, 74L, 75L, 75L, 75L, 76L, 76L, 76L,
77L, 77L, 77L, 78L, 78L, 78L, 79L, 79L, 79L, 80L, 80L, 81L, 81L,
81L, 82L, 82L, 82L, 83L, 83L, 84L, 84L, 84L, 85L, 85L, 85L, 86L,
86L, 86L, 87L, 87L, 87L, 88L, 88L, 89L, 89L, 89L, 90L, 90L, 90L,
91L, 91L, 91L, 92L, 92L, 93L, 93L, 93L, 94L, 94L, 94L, 95L, 95L,
95L, 96L, 96L, 97L, 97L, 97L, 98L, 98L, 99L, 99L, 99L, 100L,
101L, 101L, 101L, 102L, 102L, 102L, 103L, 103L, 103L, 104L, 104L,
104L, 105L, 105L, 105L, 106L, 106L, 106L, 107L, 107L, 107L, 108L,
108L, 108L, 109L, 109L, 109L, 110L, 110L, 110L, 111L, 112L, 112L,
112L, 113L, 113L, 113L, 114L, 114L, 114L, 115L, 115L, 115L, 116L,
116L, 116L, 117L, 117L, 118L, 118L, 118L, 119L, 119L, 119L, 120L,
120L, 120L, 121L, 121L, 121L, 122L, 122L, 122L, 123L, 123L, 124L,
124L, 125L, 125L, 126L, 126L), .Label = c("10BtC", "10BtCat",
"10BtJa", "10nonC", "10nonCat", "10nonJa", "11BtC", "11BtCat",
"11nonC", "11nonCat", "11nonJa", "12BtCat", "12BtJa", "12nonC",
"12nonCat", "12nonJa", "13BtCat", "13nonC", "14BtC", "14BtCat",
"14nonJa", "15BtC", "15nonC", "15nonCat", "15nonJa", "16BtC",
"16BtCat", "16BtJa", "16nonC", "16nonCat", "16nonJa", "17BtC",
"17BtJa", "17nonC", "17nonCat", "18BtC", "18BtCat", "18nonCat",
"18nonJa", "19BtC", "19BtCat", "19BtJa", "19nonC", "19nonCat",
"19nonJa", "1BtC", "1BtJa", "1nonC", "1nonCat", "1nonJa", "20BtC",
"20BtJa", "20nonCat", "20nonJa", "21BtCat", "21BtJa", "21nonC",
"21nonCat", "21nonJa", "22BtC", "22BtCat", "22BtJa", "22nonC",
"22nonCat", "22nonJa", "23BtC", "23BtCat", "23BtJa", "23nonC",
"23nonCat", "23nonJa", "24BtC", "24BtJa", "24nonC", "24nonCat",
"24nonJa", "25BtC", "25BtCat", "25BtJa", "25nonC", "25nonCat",
"25nonJa", "26nonC", "2BtC", "2BtCat", "2BtJa", "2nonCat", "2nonJa",
"3BtC", "3BtCat", "3BtJa", "3nonCat", "3nonJa", "4BtC", "4BtCat",
"4BtJa", "4nonCat", "4nonJa", "5BtCat", "5BtJa", "5nonC", "5nonCat",
"5nonJa", "6BtC", "6BtCat", "6BtJa", "6nonC", "6nonCat", "6nonJa",
"7BtCat", "7BtJa", "7nonC", "7nonCat", "7nonJa", "8BtC", "8BtCat",
"8BtJa", "8nonC", "8nonCat", "8nonJa", "9BtC", "9BtCat", "9BtJa",
"9nonC", "9nonCat", "9nonJa"), class = "factor"), id = structure(c(1L,
1L, 1L, 2L, 3L, 3L, 3L, 4L, 4L, 4L, 5L, 6L, 6L, 6L, 1L, 1L, 2L,
2L, 2L, 4L, 4L, 4L, 5L, 5L, 5L, 6L, 6L, 2L, 2L, 2L, 3L, 3L, 3L,
4L, 4L, 4L, 5L, 5L, 6L, 6L, 6L, 2L, 2L, 2L, 4L, 4L, 4L, 1L, 1L,
1L, 2L, 2L, 6L, 1L, 1L, 1L, 4L, 4L, 4L, 5L, 5L, 5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, 0L, 1L, 1L, 1L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
0L, 1L, 0L, 1L, 1L, 1L, 0L, 0L, 1L, 0L, 0L, 0L, 1L, 1L, 0L, 1L,
1L, 1L, 1L, 0L, 0L, 1L, 1L, 0L, 1L, 0L, 1L)), .Names = c("sample",
"id", "plant", "pin", "dead.id"), class = "data.frame", row.names = c(NA,
-340L))
Dateianhänge
example.jpg
example.jpg (10.19 KiB) 1963 mal betrachtet
bigben
Beiträge: 2771
Registriert: Mi Okt 12, 2016 9:09 am

Re: Interaktionsplot mit Boxplot /SE kombiniert

Beitrag von bigben »

Hallo eimichae,

darf ich mal ganz dumm fragen, was Du Dir von einem Boxplot einer binären Variable versprichst? Oder was Du Dir von der Varianz einer binären Variablen erwartest?

Wenn Du die Häufigkeit einer binären Variable in Abhängigkeit zweier anderer binärer Variablen darstellen willst, wäre ggf. ein Mosaikplot eine intuitive Variante?

Code: Alles auswählen

dta$pin.f <- factor(dta$pin, labels=c("no pin","pin"))
dta$dead.f <- factor(dta$dead.id, labels=c("alive", "dead"))

mosaicplot( ~ + dead.f + plant + pin.f , data=dta)
LG,
Bernhard
---
Programmiere stets so, dass die Maxime Deines Programmierstils Grundlage allgemeiner Gesetzgebung sein könnte
eimichae
Beiträge: 36
Registriert: Mo Okt 10, 2016 8:48 pm

Re: Interaktionsplot mit Boxplot /SE kombiniert

Beitrag von eimichae »

Hallo Bernhard,
Danke für deine Antwort.
Du hast natürlich recht. Ein Boxplot mit binären Variablen macht nicht so viel Sinn.
Ich habe das input file daher angepasst (siehe unten). Ich habe nun die samples des gleichen Namens gepoolt (z.B. aller 3 Werte des samples 10BtC ergeben einen Wert) und so eine Dezimalwert zwischen 0-1 errechnet. Diese Werte sind in der Spalte dec_alive (allerdings habe ich nun viele NA Werte)

Mit den Werten der "dec_alive" Spalte würde ich nun gerne 4 Boxplots erstellen, an den 4 Punkten des Interaktionsplots ( für alle 4 Kombinationen der Werte die Food_new=pin /plant=Bt oder Food_new=boll/plant=Bt oder Food_new=boll/Plant=non oder Food_new=pin/Plant=non).

Ist das überhaupt möglich? Ich stosse leider ziemlich an meine Grenzen.

Vielen Dank,
Michi


BTW: Der Mosaikplot ist leider nicht ganz was ich suche. Ist aber gut zu wissen, dass es sowas gibt. Könnte nützlich sein

> dput(dta)
structure(list(sample = structure(c(1L, 1L, 1L, 2L, 3L, 3L, 3L,
4L, 4L, 4L, 5L, 6L, 6L, 6L, 7L, 7L, 8L, 8L, 8L, 9L, 9L, 9L, 10L,
10L, 10L, 11L, 11L, 12L, 12L, 12L, 13L, 13L, 13L, 14L, 14L, 14L,
15L, 15L, 16L, 16L, 16L, 17L, 17L, 17L, 18L, 18L, 18L, 19L, 19L,
19L, 20L, 20L, 21L, 22L, 22L, 22L, 23L, 23L, 23L, 24L, 24L, 24L,
25L, 26L, 26L, 26L, 27L, 27L, 27L, 28L, 28L, 29L, 29L, 29L, 30L,
30L, 30L, 31L, 31L, 31L, 32L, 32L, 32L, 33L, 33L, 34L, 34L, 34L,
35L, 35L, 35L, 36L, 36L, 36L, 37L, 37L, 37L, 38L, 38L, 38L, 39L,
39L, 39L, 40L, 40L, 40L, 41L, 41L, 42L, 42L, 42L, 43L, 44L, 44L,
44L, 45L, 45L, 45L, 46L, 46L, 47L, 48L, 48L, 48L, 49L, 49L, 50L,
50L, 50L, 51L, 51L, 51L, 52L, 52L, 53L, 53L, 53L, 54L, 54L, 54L,
55L, 55L, 55L, 56L, 56L, 56L, 57L, 57L, 57L, 58L, 58L, 58L, 59L,
59L, 59L, 60L, 60L, 60L, 61L, 61L, 61L, 62L, 62L, 62L, 63L, 63L,
63L, 64L, 64L, 64L, 65L, 65L, 65L, 66L, 66L, 67L, 67L, 67L, 68L,
68L, 68L, 69L, 69L, 69L, 70L, 70L, 70L, 71L, 71L, 71L, 72L, 72L,
72L, 73L, 73L, 73L, 74L, 74L, 74L, 75L, 75L, 75L, 76L, 76L, 76L,
77L, 77L, 77L, 78L, 78L, 78L, 79L, 79L, 79L, 80L, 80L, 81L, 81L,
81L, 82L, 82L, 82L, 83L, 83L, 84L, 84L, 84L, 85L, 85L, 85L, 86L,
86L, 86L, 87L, 87L, 87L, 88L, 88L, 89L, 89L, 89L, 90L, 90L, 90L,
91L, 91L, 91L, 92L, 92L, 93L, 93L, 93L, 94L, 94L, 94L, 95L, 95L,
95L, 96L, 96L, 97L, 97L, 97L, 98L, 98L, 99L, 99L, 99L, 100L,
101L, 101L, 101L, 102L, 102L, 102L, 103L, 103L, 103L, 104L, 104L,
104L, 105L, 105L, 105L, 106L, 106L, 106L, 107L, 107L, 107L, 108L,
108L, 108L, 109L, 109L, 109L, 110L, 110L, 110L, 111L, 112L, 112L,
112L, 113L, 113L, 113L, 114L, 114L, 114L, 115L, 115L, 115L, 116L,
116L, 116L, 117L, 117L, 118L, 118L, 118L, 119L, 119L, 119L, 120L,
120L, 120L, 121L, 121L, 121L, 122L, 122L, 122L, 123L, 123L, 124L,
124L, 125L, 125L, 126L, 126L), .Label = c("10BtC", "10BtCat",
"10BtJa", "10nonC", "10nonCat", "10nonJa", "11BtC", "11BtCat",
"11nonC", "11nonCat", "11nonJa", "12BtCat", "12BtJa", "12nonC",
"12nonCat", "12nonJa", "13BtCat", "13nonC", "14BtC", "14BtCat",
"14nonJa", "15BtC", "15nonC", "15nonCat", "15nonJa", "16BtC",
"16BtCat", "16BtJa", "16nonC", "16nonCat", "16nonJa", "17BtC",
"17BtJa", "17nonC", "17nonCat", "18BtC", "18BtCat", "18nonCat",
"18nonJa", "19BtC", "19BtCat", "19BtJa", "19nonC", "19nonCat",
"19nonJa", "1BtC", "1BtJa", "1nonC", "1nonCat", "1nonJa", "20BtC",
"20BtJa", "20nonCat", "20nonJa", "21BtCat", "21BtJa", "21nonC",
"21nonCat", "21nonJa", "22BtC", "22BtCat", "22BtJa", "22nonC",
"22nonCat", "22nonJa", "23BtC", "23BtCat", "23BtJa", "23nonC",
"23nonCat", "23nonJa", "24BtC", "24BtJa", "24nonC", "24nonCat",
"24nonJa", "25BtC", "25BtCat", "25BtJa", "25nonC", "25nonCat",
"25nonJa", "26nonC", "2BtC", "2BtCat", "2BtJa", "2nonCat", "2nonJa",
"3BtC", "3BtCat", "3BtJa", "3nonCat", "3nonJa", "4BtC", "4BtCat",
"4BtJa", "4nonCat", "4nonJa", "5BtCat", "5BtJa", "5nonC", "5nonCat",
"5nonJa", "6BtC", "6BtCat", "6BtJa", "6nonC", "6nonCat", "6nonJa",
"7BtCat", "7BtJa", "7nonC", "7nonCat", "7nonJa", "8BtC", "8BtCat",
"8BtJa", "8nonC", "8nonCat", "8nonJa", "9BtC", "9BtCat", "9BtJa",
"9nonC", "9nonCat", "9nonJa"), class = "factor"), dead.id = c(1L,
1L, 1L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 0L, 0L, 1L, 1L, 0L, 1L, 1L,
0L, 0L, 1L, 1L, 1L, 0L, 0L, 0L, 1L, 1L, 0L, 0L, 1L, 0L, 1L, 0L,
1L, 0L, 1L, 1L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L,
1L, 1L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 0L, 1L, 1L,
1L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 0L, 0L, 1L, 0L, 0L, 0L, 0L,
0L, 1L, 0L, 0L, 1L, 1L, 1L, 0L, 1L, 1L, 0L, 1L, 1L, 1L, 0L, 0L,
1L, 0L, 0L, 1L, 0L, 1L, 1L, 1L, 1L, 0L, 0L, 1L, 1L, 1L, 0L, 0L,
1L, 1L, 1L, 1L, 1L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 0L, 0L, 1L,
1L, 1L, 1L, 1L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 0L, 0L, 1L, 1L, 1L, 1L, 0L, 1L, 1L, 0L, 1L, 1L,
1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NA, NA, 0.666, NA, NA, 0.333, NA,
NA, 0.333, NA, NA, 0.666, NA, NA, 1, NA, NA, 0, NA, 1, NA, NA,
0, 0.666, NA, NA, 1, NA, NA, 0.5, NA, 1, 1, NA, NA, 1, NA, 0.333,
NA, NA, 1, NA, NA, 0.5, NA, 1, NA, NA, 1, NA, NA, 1, NA, NA,
1, NA, NA, 1, NA, NA, 0.333, NA, NA, 1, NA, NA, 0.666, NA, NA,
0.666, NA, NA, 0.666, NA, NA, 1, NA, NA, 0.666, NA, NA, 1, NA,
NA, 1, NA, 1, NA, NA, 0.666, NA, NA, 0.666, NA, NA, 1, NA, NA,
1, NA, NA, 1, NA, NA, 0.666, NA, NA, 1, NA, NA, 1, NA, NA, 0.666,
NA, NA, 1, NA, NA, 0.666, NA, NA, 1, NA, NA, 0.5, NA, 0.666,
NA, NA, 1, NA, NA, 1, NA, 0.333, NA, NA, 0.333, NA, NA, 0.666,
NA, NA, 0.333, NA, NA, 0.5, NA, 1, NA, NA, 0.666, NA, NA, 0.666,
NA, NA, 0, NA, 1, NA, NA, 0.333, NA, NA, 1, NA, NA, 0.5, NA,
0.333, NA, NA, 0, NA, 0.666, NA, NA, 1, 0.666, NA, NA, 1, NA,
NA, 0.333, NA, NA, 0.666, NA, NA, 0.333, NA, NA, 0.666, NA, NA,
1, NA, NA, 0.333, NA, NA, 0.666, NA, NA, 0.666, NA, NA, 1, 0.666,
NA, NA, 0.333, NA, NA, 1, NA, NA, 1, NA, NA, 0.666, NA, NA, 0.5,
NA, 0.666, NA, NA, 0.333, NA, NA, 0.333, NA, NA, 0.666, NA, NA,
1, NA, NA, 0, NA, 1, NA, 0.5, NA, 0.5, NA), id = structure(c(1L,
1L, 1L, 2L, 3L, 3L, 3L, 4L, 4L, 4L, 5L, 6L, 6L, 6L, 1L, 1L, 2L,
2L, 2L, 4L, 4L, 4L, 5L, 5L, 5L, 6L, 6L, 2L, 2L, 2L, 3L, 3L, 3L,
4L, 4L, 4L, 5L, 5L, 6L, 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2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 2L, 2L, 1L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 1L, 1L, 2L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 1L, 2L, 2L, 1L, 2L, 2L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L), .Label = c("boll", "pin"), class = "factor")), .Names = c("sample",
"dead.id", "dec_alive", "id", "treatment", "plant", "Food_new"
), class = "data.frame", row.names = c(NA, -340L))
>
bigben
Beiträge: 2771
Registriert: Mi Okt 12, 2016 9:09 am

Re: Interaktionsplot mit Boxplot /SE kombiniert

Beitrag von bigben »

Boxplots sind im Wesentlichen für kontinuierliche Werte gedacht, nicht für diskrete mit nur wenigen möglichen Werten. Dein dec_alive nimmt nur fünf verschiedene Werte an:

Code: Alles auswählen

plot(table(dta$dec_alive))
Das kommt mir nicht besonders sinnvoll vor. Ich bin kein ggplot2-Guru und habe einfach versucht, Deinen Code von oben den neuen Verhältnissen anzupassen, wobei ich angenommen habe, dass `Food_new` für das alte `pin` steht:

Code: Alles auswählen


library(ggplot2)
ggplot(data = dta,
       aes(x = plant, y = dec_alive, colour = Food_new, group=Food_new)) +
       geom_boxplot()
Das zeigt jetzt einfach nur zwei Boxen mit den fünf möglichen Werten. Ich weiß nicht, ob das nun ein befriedigender Aufruf von ggplot2 ist, aber es demonstriert schon schön das Problem der diskreten Zielvariablen.

Sorry,
Bernhard
---
Programmiere stets so, dass die Maxime Deines Programmierstils Grundlage allgemeiner Gesetzgebung sein könnte
eimichae
Beiträge: 36
Registriert: Mo Okt 10, 2016 8:48 pm

Re: Interaktionsplot mit Boxplot /SE kombiniert

Beitrag von eimichae »

Hoi Bernhard,

Danke für deine Mühe.
Wie du schon sagsts, scheint es leider mit den Daten wohl wenig Sinn zu machen mit Boxplots zu arbeiten:(

Was allerdings komisch ist: Wieso erhalte ich nur 2 Boxplots und nicht 4? Ich müsste doch für den plant type "Bt" 2 Boxplots erhalten. Einen für Pin und einen Boll (group=Food_new) und wiederum 2 für den plant typ "Non" (einen für pin und einen für boll).

Weisst du das?
Danke
Michi
bigben
Beiträge: 2771
Registriert: Mi Okt 12, 2016 9:09 am

Re: Interaktionsplot mit Boxplot /SE kombiniert

Beitrag von bigben »

Wie gesagt, ich bin nicht besonders gut in ggplot2 und weiß nicht, ob der Aufruf so sinnvoll ist oder wie Boxplots einander überlagern (was man hier ja wohl erwarten müsste). Ich lebe eher in dem alten Grafiksystem und würde mir ganz plump sowas anschauen:

Code: Alles auswählen

boxplot(dec_alive ~ plant + Food_new, data= dta)
Das soll aber nicht heißen, dass Deine ursprüngliche Idee, einen Interaktionsplot mit vier Verteilungsplots zu kombinieren nicht gut sei. Wahrscheinlich musst Du aber noch ein wenig mehr ÜBerlegung da hinein stecken.

LG
Bernhard
---
Programmiere stets so, dass die Maxime Deines Programmierstils Grundlage allgemeiner Gesetzgebung sein könnte
Antworten