# Build a histogram from stochastic data

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.

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

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[

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.
• 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"]. – Henrik Schumacher Aug 31 '18 at 13:16