简体   繁体   English

概率向量的马尔可夫链转移矩阵

[英]Markov chain transition matrix from vector of probabilities

The complete data.frame overview: 完整的data.frame概述:

'data.frame':   29 obs. of  3 variables:
$ FirmDatum : Date, format: "1982-12-31" "1983-03-31" "1983-06-30" ...
$ fittedSurv: num  0.884 0.839 0.779 0.746 0.817 ...
$ Rating    : chr  "Aa" "Aaa" "B" "Bb" ...

The column fittedSurv contains probabilities and the column Rating corresponds to the probability ( fittedSurv ) at that point in time. fittedSurv包含概率,列Rating对应于该时间点的概率( fittedSurv )。

For Markov chain transition matrix I need additional columns. 对于马尔可夫链转移矩阵,我需要其他列。 Just purely resampling the single column (vector) of probabilities would not do alone. 仅对概率的单列(向量)进行重采样不会单独完成。

What would be the most efficient way as far as inference is concerned? 就推理而言,最有效的方法是什么?
Possible indication as to the correct R package would be sufficient - an example would be a bonus. 关于正确的R包的可能指示就足够了-例如一个奖励。

@Jonathan. @乔纳森 It might well be. 可能是这样。 I suspect however that the probabilities changing over time could be bootstrapped or the vector of probabilities re-sampled so that meaningful columns of probabilities would be created. 但是我怀疑随时间变化的概率可能会被引导,或者概率向量会重新采样,从而创建有意义的概率列。 Something like: 就像是:

A <- data.frame(X=FrameTs$Rating)
B <- data.frame(replicate(20, sample(as.character(A$X), size=100, replace = TRUE)))

The possible solution (which I don't trust) is: 可能的解决方案(我不信任)是:

A <- data.frame(X=FrameTs$Rating)
w <- FrameTs$fittedSurv/sum(FrameTs$fittedSurv)
B <- data.frame(replicate(10, sample(as.character(A$X), size=10, replace = TRUE, prob=w)))

which produces equally weighted matrix given the probabilities: 在给出概率的情况下产生相等加权的矩阵:

   X1 X2 X3 X4 X5 X6 X7 X8 X9 X10
1   A  A  A  A  A  A  B  A  B   B
2   B  A  A  A  A  A  A  A  A   A
3   A  A  A  B  C  A  A  B  B   A
4   A  A  A  A  A  A  A  A  A   A
5   B  A  A  A  B  A  A  A  A   B
6   A  A  B  B  B  A  A  B  A   A
......and so on...

Of course the matrix B size can be extended via replicate(1000, sample(...

Based on this matrix of "probabilities" (ratings) its possible to get Markov transition matrix. 基于此“概率”矩阵(等级),有可能获得马尔可夫转移矩阵。 (package msm etc). (包装msm等)。 The output figures seems to be intuitive and correct but I don't trust this this approach 输出数据似乎是直观且正确的,但我不相信这种方法

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM