1
$\begingroup$

I would like to fit a custom process - a time inhomogeneous 2-state Markov chain, to data. The time inhomogeneity is a result of the transition probabilities varying sinusoidally through time with a periodicity of 1 year. The complete model is shown below:

SelectProb[aVPast_, TrM_] := Module[{tempProb}, tempProb = Switch[aVPast, {1, 0}, TrM[[1, 1]], {0, 1}, TrM[[2, 2]]]]; 

NextStep[aVPast_, TrM_] := Module[{aRand, aProb}, aProb = SelectProb[aVPast, TrM]; 
          aRand = RandomReal[]; If[aRand >= aProb, {1, 1} - aVPast, aVPast]];

TransitionSineMatrix[t_, pdw_, pwd_] := {{1 - pdw (0.5 + 0.5 Sin[2 [Pi] t/365]), pdw (0.5 + 0.5 Sin[2 [Pi] t/365])}, {pwd (0.5 + 0.5 Sin[2 [Pi] t/365]), 1 - pwd (0.5 + 0.5 Sin[2 [Pi] t/365])}}

DiscreteMarkovProcessTimeInHomogeneous[aInitialState_, tMax_] := FoldList[NextStep, aInitialState, 
Array[TransitionSineMatrix[#, pdw, pwd] &, tMax]]

I have tried using FindFit to fit the probabilities $pdw$ and $pwd$, but I seem to run into an issue that there is no explicit time variable in my model.

Does anyone know how I might be able to fit these parameters in Mathematica?

Best,

Ben

$\endgroup$
  • 1
    $\begingroup$ Perhaps it's easier to use NMinimize[] directly $\endgroup$ – Dr. belisarius Feb 12 '15 at 16:12
  • $\begingroup$ @belisarius - ok. Can you do that with a stochastic function though? I can understand that this would work with a deterministic function, but not sure how NMinimize would work. The only thing I can imagine to do is to create a function for the likelihood, then maximize this. However, this will be pretty difficult to implement I imagine. $\endgroup$ – ben18785 Feb 12 '15 at 16:34

Your Answer

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

Browse other questions tagged or ask your own question.