バイナリ結果変数と連続予測変数の散布図に黄土線を当てはめようとしています。
私が使用しているコードは次のとおりです。
lw1<-loess(y~x, data=df)
plot(y~x, data=df, pch=19, cex=0.1)
lines(df$x, lw1$fitted, col='blue')
そして、これは私が得るグラフです:! https://bitbucket.org/heatherjbaldwin/akos_open/src/ec2a78d093e6cdf988434c03c1b7c7df145892ba/loessgraph1.png?at=master
x変数の順序付けも試みました:
j<-order(df$x)
lines(df$x[j], lw1$fitted, col='blue')
そして、このグラフを取得します: ! https://bitbucket.org/heatherjbaldwin/akos_open/src/ec2a78d093e6cdf988434c03c1b7c7df145892ba/loessgraph2%28ordered_x%29.png?at=master
データは次のとおりです。
どんな助けでも大歓迎です。