Found a solution based on R.H.B Christensen (2013) “A Tutorial on fitting Cumulative Link Mixed Models with clmm2 from the ordinal Package” pg. 5.
First plot intercept points for all 31 countries, the add labels using axis()
, then add CI’s using segments()
.
plot(1:31,df[,2], ylim=range(df[,2]), axes =F, ylab ="intercept")
abline(h = 0, lty=2)
axis(1, at=1:31, labels = df[,1], las =2)
axis(2, at= seq(-2,2, by=.5))
for(i in 1:31) segments(i, df[i,2]+df[i,7], i, df[i,2]-df[i, 7])
Can put this code into another loop to plot the Betas of the random effects
for(n in 2:6) plot(1:31,df[,n], ylim=range(df[,n]),axes =F, ylab =colnames(df[n]))+
abline(h = 0, lty=2)+
axis(1, at=1:31, labels = df[,1], las =2)+
axis(2, at= seq(-2,2, by=.5))+
for(i in 1:31) segments(i, df[i,n]+df[i,(n+5)], i, df[i,n]-df[i, (n+5)])