## 源碼簡介

% Example Script for MS_AR_Simul.m and MS_AR_Fit.m (run it in the same directory - just press f5)

% This script will first simulate a 2 states MS model with some pre defined parameters
% using MS_AR_Sim.m and then fit the model with MS_AR_Fit.m.

% You can change the coefficients for your own flavor

% You'll see that fmincon() is doing a pretty good job estimating the MS
% model (cheers for it!)

clear;

nr=1000;                % Number of observations in simulation
advOpt.distrib='t';     % Distribution to use ('Normal' or 't' - default = 'Normal')
advOpt.std_method=1;    % Method for standard error calculation

Coeff.p=[.9 .2 ; ...    % Transition matrix (this also defines the value of k)
.1 .8 ];       % Each collum of it should sum to 1
% Notes that the transition matrix output for fitting may
% not be exactly equal to this one since the
% the fit function doesn't know which states is
% 1 2, it just tries to find them and
% separate. This means that the pii (prob os staying at state i) can be
% deslocated through the collums, but it
% should respect the structure at Coeff.p

Coeff.C(1,1)= .01;   % Setting up the mean constant at State 1
Coeff.C(1,2)=-.01;   % Setting up the mean constant at State 2

Coeff.v(1,1)= 3;   % Setting up the student distribution parameter at State 1
Coeff.v(1,2)= 5;   % Setting up the student distribution parameter at State 2

Coeff.AR(:,1)=[ .2  .1 -.1];   % Setting up the AR param at State 1 (you can increase/decrease it as wanted)
Coeff.AR(:,2)=[-.5 -.1  .1];   % Setting up the AR param at State 2 (you can increase/decrease it as wanted)

Coeff.Std(1,1)=.02;  % Setting up the standard deviavion at State 1
Coeff.Std(1,2)=.05;  % Setting up the standard deviavion at State 2

ar=size(Coeff.AR,1);    % Number of lags in autoregressive component
k=length(Coeff.p);      % Number of states simulated (according to Coeff.p)

x=Simul_Out.Sim_x;

figure(2);  % Making sure matlab plots both figures
[Spec_Output]=MS_AR_Fit(x,ar,k,advOpt);    % Fitting to get parameters

rmpath('m_Files');

## 本站長期招聘程序代寫高手，歡迎加入華南地區matlab團隊

 想創業卻沒有經驗的人 無論你是否有過網上開店的經驗，都可以隨時聯系在線客服，建立自己獨立的網站 想開網店卻不知道如何入手 淘寶創業成本低而且風險小，如果想開淘寶店的朋友可以聯系在線客服。 想兼職創業，卻不擅長交際與服務的人 在家創業月入5000元。網站程序+百套群發工具+網賺資料+域名+空間+本站終身代理資格，這樣你網賺的條件全具備了。每天3小時管理、推廣、收錢。 缺乏能快速贏利型產品的人 導入多種最新流行營銷軟件+網賺教程，讓入駐者輕松加盟、復制有效成交技巧、快速賺錢。

## 源碼評論評論內容只代表網友觀點，與本站立場無關！

評論摘要(共 0 條，得分 0 分，平均 0 分) 查看完整評論

## 瀏覽說明

* 本站所有源碼全部公開，隨時隨地瀏覽!
* MATLAB軟件如用于商業用途，請購買正版!
* 如果您發現下載鏈接錯誤，請點擊報告錯誤謝謝！
* 站內提供的所有軟件包含破解及注冊碼均是由網上搜集，若侵犯了你的版權利益，敬請來信通知我們!