(which means 找一条线尽可能把这两种点分开)
我想的是可以用正确率来评价直线的优劣:
蓝色点数量为n1, 橙色点数量为n2. 一共有N=n1+n2个点。
在某条直线a1上方的蓝色点数量(被直线正确区分的蓝色点的数量)为m1,在a1下方的橙色点(被直线正确区分的橙色点的数量)为m2。
那么直线a1的正确率就是:(m1+m2)/N
我们目标就是找到正确率最大的那条直线。
但是这个要怎么code啊 。。写循环吗?。。
欢迎讨论!!!谢谢!!
上面那幅图是这样画出来的:
lm_male_h=ggplot(data=data1111, aes(x=slope, y=intercept, color=whether_hcc))+
geom_point(aes(color=factor(whether_hcc)),size=0.5)+
xlim(c(-1,5))+
ylim(c(-3,250))+
ggtitle("k and b scatter of male hepc \n with AFP_value as response")
数据见附件
- data1111.csv