How do I estimate a state-space model using ParamMap?
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I created an implicit state-space model Md1 with a function ParamMap.
When I use the command EstMd1=estimate(Md1,Y,parms0) where Y is my observed data and params0 is a vector containing my initial values for the unknow state I get the error "Length of the state type vector must agree with the number of states."
Is the bolded command the correct syntax for estimating implicit state-space model?
(note that when I estimate the model by creating the state-space matrices explicitly in the main program it works and so I know that the number of states agrees with the length of the state vector)
function [A,B,C,D,Mean0,Cov0,StateType] = ParamMap(parms0)
var1=exp(parms0(2)); % Positive variance constraint
var2=exp(parms0(3));
A=[1 0; 0 parms0(1)];
C=[1 1];
B=[var1 0;0 var2];
D = [];
Mean0 = 0.5;
Cov0 = 10;
StateType = 0;
end
0 Commenti
Risposte (1)
Shantanu Dixit
il 23 Ago 2024
Hi Ed, the error you are encountering is due to the fact both 'Cov0' and 'StateType' are defined in 'ParamMap'. When implicitly creating a model by specifying 'ParamMap', both 'Cov0' and 'StateType' are empty vectors [ ] and are specified by 'estimate' function after estimation.
Refer to the below sample code
% dummy data
Y = randn(100, 1);
parms0 = [0.9, log(0.1), log(0.2)];
function [A, B, C,D, Mean0, Cov0, StateType] = ParamMap(parms0)
var1 = exp(parms0(2));
var2 = exp(parms0(3));
A = [1 0; 0 parms0(1)];
C = [1 1];
B = [var1 0; 0 var2];
D = [];
Mean0 = [0.5; 0.5];
Cov0 = [];
StateType = [];
end
% Create the implicit state-space model
Md1 = ssm(@ParamMap);
% Estimate the model parameters
EstMd1 = estimate(Md1, Y, parms0);
Refer to the following MathWorks documentation for better understanding:
0 Commenti
Vedere anche
Categorie
Scopri di più su Standard State-Space Model in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!