2
$\begingroup$

Basically I have a process that belongs to a certain state at any point of time. However, the time intervals are not fixed (in fact they are exponentially distributed). Essentially, the data points reflect when the state of the process changes from one value to another. For example, the dataset below illustrates that the process is in state 0 until 2.0199, then it's in state 1 until 3.3544 and so on and so forth.

data={{0.0, 0}, {2.0199, 1}, {3.3544, 0}, {6.2484, 1}, {7.0204, 
  0}, {16.6974, 1}, {17.4653, 0}, {33.1508, 1}, {33.5897, 
  2}, {36.3656, 1}, {48.2725, 2}, {57.1227, 1}, {67.6013, 
  0}, {69.2908, 1}, {72.8626, 0}, {86.6029, 1}, {87.6669, 
  0}, {120.7927, 1}, {122.8568, 0}, {125.4026, 1}, {131.7756, 
  0}, {132.8221, 1}, {135.0257, 0}, {140.9808, 1}, {147.2401, 
  0}, {160.6539, 1}, {162.4473, 0}, {170.9659, 1}, {177.8401, 
  2}, {181.3527, 1}, {195.5088, 0}, {205.4589, 1}, {211.7528, 2}}

In the attempt to analyze this data (distribution, pdf, histograms, mean, variance, mean time when the state is greater than 2), I tried to follow the example on mathematica's website

  RandomFunction[QueueingProcess[3, 5], {0, 15}]
  Histogram[data, Automatic, "PDF"]

However, I found out, (RandomFunction and Histograms) that this histogram is really not representative of time, thus meaningless.

In short, I'm trying to find ways/examples to analyze continuous data. I do have control over the presentation of the input, so if needed, I can change that, I just don't think it would be feasible to break the data down into fixed intervals because, as you would see below some intervals may be 0.002 and others 200.00.

$\endgroup$
  • 1
    $\begingroup$ I think this would be better on Cross Validated, since the question is about appropriate statistical techniques for your problem. $\endgroup$ – rm -rf Nov 2 '14 at 16:54
2
$\begingroup$

I'm not sure if I understand completely what you want but let us show some properties of your data graphically.

The data provided is a list of event data in the format {time instants of transition to another state, the state after transition}

data = {{0.0, 0}, {2.0199, 1}, {3.3544, 0}, {6.2484, 1}, {7.0204, 
    0}, {16.6974, 1}, {17.4653, 0}, {33.1508, 1}, {33.5897, 2}, {36.3656, 
    1}, {48.2725, 2}, {57.1227, 1}, {67.6013, 0}, {69.2908, 1}, {72.8626, 
    0}, {86.6029, 1}, {87.6669, 0}, {120.7927, 1}, {122.8568, 0}, {125.4026, 
    1}, {131.7756, 0}, {132.8221, 1}, {135.0257, 0}, {140.9808, 1}, {147.2401,
     0}, {160.6539, 1}, {162.4473, 0}, {170.9659, 1}, {177.8401, 
    2}, {181.3527, 1}, {195.5088, 0}, {205.4589, 1}, {211.7528, 2}};

First of all let's exhibit graphically the state stransitions of the system

Graphics[{Point /@ data}, PlotRange -> {{-1, 220}, {-0.2, 3}}, Frame -> True, 
 PlotLabel -> "State transitions as a function of time", 
 FrameLabel -> {"time", "state"}, ImageSize -> 700, AspectRatio -> 1/4]

(* 141102_State transistions.jpg *)

enter image description here

Now extract the statistics of permanence in a given state in two steps

1) The function "st" transforms "data" to the format {state, duration in that state}

st[data_] := 
 Table[{data[[i, 2]], data[[i + 1, 1]] - data[[i, 1]]}, {i, 1, 
   Length[data] - 1}]

2) The function "dt" gives the duration times for a given state "s"

dt[s_, data_] := #[[2]] & /@ Select[st[data], #[[1]] == s &]

We can now show the histograms of the duration times in each of the states

dt[0, data]
Histogram[%]

(* Out[84]= {2.0199, 2.894, 9.677, 15.6855, 1.6895, 13.7403, 33.1258, 2.5458, 1.0465, 5.9551, 13.4138, 8.5186, 9.9501} *)

(* 141102_hist_0.jpg *)

enter image description here

dt[1, data]
Histogram[%]

(* Out[86]= {1.3345, 0.772, 0.7679, 0.4389, 11.9069, 10.4786, 3.5718, \
1.064, 2.0641, 6.373, 2.2036, 6.2593, 1.7934, 6.8742, 14.1561, 6.2939} *)

(* 141102_hist_1.jpg *)

enter image description here

In[88]:= dt[2, data]
Histogram[%]

(* Out[88]= {2.7759, 8.8502, 3.5126} *)

(* 141102_hist_2.jpg *)

enter image description here

With more data available the histograms would look nicer. But at least for s=0 and s=1 they show roughly exponential behaviour.

Regards,
Wolfgang

$\endgroup$

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.