供應商產品不良率計算

場景

    • 某物料分別由 Vendori 所供應。
    • Vendori 物料供應量比例為 Qtyi,ΣQtyi=1。
    • Vendori 供應物料有 Defecti 不良率。

問題

    • 求算各 Vendori 之總不良率為何。

GNU R

# 供應商供料率

VendorSupplyRate <- c(0.65, 0.35)

# 供應商不良率

VendorDefectRate <- c(0.2, 0.5)

# 供應商供料率-不良率積

VendorSupplyDefectRate <- VendorSupplyRate * VendorDefectRate

# 供應商供料率-不良率和

VendorSupplyDefectRateTotal <- sum(VendorSupplyDefectRate)

# 供應商整體不良率

VendorSupplyDefectRateOfAll <- VendorSupplyDefectRate / VendorSupplyDefectRateTotal

print(VendorSupplyDefectRateOfAll)