資源簡介
matlab下的冪律擬合函數
先構造函數 然后驗證是否擬合效果好
代碼片段和文件信息
function?[pgof]=plpva(x?xmin?varargin)
%?PLPVA?calculates?the?p-value?for?the?given?power-law?fit?to?some
%?data.計算了P值?實現數據和冪率分布的擬合
%????Source:?http://www.santafe.edu/~aaronc/powerlaws/
%?
%????PLPVA(x?xmin)?takes?data?x?and?given?lower?cutoff?for?the?power-law
%????behavior?xmin?and?computes?the?corresponding?p-value?for?the
%????Kolmogorov-Smirnov?test?according?to?the?method?described?in?
%????Clauset?Shalizi?Newman?(2007).函數xmin指的是截斷位置
%????PLPVA?automatically?detects?whether?x?is?composed?of?real?or?integer
%????values?and?applies?the?appropriate?method.?For?discrete?data?if
%????min(x)?>?1000?PLPVA?uses?the?continuous?approximation?which?is?
%????a?reliable?in?this?regime.
%???
%????The?fitting?procedure?works?as?follows:
%????1)?For?each?possible?choice?of?x_min?we?estimate?alpha?via?the?
%???????method?of?maximum?likelihood?and?calculate?the?Kolmogorov-Smirnov
%???????goodness-of-fit?statistic?D.
%????2)?We?then?select?as?our?estimate?of?x_min?the?value?that?gives?the
%???????minimum?value?D?over?all?values?of?x_min.
%
%????Note?that?this?procedure?gives?no?estimate?of?the?uncertainty?of?the?
%????fitted?parameters?nor?of?the?validity?of?the?fit.
%
%????Example:
%???????x?=?(1-rand(100001)).^(-1/(2.5-1));
%???????[p?gof]?=?plpva(x?1);
%
%????For?more?information?try?‘type?plpva‘
%
%????See?also?PLFIT?PLVAR
%?Version?1.0???(2007?May)
%?Version?1.0.2?(2007?September)
%?Version?1.0.3?(2007?September)
%?Version?1.0.4?(2008?January)
%?Version?1.0.5?(2008?March)
%?Version?1.0.6?(2008?April)
%?Version?1.0.7?(2009?October)
%?Copyright?(C)?2008-2009?Aaron?Clauset?(Santa?Fe?Institute)
%?Distributed?under?GPL?2.0
%?http://www.gnu.org/copyleft/gpl.html
%?PLPVA?comes?with?ABSOLUTELY?NO?WARRANTY
%?
%?Notes:
%?
%?1.?In?order?to?implement?the?integer-based?methods?in?Matlab?the?numeric
%????maximization?of?the?log-likelihood?function?was?used.?This?requires
%????that?we?specify?the?range?of?scaling?parameters?considered.?We?set
%????this?range?to?be?[1.50?:?0.01?:?3.50]?by?default.?This?vector?can?be
%????set?by?the?user?like?so
%????
%???????p?=?plpva(x?1‘range‘[1.001:0.001:5.001]);
%????
%?2.?PLPVA?can?be?told?to?limit?the?range?of?values?considered?as?estimates
%????for?xmin?in?two?ways.?First?it?can?be?instructed?to?sample?these
%????possible?values?like?so
%????
%???????a?=?plpva(x1‘sample‘100);
%????
%????which?uses?100?uniformly?distributed?values?on?the?sorted?list?of
%????unique?values?in?the?data?set.?Second?it?can?simply?omit?all
%????candidates?above?a?hard?limit?like?so
%????
%???????a?=?plpva(x1‘limit‘3.4);
%????
%????Finally?it?can?be?forced?to?use?a?fixed?value?like?so
%????
%???????a?=?plpva(x1‘xmin‘1);
%????
%????In?the?case?of?discrete?data?it?rounds?the?limit?to?the?nearest
%????integer.
%?
%?3.?The?default?number?of?semiparametric?repetitions?of?the?fitting
%?procedure?is?1000.?This?number?can?be?changed?like?so
%????
%???????p?=?plvar(x?1‘reps‘10000);
%?
%?4.?To?silence?the?textual?outpu
- 上一篇:多種圖像處理的方法 matlab
- 下一篇:matlab 目標檢測算法
評論
共有 條評論