0
$\begingroup$

I have this exponential function, where j is unknown. How can I plot the variance function for $k= 0.1, \; 1, \;10$

$$f_{j,k}(y)=\frac{\sqrt{j}}{\sqrt{2 \pi}}e^{\sqrt{jk}}y^{-\frac{1}{2}} \text{exp}\left( -\frac{1}{2} (j y + \frac{k}{y}) \right) \quad \quad y>0$$

$\endgroup$
1
  • $\begingroup$ Please at least write your function in Mathematica syntax. And if possible, tell us what have you tried. $\endgroup$ Nov 29, 2013 at 20:11

1 Answer 1

4
$\begingroup$

Assuming that given function is a PDF of a distribution:

f[y_, j_, k_] := Sqrt[j]/Sqrt[2 Pi] Exp[Sqrt[j k]]/Sqrt[y] Exp[-(1/2) (j y + k/y)];

You can create an object that will represent your distribution:

distr = ProbabilityDistribution[{"PDF", f[y, j, k]}, {y, 0, Infinity}, 
                                               Assumptions -> (j > 0 && k > 0)];

And now you can calculate anything you want:

Variance[distr]
(*(2 + Sqrt[j k])/j^2*)
Mean[distr]
(*Mean[distr]*)
CentralMoment[distr, 3]
(*(8 + 3 Sqrt[j k])/j^3*)
$\endgroup$
7
  • $\begingroup$ Great! But how will you plot the variance function from here?? $\endgroup$ Nov 30, 2013 at 8:19
  • $\begingroup$ Sorry, I don't know what is "variance function". If you tell me I will try to help. $\endgroup$ Nov 30, 2013 at 8:29
  • $\begingroup$ The Variance[distr] is the variance function. However, I found out how to do it. Very simple of course. Thank you for the help. Problem solved. $\endgroup$ Nov 30, 2013 at 8:45
  • $\begingroup$ @Karnov Sergey I have some few close related questions related to this topic. Can we start a chat, or email conversation? This was very helpful for me. $\endgroup$ Nov 30, 2013 at 8:51
  • $\begingroup$ @JensJensen I think if you have another question you better post it here. Another users probably will find it useful. $\endgroup$ Nov 30, 2013 at 9:43

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.