Assume a simple Markov chain with the transition matrix.

```
n = 9;
matrix = table[Piecewise[{{-c[i], Y[i == j, i < n]}, {c[i], i + 1 == j}, {0, True}}], {i, n}, {j, n}];
matrix // MatrixForm
```

and the starting point

```
ini[start_] : = Table[If[i == start, 1, 0], {i, n}];
```

Does it look like this

```
P[ini_] : = ContinuousMarkovProcess[ini, matrix];
Graphic[P[ini[1]]]
```

Now we execute this Markov chain repeatedly for random times, starting in random stages.

```
values = table[do[c[do[c[i] -> 10 + Mod[i, 3], {In 1}];
simulation[start_, t_] : = Normal[RandomFunction[P[ini[start]]/. values, {0, t}]][[1, -1, 2]];
run = 100;
dat = table[ Module[{start = RandomInteger[{1, 3}], t = RandomReal[{.1, .4}]}, {t, {start, simulation[start, t]}}], careers];
```

For each data point, the first element is the time of the simulation and the second elements are the initial and final stages.

```
dat[[1 ;; 5]]{{0.22866, {2, 5}}, {0.252981, {2, 4}}, {0.291232, {2, 6}}, {0.370085, {1, 6}}, {0.103945, {1, 2}} }
```

Is there an efficient way to adjust the parameters c[i] to this data?