Hi all,
I would like to combine all these 3 plots in just one plot, where I could have for each coefficient three point ranges, each one from each model. I think these type of presentation of multiple coefficient in just one plot is becoming quite standard now but I don't know how to so them with the terrific ggplot. I really appreciate any help. Thanks in advance!
Antonio Pedro.
limits1 <-aes(ymax=res1[,3], ymin=res1[,1])
p1 <- qplot(rownames(res1),res1[,2],main=expression("Fixed Effects Estimates From the Main Models")) +
geom_pointrange(limits1) + coord_flip()
limits2 <-aes(ymax=res2[,3], ymin=res2[,1])
p2 <- qplot(rownames(res2),res2[,2],main=expression("Fixed Effects Estimates From the Main Models")) +
geom_pointrange(limits2) + coord_flip()
limits3 <-aes(ymax=res3[,3], ymin=res3[,1])
p3 <- qplot(rownames(res3),res3[,2],main=expression("Fixed Effects Estimates From the Main Models")) +
geom_pointrange(limits3) + coord_flip()
pushViewport(viewport(layout = grid.layout(1, 3)))
print(p1, vp = viewport(layout.pos.row = 1, layout.pos.col = 1))
print(p2, vp = viewport(layout.pos.row = 1, layout.pos.col = 2))
print(p3, vp = viewport(layout.pos.row = 1, layout.pos.col = 3))
> dput(res1)
structure(c(0.0398717191353306, 0.0753029476141652, 0.132348061127602,
0.106061093195025, 0.118730388402611, 0.186252499812586, 0.0884268166121857,
0.196565415453796, 0.0818643229703002, 0.135371557953115, -0.036872,
-0.005948, -0.006648, -0.004464, 0.01174, -0.08346, 0.599704,
-0.034392, -0.04178, -0.03178, -0.043392, -0.0431, -0.027956,
-0.03348, -0.034816, -0.055468, -0.03296, 0.0532690389141655,
0.103871574862124, 0.196636191742327, 0.162919347702524, 0.154694975642655,
0.223800555719435, 0.109273649176234, 0.243144344915242, 0.150363437311916,
0.216340872886065, -0.0306, -0.0034, 8e-04, -0.0027, 0.0186,
-0.0619, 0.8547, -0.0242, -0.032372, -0.021, -0.031828, -0.034672,
-0.0209, -0.026228, -0.027172, -0.0392, -0.019828, 0.0711679999853447,
0.143278641888225, 0.292152310910291, 0.250258724063961, 0.201553585489284,
0.268918209370221, 0.135035172154384, 0.300760804375368, 0.276178467736878,
0.345740080034496, -0.024328, -0.000852, 0.008248, -0.000936,
0.02546, -0.04034, 1.109696, -0.014008, -0.022964, -0.01022,
-0.020264, -0.026244, -0.013844, -0.018976, -0.019528, -0.022932,
-0.006696), .Dim = c(27L, 3L), .Dimnames = list(c("Democracies, High Income",
"Democracies, Middle Income", "Democracies, Low Income", "Dictatorships, High Income",
"Dictatorships, Middle Income", "Dictatorships, Low Income",
"One Transition, Middle Income", "One Transition, Low Income",
"Many Transitions, Middle Income", "Many Transitions, Low Income",
"High Income Democacies:time", "my.new.time.one.transition.low",
"demo.one.time.transit.low.income", "my.new.time.one.transition.middle",
"demo.one.time.transit.middle.income", "maternal_educ", "hiv_prev",
"log(IHME_usd_gdppc)", "Democracies, Middle Income:time", "Democracies, Low Income:time",
"Dictatorships, High Income:time", "Dictatorships, Middle Income:time",
"Dictatorships, Low Income:time", "One Transition, Middle Income:time",
"One Transition, Low Income:time", "Many Transitions, Middle Income:time",
"Many Transitions, Low Income:time"), c("low", "mean", "upper"
)))
> dput(res2)
structure(c(0.0273056947402751, 0.0562246503455014, 0.112056507911263,
0.083823322396034, 0.0932745485384253, 0.160848556425517, 0.0659947556474458,
0.170147767312342, 0.0605726383648713, 0.114474864969832, -0.042676,
-0.006048, -0.006452, -0.003764, 0.01134, 0.560684, -0.032792,
-0.0075, -0.004372, -0.023752, -0.00972, 0.000652, -0.012144,
0.000664, -0.030752, -0.00892, 0.0359977083318809, 0.0788427434193709,
0.173721819086456, 0.133881526594014, 0.123279641005498, 0.195753316837873,
0.0807578587203961, 0.214338229494029, 0.118457622310535, 0.192434392794008,
-0.0366, -0.0035, 8e-04, -0.002, 0.0182, 0.8147, -0.0226, 0.0023,
0.0068, -0.0116, -9e-04, 0.0081, -0.0045, 0.0087, -0.0137, 0.0048,
0.0474565843305885, 0.110559659361049, 0.269321889368585, 0.21383384302591,
0.162936943942255, 0.238232545598088, 0.0988234850045371, 0.270005756456979,
0.231659189070478, 0.323485819701621, -0.030524, -0.000952, 0.008052,
-0.000236, 0.02506, 1.068716, -0.012408, 0.0121, 0.017972, 0.000552,
0.00792, 0.015548, 0.003144, 0.016736, 0.003352, 0.01852), .Dim = c(26L,
3L), .Dimnames = list(c("Democracies, High Income", "Democracies, Middle Income",
"Democracies, Low Income", "Dictatorships, High Income", "Dictatorships, Middle Income",
"Dictatorships, Low Income", "One Transition, Middle Income",
"One Transition, Low Income", "Many Transitions, Middle Income",
"Many Transitions, Low Income", "High Income Democacies:time",
"my.new.time.one.transition.low", "demo.one.time.transit.low.income",
"my.new.time.one.transition.middle", "demo.one.time.transit.middle.income",
"hiv_prev", "log(IHME_usd_gdppc)", "Democracies, Middle Income:time",
"Democracies, Low Income:time", "Dictatorships, High Income:time",
"Dictatorships, Middle Income:time", "Dictatorships, Low Income:time",
"One Transition, Middle Income:time", "One Transition, Low Income:time",
"Many Transitions, Middle Income:time", "Many Transitions, Low Income:time"
), c("low", "mean", "upper")))
> dput(res3)
structure(c(0.0316361128244578, 0.0617147695434284, 0.111643111485216,
0.0833332208157427, 0.0988120221451353, 0.16128214408656, 0.073591628715114,
0.169013615874449, 0.0664352161093451, 0.116239797710042, -0.037472,
-0.006148, -0.006548, -0.004564, 0.01224, -0.081452, 0.599612,
-0.005204, -0.001376, -0.018856, -0.006424, 0.002348, -0.009348,
0.00196, -0.02556, -0.008928, 0.0417147706777615, 0.084728775556279,
0.166460039728045, 0.127581487612948, 0.127888050912028, 0.19239590976388,
0.089860213448317, 0.207878812767844, 0.123008723913358, 0.186971328016159,
-0.0312, -0.0036, 9e-04, -0.0028, 0.0191, -0.0595, 0.855, 0.0044,
0.0096, -0.0069, 0.0022, 0.0096, -0.0019, 0.0098, -0.0089, 0.0044,
0.0550042953239485, 0.116324916391602, 0.248192158545598, 0.195324695507964,
0.165519875122631, 0.229511991569287, 0.109725224213154, 0.255681180324957,
0.227757912819737, 0.300742759268464, -0.024928, -0.001052, 0.008348,
-0.001036, 0.02596, -0.037548, 1.110388, 0.014004, 0.020576,
0.005056, 0.010824, 0.016852, 0.005548, 0.01764, 0.00776, 0.017728
), .Dim = c(26L, 3L), .Dimnames = list(c("Democracies, High Income",
"Democracies, Middle Income", "Democracies, Low Income", "Dictatorships, High Income",
"Dictatorships, Middle Income", "Dictatorships, Low Income",
"One Transition, Middle Income", "One Transition, Low Income",
"Many Transitions, Middle Income", "Many Transitions, Low Income",
"High Income Democacies:time", "my.new.time.one.transition.low",
"demo.one.time.transit.low.income", "my.new.time.one.transition.middle",
"demo.one.time.transit.middle.income", "maternal_educ", "hiv_prev",
"Democracies, Middle Income:time", "Democracies, Low Income:time",
"Dictatorships, High Income:time", "Dictatorships, Middle Income:time",
"Dictatorships, Low Income:time", "One Transition, Middle Income:time",
"One Transition, Low Income:time", "Many Transitions, Middle Income:time",
"Many Transitions, Low Income:time"), c("low", "mean", "upper"
)))