1
$\begingroup$

I have the following code yielding my stochastic "paths":

a = .3;
μ = .1;
c = .2;
σ = 0.1;
n = 500;
sol2 = RandomFunction[
   ItoProcess[{\[DifferentialD]s[t] == -a s[t] i[
        t] \[DifferentialD]t, \[DifferentialD]i[
        t] == (a s[t] i[t] - μ i[t] + 
          c (1 - s[t] - i[t]) i[t]) \[DifferentialD]t + σ i[
         t] \[DifferentialD]W[t]}, {s[t], i[t]}, {{s, i}, {0.3, 0.7}},
     t, W \[Distributed] WienerProcess[0, 1]], {0, 30, 0.01}, n];

I would like to make two histograms, one related to the variable s[t] and one another related to i[t] (or better, get directly the PDF for the both variables of the process), and then approximate a gaussian curve to this histogram. I've tried a lot and had not success.

Thanks in advance!

$\endgroup$
  • $\begingroup$ I've edited the post, I hope it's clearer now @HenrikSchumacher. $\endgroup$ – Herr Schrödinger Aug 31 '18 at 12:25
  • 1
    $\begingroup$ Maybe Histogram[Transpose[sol2["Values"]]] helps? $\endgroup$ – Henrik Schumacher Aug 31 '18 at 12:30
  • $\begingroup$ @HenrikSchumacher, Yes! Would you mind to make a complete asnwer? I would like to accept this. $\endgroup$ – Herr Schrödinger Aug 31 '18 at 12:32
4
$\begingroup$

When requiring details information for many built in "data types" that are represented graphically by a gray box (e.g., TemporalData or SparseArray), it often helps to inspect their list of properties:

sol2["Properties"]

{"Components", "DateList", "DatePath", "DatePaths", "Dates", "FirstDates", "FirstTimes", "FirstValues", "LastDates", "LastTimes", "LastValues", "Part", "Path", "PathCount", "PathFunction", "PathFunctions", "PathLength", "PathLengths", "Paths", "PathTimes", "SliceData", "SliceDistribution", "TimeList", "Times", "ValueDimensions", "ValueList", "Values"}

The properties "Values" seems promising:

sol2["Values"] // Dimensions

{3001, 2}

So by transposing it, we can make histograms for each of its coordinates:

Histogram[
 Thread[
  Legended[
   Transpose[sol2["Values"]],
   {"s", "i"}
   ]
  ]
 ]

enter image description here

But I am not exactly sure whether this is what you are looking for. In the end, sol2 represents 500 random paths in $\mathbb{R}^2$ with 3001 data points each. But it might give you an idea how to inspect sol2 further.

$\endgroup$
  • $\begingroup$ @HendrikSchumacher, What's presented in the y axis is the absolute frequency? What's in the axis? $\endgroup$ – Herr Schrödinger Aug 31 '18 at 13:12
  • 1
    $\begingroup$ Each of the two lists in Transpose[sol2["Values"]] contains only values between 0. and 0.83 or so. These are on the x-axis. I am not sure anymore whether this answers your question. Probably sol2["DatePaths"] is more interesting to you than sol2["Values"]. $\endgroup$ – Henrik Schumacher Aug 31 '18 at 13:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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