[R] How to use depmix for HMM with intial parameters
niharika singhal
niharikasinghal1990 at gmail.com
Wed Sep 20 10:14:34 CEST 2017
Hello,
I have initial parameters for HMM model and I want to use depmixS4 package.
The parameters are in the form
intial_prob_matrix=matrix(c(0.07614213, 0.45177665, 0.47208122), nrow=1,
ncol=3, byrow = TRUE)
transition_matrix=matrix(c(0.46666667,0.46666667,0.06666667,
0.06741573,0.5617978,0.37078652,
0.02173913,0.3478261,0.63043478), nrow = 3, ncol = 3,
byrow = TRUE)
meanval_matrix=matrix(c(545.1737,545.1737,803.5235,
565.7763,673.8019,797.5283,
733.9332,1006.3571,1383.5395), nrow = 3, ncol = 3,
byrow = TRUE)
sigmaval_matrix=matrix(c(82.19592,13.64243,57.07868,
65.32724,13.38910,81.66209,
97.62573,71.09579,115.55612), nrow = 3, ncol = 3,
byrow = TRUE)
coeffval_matrix=matrix(c(0.1295604,0.6464059,0.2240336,
0.2091671,0.5267220,0.2641110,
0.3430697,0.3350215,0.3219088), nrow = 3, ncol =
3, byrow = TRUE)
emission_matrix=list(meanval_matrix,sigmaval_matrix,coeffval_matrix)
powerdf is a column from my dataset which look like something = 19.0, 18.0,
24.0...............it has some 30 thousand rows
I tried using the code below and got an error
mod= depmix( response = power~1, data = powerdf, nstates=3,
instart=intial_prob_matrix,
trstart=transition_matrix, respstart=emission_matrix)
Error in makeResponseModels(response = response, data = data, nstates =
nstates, :
'respstart' has incorrect length, it should be 6
I cannot change my emission matrix, it would always be list of matrix (mean
, sigma and weighted coefficient mixture)
I thought to change the response but I am unable to figure out the right
response
Can someone guide me how can I solve this problem, by giving the
parameters defined above?
Thanks & Regards
Niharika Singhal
[[alternative HTML version deleted]]
More information about the R-help
mailing list