[R] Markov Model problem
(Ted Harding)
Ted.Harding at manchester.ac.uk
Fri Sep 17 11:30:45 CEST 2010
On 17-Sep-10 08:19:20, Stefan Petersson wrote:
> First, I don't have the correct lingo for this topic, so I can't
> really find a solution for my problem. And maybe I formulate it
> incorrectly, so bear with me.
>
> How would I calculate a 'constant transition matrix' if I know a
> given value at a given time?
>
> Let's say I know that my value is 54,0 at t=12. How do I get the
> initial chain value?
>
> t markov.growth
> 00 00.0
> 01 06.3 <- My value of interest...
> 02 12.1
> 03 17.7
> 04 22.8
> 05 27.7
> 06 32.2
> 07 36.4
> 08 40.4
> 09 44.2
> 10 47.7
> 11 50.9
> 12 54.0 <- These two is what I know...
> 13 56.9
> 14 59.6
> 15 62.1
>
> I can't find out how to do this kind of 'reversed' calulation.
> Maybe there is some library that can do this for me? I know
> that there are a lot of packages covering different aspects
> of Markov Models. But my ignorance prevents me from finding
> out which one.
> TIA
Am I correct to assume that the information you intend to work
from is that (here Y denotes the "markov.growth" variable):
At t = 00, Y = 00.0 (initial state)
At t = 12, Y = 54.0
??
>From this information alone, it is impossible to calculate any
transition matrix for the evolution of the process, without
making some assumption about a generic law of growth.
However, taking the values you have supplied, I can see that:
Y <- c(00.0,06.3,12.1,17.7,22.8,27.7,32.2,36.4,40.4,
44.2,47.7,50.9,54.0,56.9,59.6,62.1)
t.diff<-(0:14)
plot(t.diff,log(diff(Y)))
looks like a very close approximation to a straight line,
with a little random variation. So:
Z <- log(diff(Y))
LM <- lm(Z ~ t.diff)
LM$coeff
# (Intercept) t.diff
# 1.8369463 -0.0650716
And then:
lines(t.diff, 1.8369463 - 0.0650716*t.diff)
shows that the fit is very close, and it looks as though the
random deviations have the same degree of dispersion over time
(though there may be some evidence of serial correlation in these).
Hence one could adopt a model
log(Y[t+1] - Y[t]) = a + b*t.diff + "error"
where a = 1.8369463, b = -0.0650716, or
Y[t+1] = Y[t] + A + B^t
where A = exp(a), B = exp(b). Then, since Y[0] = 0, for t=1,2,...
Y[t] = t*A + B + B^2 + ... B^t
Now, assuming a model *of this form* -- i.e. without knowing the
values of A and B, you could use the (assumed above) information
that Y[0] = 0, Y[12] = 54.0, to solve this for values of A and B.
Then you could evaluate this for your "value of interest" Y[1].
However, incorporation of uncertainties due to the random "error"
between observed values and the fit would be more complicated
(and cannot be done given only the information about Y[0] and Y[12]).
Note that this approach, given only Y[0] and Y[12], depends on
*assuming* a model of the form Y[t+1] = Y[t] + A + B^t, whereas
I was led to suggest this as an approach on the basis of looking
at *all* the values you supplied.
Just thoughts! Probably others can suggest ways of taking this
further, or approaching it differently.
Ted.
--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 17-Sep-10 Time: 10:30:41
------------------------------ XFMail ------------------------------
More information about the R-help
mailing list