如何在散点图中使用简单的置换回归(lmp; aovp)线(ggplot)

时间:2015-09-09 13:35:49

标签: r plot ggplot2 permutation regression

我想问一下如何在散点图(ggplot)中使用简单的置换回归线(lmp,aovp),而不是非置换回归线(lm)。

这是我的代码:

colorpal <- brewer.pal(10, "Paired")
x = density_2$Rych_D
y = density_2$PK_DC
group = density_2$Group
df = data.frame(x=x,y=y,group=factor(group))
df_ell = data.frame()
for(g in levels(df$group)){df_ell = rbind(df_ell,cbind(as.data.frame(with(df[df$group==g,],ellipse(cor(x,y),scale=c(sd(x),sd(y)),centre=c(mean(x),mean(y))))),group=g))}
ggplot(data=df, aes(x=x, y=y,colour=group)) + geom_point() + geom_smooth(method=lm, se=FALSE) + geom_path(data=df_ell, aes(x=x, y=y,colour=group))+scale_colour_manual(values=colorpal)+theme_classic()

我尝试在geom_smooth(method =)中使用函数lmp而不是lm但是我发生了以下错误: qr.Q中的错误(z $ qr,complete = TRUE):参数不是QR分解并且回归线从图中消失。

0 个答案:

没有答案