[R] fitting Markov chains
(Ted Harding)
Ted.Harding at nessie.mcc.ac.uk
Wed Oct 1 18:49:21 CEST 2003
On 01-Oct-03 Tamas Papp wrote:
> I need to find a computationally simple process for the movement of
> interest rates. In this simplified model, an interest rate can have
> 3--5 possible values, and its movement is characterized by a matrix of
> transition probabilities (ie, it is a Markov process).
>
> I would like to estimate this process from a given set of data.
>
> For example, let the interest rate time series be:
> 7 3 8 2 5 9 6
> Assume that the discretized variable can take the following values:
> (3, 5, 8), then we find the nearest discrete point and give its index:
> 3 1 3 1 2 3 2
> Then estimate the transition probabilities.
>
> I have the following questions:
> - how should I select the discrete set of values that the variable can
> assume? Eg simply get the maximum and minimum, and divide this
> interval into, say, three pieces? Or estimate the mean, and make the
> other two values mean plus-minus one standard deviation?
I would suggest dividing the interval, trying to get equal numbers
in each interval. If (e.g. because the originals are discrete)
this can't quite be done, try to find an similar arrangement which
maximises the minimum count.
> - once the variable is discretized, how do I transform each data point
> to its discretized value (its index)?
? Something like
a<-c(0,1,2,3,4);b<-c(1,2,3,4,5)
x<-3.5;which((a<x)&(x<=b))
[1] 4
x<-1.5;which((a<x)&(x<=b))
[1] 2
> - the most important: how should I estimate the transition
> probabilities?
Most simply as Nij/Ni. where Ni. is the number of times the system
has been in state i, and Nij is the number of transitions from i to j.
Statistical properties of even this estimator can be a bit elusive
because the "sample sizes" Ni. are random; the above recommendation
about how to select intervals will probably help on this front.
Also, after grouping the system is no longer a Markov Chain (even
assuming it really was in the first place) since the probability
of transition from i to j will depend somewhat on which member within i
was arrived at, and this will depend (though hopefullly not much)
on where it was before. By refining your grouping you can diminish
this effect, though you will also reduce the Ni. and hence the
quality of estimation.
To discuss such issues one really need to know more about your data,
in particular how long the series are, what groupings are you thinking
of, and how the series behave.
Also, you don't seem to be thinking about trends, cycles etc. ...
Ted.
--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at nessie.mcc.ac.uk>
Fax-to-email: +44 (0)870 167 1972
Date: 01-Oct-03 Time: 17:49:21
------------------------------ XFMail ------------------------------
More information about the R-help
mailing list