|
22 | 22 | % on or off (default)
|
23 | 23 | % cutoff - cutoff for not plotting thin tails. Default is
|
24 | 24 | % 0.01, that is, 1% of the mass in both tails is not plotted
|
| 25 | +% gridn - optional number of grid points used. Default is 400 |
| 26 | +% bounded - tells if the density is bounded from left or right |
| 27 | +% (default is [0 0]). In unbounded case, decreasing tails |
| 28 | +% are assumed. |
25 | 29 | %
|
26 |
| -% Copyright (c) 2011 Aki Vehtari |
| 30 | +% Copyright (c) 2011,2016 Aki Vehtari |
27 | 31 |
|
28 | 32 | % This software is distributed under the GNU General Public
|
29 | 33 | % License (version 3 or later); please refer to the file
|
|
39 | 43 | ip.addParamValue('cutoff',.01, @(x) isreal(x)&& isscalar(x) && x>0 && x<1);
|
40 | 44 | ip.addParamValue('dots', 'off', @(x) islogical(x) || ...
|
41 | 45 | ismember(x,{'on' 'off'}))
|
| 46 | + ip.addParamValue('gridn',400, @(x) isnumeric(x)); |
| 47 | + ip.addParamValue('bounded',[0 0], @(x) isnumeric(x) && min(size(x))==1 && max(size(x))==2); |
42 | 48 | ip.parse(x,varargin{:});
|
43 | 49 | x=ip.Results.x;
|
44 | 50 | y=ip.Results.y;
|
45 | 51 | color=ip.Results.color;
|
46 | 52 | xrange=ip.Results.range;
|
47 | 53 | cutoff=ip.Results.cutoff;
|
48 | 54 | dots=ip.Results.dots;
|
| 55 | + gridn=ip.Results.gridn; |
| 56 | + bounded=ip.Results.bounded; |
49 | 57 |
|
50 | 58 | horiz=true;
|
51 | 59 | if isempty(y)
|
|
60 | 68 |
|
61 | 69 | [n,m]=size(y);
|
62 | 70 | for i1=1:m
|
63 |
| - [p,notused,yy]=lgpdens(y(:,i1),'gridn',200,'range',xrange); |
| 71 | + [p,notused,yy]=lgpdens(y(:,i1),'gridn',200,'range',xrange,'bounded',bounded,'gridn',gridn); |
64 | 72 | cp=cumsum(p./sum(p));
|
65 | 73 | qicutofflo=binsgeq(cp,cutoff/2);
|
66 | 74 | qicutoffhi=binsgeq(cp,1-cutoff/2);
|
|
0 commit comments