1
$\begingroup$

What I want to do is to predict a bunch of parameters using MLEs, and then make a vector of this information. I tried to use the following command:

Table[EstimatedDistribution[
  RandomVariate[ExponentialDistribution[0.1], 5], 
  ExponentialDistribution[a]], {i, 5}]

However, this simply returns a vector as follows:

{ExponentialDistribution[0.0541708], 
 ExponentialDistribution[0.148346], 
 ExponentialDistribution[0.0801585], ExponentialDistribution[0.109], 
 ExponentialDistribution[0.101503]}

But I'm looking for it to instead return:

{0.0541708, 0.148346, 0.0801585, 0.109, 0.101503}

How could I go about pulling out those parameters and placing them in this vector format? Or is there possibly a better in-built function I could be using?

$\endgroup$
1
  • 2
    $\begingroup$ Table[a /. FindDistributionParameters[RandomVariate[ExponentialDistribution[0.1], 5], ExponentialDistribution[a]], {5}]. This is of course in the docs. $\endgroup$ Aug 10, 2016 at 7:48

2 Answers 2

2
$\begingroup$

You can combine this with First:

data = 
 Table[First@
   EstimatedDistribution[
    RandomVariate[ExponentialDistribution[0.1], 5], 
    ExponentialDistribution[a]], {i, 5}]
(* {0.0662656, 0.121466, 0.108902, 0.0871212, 0.0922651} *)
$\endgroup$
2
$\begingroup$

EstimatedDistribution finds the distribution, from which you'd have to extract the parameters. Use FindDistributionParameters instead to obtain the parameters directly:

a /. Table[
  FindDistributionParameters[
   RandomVariate[ExponentialDistribution[0.1], 5], 
   ExponentialDistribution[a]
   ]
  , {i, 5}]

{0.0504677, 0.0848974, 0.0631045, 0.132201, 0.07284}

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.