(While using Maple 2015 this question concerns any other Maple versions)
I hesitated on the title to write and my first idea was to write "How to modify a built-in functions without making a mess?".
I finally changed my mind in order not to orient the answers in a wrong way.
So this question is about the construction of multi-variate distributions and concerns only the Statistics package.
Here are some of the attributes of a univariate random variable that Maple recognizes, and it is quite normal to expect that the construction of a multi-variate random variable (MVRV for short) distribution should get, at least, some of them.
X := RandomVariable(Normal(a, b)):
map(a -> printf("%a\n", a), [exports(attributes(X)[3])]):
Conditions
ParentName
Parameters
CharacteristicFunction
CDF
CGF
HodgesLehmann
Mean
Median
MGF
Mode
PDF
RousseeuwCrouxSn
StandardDeviation
Support
Variance
CDFNumeric
QuantileNumeric
RandomSample
RandomSampleSetup
RandomVariate
MaximumLikelihoodEstimate
If the distribution is continuous the PDF is fundamental in the sense it enables constructs all the other statistics (=attributes) of a MVRV.
But it is nice to use integrated functions, such as Mean, Support, PDF, and so on, to get the expressions or values of these statistics instead of computing them from this PDF.
Let's that I prefer doing this
MyNormal := proc(m, v)
description "Reparameterized Normal randomvariable, m=mean, v=variance":
Distribution(
PDF = (t -> exp(-1/2*(x-m)^2/v)/sqrt(2*Pi*v))
, Conditions = [Sigma > 0]
, Mean =m
)
end proc:
X := RandomVariable(MyNormal(mu, Sigma)):
Mean(X)
m
than doing this
MyNormal := proc(m, v)
description "Reparameterized Normal randomvariable, m=mean, v=variance":
Distribution(
PDF = (t -> exp(-1/2*(x-m)^2/v)/sqrt(2*Pi*v))
, Conditions = [Sigma > 0]
)
end proc:
X := RandomVariable(MyNormal(mu, Sigma)):
Mean(X); # of course undefined
mean := int(PDF(X, x), x=-infinity..+infinity) assuming Sigma > 0
undefined
mean := 1
So, while all the statistics can be recover from the CDF (provided it exists), it's nicer to define these statistics within the Distribution structure (as in the first construction above).
Now some problems appear when you want to construct the Distribution structure for a MVRV.
The attached file contains the construction of MVRV whose ecah components are mutually independent (to keep the things simple) and both have a Unifom distribution.
MV_Uniform.mw
Here are some observations:
- Defining a multi-variate PDF goes without problems.
- Defining the Mean (or many other algebraic or numeric statistics) presents a difficulty related to the type of the arguments the build-in function Mean is aimed to recieve.
But a workaround, not very elegant, can be found.
- The case of the Support seems unsolvable: I wasn't able to find any workaround to define the support of a MVRV.
- I did not consider the Conditions attribute, but I'm not sure that, in the case of, let's say, a bi-gaussian random variable I would be capable to set that the variance is a symmetric positive-definite matrix?
I feel like the main restriction to define such MVRV distributions is the types used in the buid-in functions used in the Distribution structure.
Does anyone have an idea to tackle this problem?
Thanks in advance for any suggestion and help.