楼主: lijing8712
14337 52

[问答] 求解二维马尔科夫链 [推广有奖]

11
epoh 发表于 2011-6-10 08:17:47
能否告知底下这些参数你设置多少
w,m,q,p,L
尤其是L

if Conditionally execute statements
似乎跟上次不同了
%%%%%%%%%
for i=0:m1-1
for j=0:m2-1
  for k=0:m1-1
    for l=0:m2-1
     if k==0
         statements 1   
     elseif k~=0
         statements 2     
     end  %end if
     
    end
  end
end
end

%%%%%%%%%%%%%%%%

gamcdf(temp,2,0.5)
为何shape parameter取 2
scale parameter取 0.5

12
lijing8712 发表于 2011-6-10 09:24:56
我的L值是参考文献里面Appendix B里面的那个公式:L=1+5*squre(l/(2-l)*(2/n))参数设置为:w=2*h/2*m1-

其中,n=5  那个gamcdf(x,a,b)
Zt 服从gamma 分布,程序里面我的参数取为:


文献里面St2=∑(X-μ0)2/n; 那么这个a和b的值是不是取为:
这个地方我也不是很明白~~麻烦您再给看一下,谢谢啦!!!


13
epoh 发表于 2011-6-10 12:06:08
则m1=15;m2=15; ARL= 199.5398
   m1=39;m2=39; ARL= 209.8057
与文献相差10左右,还需再CHECK一下
         

14
lijing8712 发表于 2011-6-17 08:40:55
我想再问一下,在这个程序里面,还有那篇Adaptive CUSUM关于均值的文献中,在计算链长时都提到了 Q0 的确定,我想问一下,计算链长的程序和 Q0 的值有关系吗?从程序里面看是没有关系的,难道和 Qt 的取值范围有关?另外,不同的改进 CUSUM 控制图,关于 Qt  的取值范围是不是有计算公式啊?您知道怎么计算的吗?

15
lijing8712 发表于 2011-7-15 16:48:15

。。。

您好!。。。

16
epoh 发表于 2011-7-15 20:02:06
T1=normcdf(temp,0,1);  => T1=normcdf(temp,1,1);

17
lijing8712 发表于 2011-7-18 16:27:11
T1=normcdf(temp,1,1)这个是表示偏移量为1 的时候程序里面该修改的地方吗?如果是计算方差的变动量,比如当方差的变动量为2时,是不是又改为
T1=normcdf(temp,0,2)


我这个计算CUSUM控制图链长的程序是对的吧?谢谢您的指导!!!

18
lijing8712 发表于 2011-7-27 15:22:19
您好!一直麻烦您好久,我想您也是做这方面的研究吧。我现在写论文想写关于方差方面的文章。对于上次向您请教的关于方差的adaptive CUSUM control chart 中,文献里面采用的是St2=∑(X-μ0)2/n ,在这里我采用的对数变换,即
Yt=ln(St2/σ2)
St2=∑(X-μ0)2/n-1
这样计算控制限的程序我把它改写为:
function y=optif(x,ARL0)
m1=15;m2=15;
n=5;
p=x(1);
m=1.1;
w=(2*x(2))/(2*m1-1);


%L=1+5*sqrt(p/(2-p)*(2/n));


L=1;
q=L/m2;
R=zeros(m1*m2,m1*m2);
for i=0:1:m1-1
  for j=0:1:m2-1
    for k=0:1:m1-1
     for l=0:1:m2-1

             end;
         end;
     end;
   end;
PM=0*ones(1,m1*m2);
PM(1)=1;
y=abs(ARL0-PM*inv(eye(m1*m2,m1*m2)-R)*ones(m1*m2,1));


我首先计算控制线,
ARL0=500; x0=[0.1,1.2];  lb=[0.1,1];   ub=[0.1,2];  [x,fval]=fmincon(@(x)optif(x,ARL0),x0,[],[],[],[],lb,ub)
但是不知道为什么区间取为多少总是初始值,为什么得不到优化参数呢?不知道您对这方面了解吗?可以麻烦您帮我看看这个程序吗?又要麻烦您了~~谢谢啦!!

