I would like to ask for kind help with a following problem using TransformedDistribution in Mathematica. First here is the beginning of the code, that works:
n = 5;
k = 4;
f1 = OrderDistribution[{UniformDistribution[{0, 1}], n}, k]
f2 = OrderDistribution[{f1, n}, k]
w[v_?NumberQ] := NIntegrate[(v - b2)*PDF[f2, b2], {b2, 0, v}]
b[v_?NumberQ] := v - w[v]
The above code works so far, and getting any evaluated number from function b[v] works as well, for example when I write b[0.5] it gives me a number 0.49981412080261206, which is ok. I will not explain the context, but what I want to do is get a transformed distribution:
f3 := TransformedDistribution[b[v], v \[Distributed] f1]
So I want to transform each point in f1 by the function b[v]. Unfortunately this doesn't work, since when I try to plot pdf of f3 I get an empty graph, also checking the domain of f3 gives me [-inf,+inf], while clearly the domain here should be [0,1], since the basic function f1 is on [0,1], and the transformation is not decreasing each point by more than it's value. In short, there must be something wrong with the way I am using TransformedDistribution in this context. I am guessing the problem arises, because of how the integral limit depends on the parameter itself. I would very much appreciate if I could get any help on how to fix this issue, and how to make it work, so that I can get the transformed distribution.
w[v_] := Integrate[(v - b2)*PDF[f2, b2], {b2, 0, v}, Assumptions -> {0 < v <= 1}] b[v_] := Simplify[v - w[v]]
? $\endgroup$NIntegrate::nlim: b2 = v is not a valid limit of integration. >>
, when trying to plot PDF of f3 $\endgroup$Integrate
(notNIntegrate
). And, you should clear older definitions before redefiningw
andb
(i.e. useClearAll[w,b]
beforew[v_] := ...
. $\endgroup$