|
利用一组数据估计其分布函数参数时出错,请高手指教估计的正确方法和结果,谢谢!
本帖是https://bbs.pinggu.org/thread-1137305-1-1.html的后续工作。
原始数据:
-0.8428
| -0.7903
| -0.786
| -0.7825
| -0.7825
| -0.7778
| -0.7578
| -0.7547
| -0.7422
| -0.7264
| -0.7263
| -0.7245
| -0.7222
| -0.7189
| -0.7043
| -0.7039
| -0.6994
| -0.6971
| -0.6864
| -0.6828
| -0.6744
| -0.6729
| -0.669
| -0.6648
| -0.6624
| -0.6434
| -0.6431
| -0.6417
| -0.6417
| -0.6398
| -0.63608
| -0.6255
| -0.6232
| -0.6229
| -0.6224
| -0.6219
| -0.6203
| -0.6174
| -0.6028
| -0.6014
| -0.5956
| -0.5942
| -0.5939
| -0.58018
| -0.5612
| -0.5562
| -0.551
| -0.5268
| -0.4995
| -0.4917
| -0.4804
| -0.4509
| -0.4151
| -0.4036
| -0.3771
| -0.3657
| -0.2723
| -0.2492
| -0.2403
| -0.1981
| -0.1622
| -0.1271
| -0.0972
| -0.0928
| -0.086
| -0.0826
| -0.0741
| -0.0685
| -0.0671
| -0.0616
| -0.0517
| -0.0503
| -0.0493
| -0.0476
| -0.0456
| -0.0417
| -0.0415
| -0.0267
| -0.0222
| -0.0199
| -0.0191
| -0.0164
| -0.0151
| -0.0118
| -0.0073
| -0.0035
| -0.0031
| -0.0026
| -0.0023
| -0.0012
| -0.0004
| 0.008
| 0.008348
| 0.0092
| 0.0099
| 0.012
| 0.0123
| 0.0124
| 0.0145
| 0.0146
| 0.0148
| 0.0187
| 0.0207
| 0.0217
| 0.0228
| 0.023
| 0.0239
| 0.0244
| 0.0246
| 0.0253
| 0.0268
| 0.0273
| 0.0293
| 0.03
| 0.031
| 0.0319
| 0.0337
| 0.0349
| 0.0355
| 0.0358
| 0.037
| 0.0388
| 0.0388
| 0.0419
| 0.042
| 0.0422
| 0.044
| 0.0446
| 0.045
| 0.045
| 0.0492
| 0.0502
| 0.0506
| 0.0515
| 0.0516
| 0.0529
| 0.055
| 0.0564
| 0.0584
| 0.0591
| 0.0594
| 0.0595
| 0.0597
| 0.0637
| 0.0646
| 0.0656
| 0.0685
| 0.0686
| 0.0686
| 0.0737
| 0.0756
| 0.0759
| 0.0778
| 0.0798
| 0.0821
| 0.085
| 0.0859
| 0.0879
| 0.0885
| 0.0906
| 0.0919
| 0.0938
| 0.0984
| 0.099
| 0.0994
| 0.1008
| 0.1022
| 0.103
| 0.1062
| 0.1065
| 0.1126
| 0.1134
| 0.1175
| 0.1232
| 0.1346
| 0.1362
| 0.1373
| 0.1729
| 0.1736
| 0.1779
| 0.1782
| 0.2139
| 0.2168
| 0.2333
| 0.3126
| 0.3148
| 0.3178
| 0.3178
| 运行过程:
>> clear
>> mixedpdf=@(x,mu1,mu2,s1,s2,rho)(rho*normpdf(x,mu1,s1)+(1-rho)*normpdf(x,mu2,s2))
fnegpdf=@(x,k0,k1,lamda,mu1,mu2,s1,s2,rho)((1-k0*exp(k1*x))* mixedpdf(x,mu1,mu2,s1,s2,rho))
fpospdf=@(x,k0,k1,lamda,mu1,mu2,s1,s2,rho)(lamda*exp(-lamda*x)*(rho*k0* normcdf((-mu1-k1*s1^2)/s1)*exp(mu1*k1+s1^2*k1^2/2)+(1-rho)*k0*normcdf((-mu2-k1*s2^2)/s2)*exp(mu2*k1+s2^2*k1^2/2))+ mixedpdf(x,mu1,mu2,s1,s2,rho))
roepdf=@(x)fnegpdf.*(x<0)+fpospdf.*(x>=0)
mixedpdf =
@(x,mu1,mu2,s1,s2,rho)(rho*normpdf(x,mu1,s1)+(1-rho)*normpdf(x,mu2,s2))
fnegpdf =
@(x,k0,k1,lamda,mu1,mu2,s1,s2,rho)((1-k0*exp(k1*x))* mixedpdf(x,mu1,mu2,s1,s2,rho))
fpospdf =
@(x,k0,k1,lamda,mu1,mu2,s1,s2,rho)(lamda*exp(-lamda*x)*(rho*k0* normcdf((-mu1-k1*s1^2)/s1)*exp(mu1*k1+s1^2*k1^2/2)+(1-rho)*k0*normcdf((-mu2-k1*s2^2)/s2)*exp(mu2*k1+s2^2*k1^2/2))+ mixedpdf(x,mu1,mu2,s1,s2,rho))
roepdf =
@(x)fnegpdf.*(x<0)+fpospdf.*(x>=0)
>> [phat1,pci1]=mle(gap_roe,'pdf',roepdf,'start',[.9,25,120,-0.6315,0.0410,0.1135,0.0929,0.3012])
??? Error using ==> stats\private\mlecustom>checkFunErrs
The following error occurred while trying to evaluate
the user-supplied pdf function '@(x)fnegpdf.*(x<0)+fpospdf.*(x>=0)':
Error using ==> @(x)fnegpdf.*(x<0)+fpospdf.*(x>=0)
Too many input arguments.
Error in ==> stats\private\mlecustom at 159
checkFunErrs('pdf',pdfFun,start,uncensData,[],[],pdfAddArgs);
Error in ==> mle at 219
[phat, pci] = mlecustom(data,varargin{:});
附件1为主要的推导过程(其中α在实际估计时取为0),最终要估计(5)式中的参数。
附件2为参考文献:王亚平,吴联生,白云霞,2005,中国上市公司盈余管理的频率与幅度,经济研究,2005年 12期
所有公式推导均引自参考文献第三部分。 |