Question: FHow can I set the attribute "Parameters" in a user defined Distribution?

Here is a notional example of a user defined  Probability Distribution:

  • One of the "attribute" or "property" (sorry but I don't know the correct word to use) in any known distribution (that is already implemented in Maple) is Parameters: an example is  provided for a Gaussian RV.
     
  • In a first stage I define a simple Distribution named MyDist and declare X as a random variable of distribution MyDist.
     
  • Then I decide to complete the definition of MyDist by adding the "property" Parameters.
    I get an error I don't know how to get rid of.

Does anyone has any idea to fix that ?

PS: I browse the Statistics library to try and understand how this "property" is defined for a known distribution but I couldn't find any clue.

Thanks in advance.

restart

with(Statistics):

G := RandomVariable(Normal(a, b)):

attributes(G)[3]:
exports(%);
(attributes(G)[3]):-Parameters;

Conditions, ParentName, Parameters, CharacteristicFunction, CDF, CGF, HodgesLehmann, Mean, Median, MGF, Mode, PDF, RousseeuwCrouxSn, StandardDeviation, Support, Variance, CDFNumeric, QuantileNumeric, RandomSample, RandomSampleSetup, RandomVariate, MaximumLikelihoodEstimate

 

[a, b]

(1)

MyDist := (mu, Sigma) -> Distribution(Mean=mu, Variance=Sigma):

X := RandomVariable(MyDist(m, V));
(Mean, Variance)(X);

_R1

 

m, V

(2)

MyDist := (mu, Sigma) -> Distribution(Mean=mu, Variance=Sigma, Parameters=[mu, Sigma]):

Y := RandomVariable(MyDist(m, V));

Error, (in Statistics:-Distribution) invalid input: too many and/or wrong type of arguments passed to NewDistribution; first unused argument is Parameters = [m, V]

 

m, V

(3)

 

Download RandomVariable_Parameters.mw

Please Wait...