Message Boards Message Boards

GROUPS:

Pass starting values in matrix form?

Posted 11 days ago
155 Views
|
3 Replies
|
2 Total Likes
|

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}}?

3 Replies

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 11 days 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?

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.)

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