【发布时间】:2018-04-02 19:55:40
【问题描述】:
我有 data.frame 具有数字列金额和分类列欺诈的对象:
amount <- [60.00, 336.38, 119.00, 115.37, 220.01, 60.00, 611.88, 189.78 ...]
fraud <- [1,0,0,0,0,0,1,0, ...]
我想将伽马分布拟合到数量,但要通过factor(fraud) 绘制它。
我想要一个图表,它将向我显示 2 种不同颜色的 2 条曲线,以区分这 2 组(欺诈/非欺诈组)。
这是我到目前为止所做的:
fit.gamma1 <- fitdist(df$amount[df$fraud == 1], distr = "gamma", method = "mle")
plot(fit.gamma1)
fit.gamma0 <- fitdist(df$amount[df$fraud == 0], distr = "gamma", method = "mle")
plot(fit.gamma0)
我使用了这个参考: How would you fit a gamma distribution to a data in R?
【问题讨论】:
标签: r statistics