Dear R buddies, Recently, I attempt to model the US/RMB Exchange rate log-return time series with a *Hidden Markov model (first order Markov Chain & mixed Normal distributions). * I have applied the RHmm package to accomplish this task, but the results are not so satisfying. So, I would like to try a *Bayesian method *for the parameter estimation of the Hidden Markov model. Could anyone kindly tell me which R package can perform Bayesian estimation of the model? Many thanks for your help and time. Best Regards, James Allan -- View this message in context: http://r.789695.n4.nabble.com/Bayesian-Hidden-Markov-Models-tp4423946p4423946.html Sent from the R help mailing list archive at Nabble.com.
Bayesian Hidden Markov Models
7 messages · monkeylan, Oscar Rueda
Dear James, Although designed for the analysis of copy number CGH microarrays, RJaCGH uses a Bayesian HMM model. Cheers, Oscar
On 27/2/12 08:32, "monkeylan" <lanjinchi at yahoo.com.cn> wrote:
Dear R buddies, Recently, I attempt to model the US/RMB Exchange rate log-return time series with a *Hidden Markov model (first order Markov Chain & mixed Normal distributions). * I have applied the RHmm package to accomplish this task, but the results are not so satisfying. So, I would like to try a *Bayesian method *for the parameter estimation of the Hidden Markov model. Could anyone kindly tell me which R package can perform Bayesian estimation of the model? Many thanks for your help and time. Best Regards, James Allan -- View this message in context: http://r.789695.n4.nabble.com/Bayesian-Hidden-Markov-Models-tp4423946p4423946. html Sent from the R help mailing list archive at Nabble.com.
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Oscar M. Rueda, PhD.
Postdoctoral Research Fellow, Breast Cancer Functional Genomics.
Cancer Research UK Cambridge Research Institute.
Li Ka Shing Centre, Robinson Way.
Cambridge CB2 0RE
England
NOTICE AND DISCLAIMER
This e-mail (including any attachments) is intended for ...{{dropped:16}}
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20120227/dd7ceab2/attachment.pl>
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20120227/5744f4b8/attachment.pl>
Dear James, Basically you just need the values (y) and the positions (in your case it would be the index of the times series). The chromosome argument does not apply to your case so it can be a vector of ones. If the positions are at the same distance between (equally spaced) then the model will be homogeneous. So for example something like this would be enough:
library(RJaCGH) y <- c(rnorm(100,0,1), rnorm(20, 2, 1), rnorm(50, 0, 1)) Pos <- 1:length(y) Chrom <- rep(1, length(y)) res <- RJaCGH(y=y, Pos=Pos, Chrom=Chrom) summary(res)
However, it uses a Reversible Jump algorithm and therefore jumps between models with different hidden states. I would suggest you take a look at the vignette that comes with the package or the paper that is referenced there for specific details of the model it fits. Hope it helps, Oscar
On 28/2/12 04:52, "monkeylan" <lanjinchi at yahoo.com.cn> wrote:
Dear Doctor Oscar, Sorry for not noticing that you are the author of the RJaCGH package. But I noticed that hidden Markov model in your package is with non-homogeneous transition probabilities. Here in my work, the HMM is just a first-order homogeneous Markov chain, i.e. the transition matrix is constant. So, Could you please tell me how can I adjust the R functions in your package to implement my analysis? Best Regards, James Allan --- 12?2?27????, Oscar Rueda [via R] <ml-node+s789695n4424152h18 at n4.nabble.com> ??? ???: Oscar Rueda [via R] <ml-node+s789695n4424152h18 at n4.nabble.com> ??: Re: Bayesian Hidden Markov Models ???: "monkeylan" <lanjinchi at yahoo.com.cn> ??: 2012?2?27?,??,??6:05 Dear James, Although designed for the analysis of copy number CGH microarrays, RJaCGH uses a Bayesian HMM model. Cheers, Oscar On 27/2/12 08:32, "monkeylan" <[hidden email]> wrote:
Dear R buddies, Recently, I attempt to model the US/RMB Exchange rate log-return time series with a *Hidden Markov model (first order Markov Chain & mixed Normal distributions). * I have applied the RHmm package to accomplish this task, but the results are not so satisfying. So, I would like to try a *Bayesian method *for the parameter estimation of the Hidden Markov model. Could anyone kindly tell me which R package can perform Bayesian estimation of the model? Many thanks for your help and time. Best Regards, James Allan -- View this message in context:
http://r.789695.n4.nabble.com/Bayesian-Hidden-Markov-Models-tp4423946p4423946>> .
html Sent from the R help mailing list archive at Nabble.com.
______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Oscar M. Rueda, PhD.
Postdoctoral Research Fellow, Breast Cancer Functional Genomics.
Cancer Research UK Cambridge Research Institute.
Li Ka Shing Centre, Robinson Way.
Cambridge CB2 0RE
England
NOTICE AND DISCLAIMER
This e-mail (including any attachments) is intended for ...{{dropped:16}}
______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. If you reply to this email, your message will be added to the discussion below:http://r.789695.n4.nabble.com/Bayesian-Hidden-Markov-Models-tp4423946p44 24152.html To unsubscribe from Bayesian Hidden Markov Models, click here. NAML -- View this message in context: http://r.789695.n4.nabble.com/Bayesian-Hidden-Markov-Models-tp4423946p4427000. html Sent from the R help mailing list archive at Nabble.com. [[alternative HTML version deleted]]
Oscar M. Rueda, PhD. Postdoctoral Research Fellow, Breast Cancer Functional Genomics. Cancer Research UK Cambridge Research Institute. Li Ka Shing Centre, Robinson Way. Cambridge CB2 0RE England NOTICE AND DISCLAIMER This e-mail (including any attachments) is intended for the above-named person(s). If you are not the intended recipient, notify the sender immediately, delete this email from your system and do not disclose or use for any purpose. We may monitor all incoming and outgoing emails in line with current legislation. We have taken steps to ensure that this email and attachments are free from any virus, but it remains your responsibility to ensure that viruses do not adversely affect you. Cancer Research UK Registered in England and Wales Company Registered Number: 4325234. Registered Charity Number: 1089464 and Scotland SC041666 Registered Office Address: Angel Building, 407 St John Street, London EC1V 4AD.
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20120228/42f168d6/attachment.pl>
Dear James, The distances are normalized between zero and 1, so in your case all of them will be zero. You can check that with
res$Dist.for.model
And do
Q.NH(summary(res)[[1]]$beta, x=0)
To obtain the common transition matrix. Cheers, Oscar
On 29/2/12 03:59, "monkeylan" <lanjinchi at yahoo.com.cn> wrote:
Dear Oscar,
I am extremely grateful to your help and detailed explanation of the use of
RJaCGH package.
But, when runing the sample codes you listed, another issue I am a little
confused is as following:
After runing summary(res), I have got the estimation of the random matrix
Beta:
Parameters of the transition functions:
Normal Gain
Normal 0.000 4.258
Gain 2.001 0.000
But, the transition probabilty matrix Q based on the aboving Beta is more
concerned in my modeling.
Here, I am not sure how can I get the matrix Q. I did try the Q.NH
functions.However, Shoud I set the distance parameter x be 1 or 0? I am not
sure.
If 1( according to my own understanding), the following result seems not
reseanable.
tran<-matrix(c(0,2.001,4.528,0),2,2)
Q.NH(beta=tran, x=1)
[,1] [,2]
[1,] 0.5 0.5
[2,] 0.5 0.5
Many thanks for your further help and time.
James Allan
--- 12?2?28????, Oscar Rueda [via R]
<ml-node+s789695n4427760h66 at n4.nabble.com> ???
???: Oscar Rueda [via R] <ml-node+s789695n4427760h66 at n4.nabble.com>
??: Re: Bayesian Hidden Markov Models
???: "monkeylan" <lanjinchi at yahoo.com.cn>
??: 2012?2?28?,??,??7:02
Dear James,
Basically you just need the values (y) and the positions (in your case it
would be the index of the times series). The chromosome argument does not
apply to your case so it can be a vector of ones.
If the positions are at the same distance between (equally spaced) then the
model will be homogeneous.
So for example something like this would be enough:
library(RJaCGH) y <- c(rnorm(100,0,1), rnorm(20, 2, 1), rnorm(50, 0, 1)) Pos <- 1:length(y) Chrom <- rep(1, length(y)) res <- RJaCGH(y=y, Pos=Pos, Chrom=Chrom) summary(res)
However, it uses a Reversible Jump algorithm and therefore jumps between models with different hidden states. I would suggest you take a look at the vignette that comes with the package or the paper that is referenced there for specific details of the model it fits. Hope it helps, Oscar On 28/2/12 04:52, "monkeylan" <[hidden email]> wrote:
Dear Doctor Oscar, Sorry for not noticing that you are the author of the RJaCGH package. But I noticed that hidden Markov model in your package is with non-homogeneous transition probabilities. Here in my work, the HMM is just a first-order homogeneous Markov chain, i.e. the transition matrix is constant. So, Could you please tell me how can I adjust the R functions in your package to implement my analysis? Best Regards, James Allan --- 12?2?27????, Oscar Rueda [via R] <[hidden email]> ??? ???: Oscar Rueda [via R] <[hidden email]> ??: Re: Bayesian Hidden Markov Models ???: "monkeylan" <[hidden email]> ??: 2012?2?27?,??,??6:05 Dear James, Although designed for the analysis of copy number CGH microarrays, RJaCGH uses a Bayesian HMM model. Cheers, Oscar On 27/2/12 08:32, "monkeylan" <[hidden email]> wrote:
Dear R buddies, Recently, I attempt to model the US/RMB Exchange rate log-return time series with a *Hidden Markov model (first order Markov Chain & mixed Normal distributions). * I have applied the RHmm package to accomplish this task, but the results are not so satisfying. So, I would like to try a *Bayesian method *for the parameter estimation of the Hidden Markov model. Could anyone kindly tell me which R package can perform Bayesian estimation of the model? Many thanks for your help and time. Best Regards, James Allan -- View this message in context: http://r.789695.n4.nabble.com/Bayesian-Hidden-Markov-Models-tp4423946p442394 6>>
.
html Sent from the R help mailing list archive at Nabble.com.
______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Oscar M. Rueda, PhD.
Postdoctoral Research Fellow, Breast Cancer Functional Genomics.
Cancer Research UK Cambridge Research Institute.
Li Ka Shing Centre, Robinson Way.
Cambridge CB2 0RE
England
NOTICE AND DISCLAIMER
This e-mail (including any attachments) is intended for ...{{dropped:16}}
______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. If you reply to this email, your message will be added to the discussion
below:http://r.789695.n4.nabble.com/Bayesian-Hidden-Markov-Models-tp4423946p4>> 4
24152.html To unsubscribe from Bayesian Hidden Markov Models, click here. NAML -- View this message in context:
http://r.789695.n4.nabble.com/Bayesian-Hidden-Markov-Models-tp4423946p4427000>> .
html
Sent from the R help mailing list archive at Nabble.com.
[[alternative HTML version deleted]]
Oscar M. Rueda, PhD. Postdoctoral Research Fellow, Breast Cancer Functional Genomics. Cancer Research UK Cambridge Research Institute. Li Ka Shing Centre, Robinson Way. Cambridge CB2 0RE England NOTICE AND DISCLAIMER This e-mail (including any attachments) is intended for the above-named person(s). If you are not the intended recipient, notify the sender immediately, delete this email from your system and do not disclose or use for any purpose. We may monitor all incoming and outgoing emails in line with current legislation. We have taken steps to ensure that this email and attachments are free from any virus, but it remains your responsibility to ensure that viruses do not adversely affect you. Cancer Research UK Registered in England and Wales Company Registered Number: 4325234. Registered Charity Number: 1089464 and Scotland SC041666 Registered Office Address: Angel Building, 407 St John Street, London EC1V 4AD.
______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. If you reply to this email, your message will be added to the discussion below:http://r.789695.n4.nabble.com/Bayesian-Hidden-Markov-Models-tp4423946p44 27760.html To unsubscribe from Bayesian Hidden Markov Models, click here. NAML -- View this message in context: http://r.789695.n4.nabble.com/Bayesian-Hidden-Markov-Models-tp4423946p4430489. html Sent from the R help mailing list archive at Nabble.com. [[alternative HTML version deleted]]
Oscar M. Rueda, PhD. Postdoctoral Research Fellow, Breast Cancer Functional Genomics. Cancer Research UK Cambridge Research Institute. Li Ka Shing Centre, Robinson Way. Cambridge CB2 0RE England NOTICE AND DISCLAIMER This e-mail (including any attachments) is intended for the above-named person(s). If you are not the intended recipient, notify the sender immediately, delete this email from your system and do not disclose or use for any purpose. We may monitor all incoming and outgoing emails in line with current legislation. We have taken steps to ensure that this email and attachments are free from any virus, but it remains your responsibility to ensure that viruses do not adversely affect you. Cancer Research UK Registered in England and Wales Company Registered Number: 4325234. Registered Charity Number: 1089464 and Scotland SC041666 Registered Office Address: Angel Building, 407 St John Street, London EC1V 4AD.