# Modele os pagamentos de reivindicações de seguros

Compute o pagamento médio feito por uma empresa de seguros usando uma transformada linear em trecho da distribuição de perda.
 In[1]:= XLossCDF = ((1 - q) + q (1 - E^(-a x))) HeavisideTheta[ x]; Loss\[ScriptCapitalD] = ProbabilityDistribution[{"CDF", LossCDF}, {x, -\[Infinity], \[Infinity]}, Assumptions -> a > 0 && 0 < q < 1]; PayoutFunction[x_] := Piecewise[{{0, x <= d}, {x - d, d < x < s + d}, {s, x >= s + d}}]; g = Plot[PayoutFunction[x] /. {d -> 400, s -> 1000}, {x, 0, 1800}, PlotStyle -> {Thickness[0.01]}, Filling -> Axis, Exclusions -> None]; Payout\[ScriptCapitalD] = TransformedDistribution[PayoutFunction[x], x \[Distributed] Loss\[ScriptCapitalD], Assumptions -> d > 0 && s > 0 && 0 < q < 1 && a > 0]; m = Mean[Payout\[ScriptCapitalD]];
 In[2]:= XFramed[Show[g, ImageSize -> 500, PlotLabel -> Style[Grid[{{"Loss Probability = ", q}, {"Loss Distribution = ", ExponentialDistribution[a]}, {"Deductible = ", d}, {"Benefit Limit = ", s}, {"Mean Claim Payment = ", m}}, BaseStyle -> {FontFamily -> "Verdana"}, Alignment -> {{Right, Left}, Automatic}], FontSize -> 14, Bold]], RoundingRadius -> 10, FrameStyle -> GrayLevel@0.3, FrameMargins -> 10, ImageSize -> 550, Background -> Lighter[LightBrown, 0.3]]
 Out[2]=