ich möchte die Beschriftung der Achse in folgendem Beispiel ändern. Anstatt 0,1,2,3,4,5 möchte ich dort die entsprechenden Modelnamen "crude", "direct", "total", "bias1"... stehen haben. Wie mache ich das? Kann mir jemand helfen?
Außerdem möchte ich gerne eine Legendenbeschriftung für die rote Linie mit "true causal effect"
Code: Alles auswählen
## Illustrating causal estimates --------------------------------------------------
# This function add points with confidence interval to an existing plot
add_estimate <- function(model, xpos) {
# Estimate for causal effect
estimate <- model$coefficients['dat$ZSpAttAnx_Emp']
# It's 95 % CI
ci <- confint(model)['dat$ZSpAttAnx_Emp',]
# Draw CI in plot
arrows(x0 = xpos, x1 = xpos, y0 = ci[1], y1 = ci[2],
length = 0.05, angle = 90, code = 3)
# Draw point
points(xpos, estimate, pch = 16, bg = 'grey')
}
# Make plot
plot(0, xlim = c(0, 5), ylim = c(0.4, 0.8), pch = '', xlab = 'Model',
ylab = 'Causal estimate', main=" quality of prediction models \n burnout employees",)
# Add line at direct causal effect
lines(c(-1, 6), c(0.5, 0.5), lty = 5, col = 'red')
# Use function to add data points and error bars (95 % CIs)
add_estimate(crude, 0)
add_estimate(direct, 1)
add_estimate(total, 2)
add_estimate(bias1, 3)
add_estimate(bias2, 4)
add_estimate(bias3, 5)