19
epoh 发表于 2011-7-27 21:55:41
lambda 初始值影响不大
ARL0=200; 500;1000;
可设相同0.1,lb=0.05,ub=0.2
但hw初始值影响很大大
请注意我的设置
以13 楼程序而言
求得的值相当理想
%ARL0=200;
x0=[0.1;1.1];  
lb=[0.05;1.0];   
ub=[0.2;1.3];  
[x,fval]=fmincon(@(x)opt(x,ARL0),x0,[],[],[],[],lb,ub)
x =
    0.1336
    1.1587

fval =

  3.9378e-005
%%%%%%%%%%%%%%%%%
ARL0=1000;

x0=[0.1;1.8];  
lb=[0.05;1.7];   
ub=[0.2;1.9];  
[x,fval]=fmincon(@(x)opt(x,ARL0),x0,[],[],[],[],lb,ub)
x =
    0.0800
    1.8846

fval =

  7.6930e-004

%%%%%%%%%%%%%%%%%
ARL0=500;

x0=[0.1;1.5];  
lb=[0.05;1.4];   
ub=[0.2;1.65];  
[x,fval]=fmincon(@(x)opt(x,ARL0),x0,[],[],[],[],lb,ub)

x =
    0.0539
    1.4748

fval =

  3.1012e-007

%%%%%%%%%%%
%%%%%%%%%%%
以18 楼程序而言
求得的值相当离谱
必须重新检查

ARL0=500;
%x0=[0.1;1.2];  
%lb=[0.1;1];   
%ub=[0.1;2];  
x0=[0.1;1.5];  
lb=[0.05;1.4];   
ub=[0.2;1.65];  
[x,fval]=fmincon(@(x)optif(x,ARL0),x0,[],[],[],[],lb,ub)

x =

    0.0500
    1.5000


fval =

  493.8829

%%%%%%%%
%%%%%%%%
为何要采对数变换??

底下这样有对数变换吗?
temp=b1;
u=exp(temp);
T1=gamcdf(u,2,0.5);


%%
Appendix A: Derivation of the CUSUM Dispersion Chart
            S(t)^2 has a gamma distribution with shape parameter
            alpha= n/2 and scale parameter beta=2*sigma^2/n.

你采对数变换,
Yt=ln(S(t)^2/(sigma)^2)
那Yt服从甚么分布??

20
zhangtao 发表于 2011-7-28 09:46:46
19# epoh

epoh老师,您好!
      我用您的方法进行计算,为什么会提示以下错误:

>> %ARL0=200;
x0=[0.1;1.1];  
lb=[0.05;1.0];   
ub=[0.2;1.3];  
[x,fval]=fmincon(@(x)opt(x,ARL0),x0,[],[],[],[],lb,ub)
??? Error: "opt" is not the name of a function nor a variable,
but is used in an anonymous function either at the prompt or in the argument of EVAL.
>> ARL0=1000;
x0=[0.1;1.8];  
lb=[0.05;1.7];   
ub=[0.2;1.9];  
[x,fval]=fmincon(@(x)opt(x,ARL0),x0,[],[],[],[],lb,ub)
??? Error: "opt" is not the name of a function nor a variable,
but is used in an anonymous function either at the prompt or in the argument of EVAL.
>> ARL0=1000;
x0=[0.1;1.8];  
lb=[0.05;1.7];   
ub=[0.2;1.9];  
[x,fval]=fmincon(@(x)opt(x,ARL0),x0,[],[],[],[],lb,ub)
??? Error: "opt" is not the name of a function nor a variable,
but is used in an anonymous function either at the prompt or in the argument of EVAL.
>> %ARL0=200;
x0=[0.1;1.1];  
lb=[0.05;1.0];   
ub=[0.2;1.3];  
[x,fval]=fmincon(@(x)optif(x,ARL0),x0,[],[],[],[],lb,ub)
Warning: Large-scale (trust region) method does not currently solve this type of problem,
switching to medium-scale (line search).
> In fmincon at 260

非常感谢!
数学好就是要天天学

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-26 04:34