Message Boards Message Boards

0
|
4729 Views
|
3 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Pass starting values in matrix form?

Posted 5 years ago

Consider the following MWE, where I try to pass starting values to FindDistributionParameters[]:

?=0.1; 
n=2; 
data=RandomVariate[MultivariateTDistribution[{0,0},{{1,?},{?,1}},10],100];
empty?[n_] := Table[Subscript[?f, i], {i, 1, n}];
empty?[n_] := 
  Table[Subscript[?f^(1 + KroneckerDelta[i, j]), 
    Sort[{i, j}]], {i, 1, n}, {j, 1, n}];
fit = FindDistributionParameters[data, 
   MultivariateTDistribution[empty?[n], 
    empty?[n], ?]]; (*THIS WORKS*)

I tried to add starting values to FindDistributionParameters[] as:

p = Flatten[{empty?[n], empty?[n], ?}]
p0 = Flatten[{Mean[data], Covariance[data], 5}]
start1 = {p, p0}\[Transpose]
start2 = Rule @@@ %
start3 = {empty?[n] -> Mean[data], empty?[n] -> Covariance[data] , ? -> 5}

fit = FindDistributionParameters[data, 
   MultivariateTDistribution[empty?[n], 
    empty?[n], ?], start1(*start2, start3*)]; (*THIS DOESN'T WORK*)

However, nothing works.

Also, is it possible to pass only starting values for one of the required parameters, e.g. start4 = {{?, 5}}?

POSTED BY: Fabian Wo
3 Replies
Posted 5 years ago

Change

start1 = {p, p0}\[Transpose]

to

start1 = DeleteDuplicates[{p, p0}\[Transpose]]

and your code will likely work. What's happening is that the off-diagonal terms are in start1 twice. (You might also need to raise the maximum number of iterations depending on the actual data.)

POSTED BY: Jim Baldwin
Posted 5 years ago

Thanks for your comment, maybe I did not clarify enough: The version without starting values works for me, however, the one that includes "start" does not. Did you test the last line of code?

POSTED BY: Fabian Wo

Have you tried removing the final semicolon at the end of the last line of code? If I remove it, I get an answer. The semicolon suppresses the display of the output.

POSTED BY: Gianluca Gorni
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract