0
$\begingroup$

I would like to calculate the integral in equation pol[x] if the quantity is positive or negative.

a = 2; l = 1; p = 0.5; r = 0.5;

f[x_, a_, l_] := (l^a*x^(a - 1)*Exp[-l*x])/Gamma[a];

F[x_] := Integrate[f[y, a, l], {y, -Infinity, x}];

psi[x_] := InverseFunction[F[x]];

t = Quantile[GammaDistribution[a, 1/l], p];

tailF[y_, a_, l_] := Integrate[f[y, a, l], {y, x, Infinity}];

pol[u_] := 
 Integrate[((1 - u)^r/(1 - p)^(r + 1) + (1 - u)/(1 - p)^2)*(1/
     f[psi[u], a, l]), {u, p, 1}]
$\endgroup$
2
$\begingroup$

This is an extended comment.

Clear["Global`*"]

Since you know that you are dealing with the GammaDistribution, you should make use of the built-in functions rather than doing multiple integrals.

dist = GammaDistribution[a, 1/l];

To be a valid distribution requires

$Assumptions = DistributionParameterAssumptions[dist]

(* a > 0 && 1/l > 0 *)

f is the PDF

f[x_, a_, l_] = PDF[dist, x] // Simplify[#, x > 0] &

(* (E^(-l x) l^a x^(-1 + a))/Gamma[a] *)

F is the CDF

F[x_, a_, l_] = CDF[dist, x] // Simplify[#, x > 0] &

(* GammaRegularized[a, 0, l x] *)

psi is the InverseCDF

psi[q_, a_, l_] = InverseCDF[dist, q] // Simplify[#, 0 < q < 1] &

(* InverseGammaRegularized[a, 0, q]/l *)

Your t is the same as psi

Assuming[0 < q < 1, psi[q, a, l] == Quantile[dist, q] // Simplify]

(* True *)

tailF is the complement of the CDF

tailF[y_, a_, l_] = 1 - CDF[dist, y] // Simplify[#, y > 0] &

(* 1 - GammaRegularized[a, 0, l y] *)

For your specified parameters

{f[x, a, l], F[x, a, l], psi[q, a, l]} /.
  {a -> 2, l -> 1, p -> 1/2, r -> 1/2} //
 Simplify[#, x > 0 && 0 < q < 1] &

(* {E^-x x, GammaRegularized[2, 0, x], InverseGammaRegularized[2, 0, q]} *)

It is not clear what you are trying to do with pol. u cannot be an argument to pol unless it is restricted to being a Symbol since u is used as the variable of integration. Also, it is unusual to see the PDF as a divisor. If you are trying to do an expectation, you would multiply by the PDF rather than divide. Further, if doing an expectation, you should use the built-in function Expectation.

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.