clmm()
31 カ国で 4 つの変量効果を持つモデルからランダム切片をプロットするのに問題があります。
私はこのSO投稿に従ってみました:Rでは、qqmathまたはdotplotを使用してlmer(lme4パッケージ)からのランダム効果をプロットしています:それをファンシーに見せる方法は?ただし、信頼区間が表示されません。dotchart
国ごとの切片をプロットするために使用することができました。
library(ggplot2)
library(ordinal)
# create data frame with intercepts and variances of all random effects
# the first column are the grouping factor, followed by 5 columns of intercepts,
# columns 7-11 are the variances.
randoms <- as.data.frame(ranef(nodual.logit, condVar = F))
var <- as.data.frame(condVar(nodual.logit))
df <- merge(randoms, var, by ="row.names")
# calculate the CI
df[,7:11] <- (1.96*(sqrt(df[,7:11])/sqrt(length(df[,1]))))
# dot plot of intercepts and CI.
p <- ggplot(df,aes(as.factor(Row.names),df[,2]))
p <- p + geom_hline(yintercept=0) +
geom_errorbar(aes(xmax=df[,2]+df[,7], xmin=df[,2]-df[,7]), width=0, color="black") +
geom_point(aes(size=2))
p <- p + coord_flip()
print(p)
エラー: 連続スケールに離散値が指定されました
それらをプロットしようとした別の方法を次に示します。
D <- dotchart(df[,2], labels = df[,1])
D <- D + geom_errorbarh(aes(xmax=df[,2]+df[,7], xmin=df[,2]-df[,7],))
dotchart(df[, 2], labels = df[, 1]) + geom_errorbarh(aes(xmax = df[, : 二項演算子への非数値引数) のエラー