diff options
author | Rafael Laboissière <rafael@debian.org> | 2024-05-18 02:50:43 -0300 |
---|---|---|
committer | Rafael Laboissière <rafael@debian.org> | 2024-05-18 02:50:43 -0300 |
commit | 538173b7d33c368a1372f6d9e735e11b408b0a1d (patch) | |
tree | 48be384597a35da5b2768b4bdd1d9040cdad7e5a | |
parent | 7621020a5adb0d6fcdd972c5129a1dab3cf96cb3 (diff) |
New upstream version 1.6.6
-rw-r--r-- | DESCRIPTION | 4 | ||||
-rw-r--r-- | INDEX | 1 | ||||
-rw-r--r-- | NEWS | 28 | ||||
-rw-r--r-- | README.md | 4 | ||||
-rw-r--r-- | docs/BetaDistribution.html | 186 | ||||
-rw-r--r-- | docs/BinomialDistribution.html | 186 | ||||
-rw-r--r-- | docs/BirnbaumSaundersDistribution.html | 188 | ||||
-rw-r--r-- | docs/BurrDistribution.html | 189 | ||||
-rw-r--r-- | docs/CalinskiHarabaszEvaluation.html | 2 | ||||
-rw-r--r-- | docs/ClusterCriterion.html | 1 | ||||
-rw-r--r-- | docs/ConfusionMatrixChart.html | 7 | ||||
-rw-r--r-- | docs/DaviesBouldinEvaluation.html | 2 | ||||
-rw-r--r-- | docs/ExponentialDistribution.html | 185 | ||||
-rw-r--r-- | docs/ExtremeValueDistribution.html | 186 | ||||
-rw-r--r-- | docs/GammaDistribution.html | 186 | ||||
-rw-r--r-- | docs/GapEvaluation.html | 2 | ||||
-rw-r--r-- | docs/GeneralizedExtremeValueDistribution.html | 192 | ||||
-rw-r--r-- | docs/GeneralizedParetoDistribution.html | 188 | ||||
-rw-r--r-- | docs/HalfNormalDistribution.html | 186 | ||||
-rw-r--r-- | docs/InverseGaussianDistribution.html | 186 | ||||
-rw-r--r-- | docs/LogisticDistribution.html | 196 | ||||
-rw-r--r-- | docs/LoglogisticDistribution.html | 196 | ||||
-rw-r--r-- | docs/LognormalDistribution.html | 186 | ||||
-rw-r--r-- | docs/LoguniformDistribution.html | 174 | ||||
-rw-r--r-- | docs/MultinomialDistribution.html | 175 | ||||
-rw-r--r-- | docs/NakagamiDistribution.html | 186 | ||||
-rw-r--r-- | docs/NegativeBinomialDistribution.html | 190 | ||||
-rw-r--r-- | docs/NormalDistribution.html | 186 | ||||
-rw-r--r-- | docs/PiecewiseLinearDistribution.html | 181 | ||||
-rw-r--r-- | docs/PoissonDistribution.html | 185 | ||||
-rw-r--r-- | docs/RayleighDistribution.html | 185 | ||||
-rw-r--r-- | docs/RegressionGAM.html | 3 | ||||
-rw-r--r-- | docs/RicianDistribution.html | 186 | ||||
-rw-r--r-- | docs/SilhouetteEvaluation.html | 1 | ||||
-rw-r--r-- | docs/TriangularDistribution.html | 178 | ||||
-rw-r--r-- | docs/UniformDistribution.html | 178 | ||||
-rw-r--r-- | docs/WeibullDistribution.html | 189 | ||||
-rw-r--r-- | docs/anovan.html | 2 | ||||
-rw-r--r-- | docs/assets/ClassificationKNN_201.png | bin | 52993 -> 53087 bytes | |||
-rw-r--r-- | docs/assets/RegressionGAM_201.png | bin | 32019 -> 32009 bytes | |||
-rw-r--r-- | docs/assets/RegressionGAM_202.png | bin | 33630 -> 33631 bytes | |||
-rw-r--r-- | docs/assets/anovan_1001.png | bin | 47239 -> 47243 bytes | |||
-rw-r--r-- | docs/assets/anovan_101.png | bin | 46619 -> 46675 bytes | |||
-rw-r--r-- | docs/assets/anovan_1101.png | bin | 48678 -> 48717 bytes | |||
-rw-r--r-- | docs/assets/anovan_1201.png | bin | 46865 -> 46920 bytes | |||
-rw-r--r-- | docs/assets/anovan_1301.png | bin | 44997 -> 45076 bytes | |||
-rw-r--r-- | docs/assets/anovan_201.png | bin | 44451 -> 44345 bytes | |||
-rw-r--r-- | docs/assets/anovan_301.png | bin | 48178 -> 48199 bytes | |||
-rw-r--r-- | docs/assets/anovan_401.png | bin | 47906 -> 47691 bytes | |||
-rw-r--r-- | docs/assets/anovan_501.png | bin | 44850 -> 44960 bytes | |||
-rw-r--r-- | docs/assets/anovan_601.png | bin | 44272 -> 44309 bytes | |||
-rw-r--r-- | docs/assets/anovan_701.png | bin | 46859 -> 46864 bytes | |||
-rw-r--r-- | docs/assets/anovan_801.png | bin | 50644 -> 50699 bytes | |||
-rw-r--r-- | docs/assets/anovan_901.png | bin | 45945 -> 45928 bytes | |||
-rw-r--r-- | docs/assets/betacdf_101.png | bin | 30242 -> 30272 bytes | |||
-rw-r--r-- | docs/assets/betafit_101.png | bin | 42765 -> 42784 bytes | |||
-rw-r--r-- | docs/assets/betainv_101.png | bin | 29989 -> 30003 bytes | |||
-rw-r--r-- | docs/assets/betapdf_101.png | bin | 29246 -> 29235 bytes | |||
-rw-r--r-- | docs/assets/binocdf_101.png | bin | 28845 -> 28835 bytes | |||
-rw-r--r-- | docs/assets/binofit_101.png | bin | 35561 -> 35583 bytes | |||
-rw-r--r-- | docs/assets/binoinv_101.png | bin | 28997 -> 28972 bytes | |||
-rw-r--r-- | docs/assets/binopdf_101.png | bin | 28860 -> 28855 bytes | |||
-rw-r--r-- | docs/assets/bisacdf_101.png | bin | 29121 -> 29125 bytes | |||
-rw-r--r-- | docs/assets/bisacdf_201.png | bin | 32927 -> 32943 bytes | |||
-rw-r--r-- | docs/assets/bisafit_101.png | bin | 56318 -> 56411 bytes | |||
-rw-r--r-- | docs/assets/bisainv_101.png | bin | 27879 -> 27891 bytes | |||
-rw-r--r-- | docs/assets/bisainv_201.png | bin | 30174 -> 30159 bytes | |||
-rw-r--r-- | docs/assets/bisapdf_101.png | bin | 29732 -> 29757 bytes | |||
-rw-r--r-- | docs/assets/bisapdf_201.png | bin | 32644 -> 32677 bytes | |||
-rw-r--r-- | docs/assets/burrcdf_101.png | bin | 32304 -> 32290 bytes | |||
-rw-r--r-- | docs/assets/burrfit_101.png | bin | 54636 -> 54684 bytes | |||
-rw-r--r-- | docs/assets/burrinv_101.png | bin | 30753 -> 30686 bytes | |||
-rw-r--r-- | docs/assets/burrpdf_101.png | bin | 30519 -> 30441 bytes | |||
-rw-r--r-- | docs/assets/cauchycdf_101.png | bin | 27138 -> 27126 bytes | |||
-rw-r--r-- | docs/assets/cauchyinv_101.png | bin | 25441 -> 25448 bytes | |||
-rw-r--r-- | docs/assets/cauchypdf_101.png | bin | 27964 -> 27946 bytes | |||
-rw-r--r-- | docs/assets/chi2cdf_101.png | bin | 29589 -> 29577 bytes | |||
-rw-r--r-- | docs/assets/chi2inv_101.png | bin | 28103 -> 28127 bytes | |||
-rw-r--r-- | docs/assets/chi2pdf_101.png | bin | 28971 -> 28950 bytes | |||
-rw-r--r-- | docs/assets/confusionchart_501.png | bin | 19736 -> 18464 bytes | |||
-rw-r--r-- | docs/assets/dcov_101.png | bin | 18564 -> 18752 bytes | |||
-rw-r--r-- | docs/assets/dendrogram_301.png | bin | 32407 -> 32368 bytes | |||
-rw-r--r-- | docs/assets/dendrogram_401.png | bin | 25350 -> 25330 bytes | |||
-rw-r--r-- | docs/assets/ecdf_201.png | bin | 34819 -> 34722 bytes | |||
-rw-r--r-- | docs/assets/einstein_201.png | bin | 45092 -> 45094 bytes | |||
-rw-r--r-- | docs/assets/evcdf_101.png | bin | 27107 -> 27162 bytes | |||
-rw-r--r-- | docs/assets/evfit_101.png | bin | 53369 -> 53404 bytes | |||
-rw-r--r-- | docs/assets/evinv_101.png | bin | 26621 -> 26562 bytes | |||
-rw-r--r-- | docs/assets/evpdf_101.png | bin | 26908 -> 26857 bytes | |||
-rw-r--r-- | docs/assets/expcdf_101.png | bin | 23353 -> 23346 bytes | |||
-rw-r--r-- | docs/assets/expfit_101.png | bin | 46544 -> 46469 bytes | |||
-rw-r--r-- | docs/assets/expinv_101.png | bin | 21349 -> 21350 bytes | |||
-rw-r--r-- | docs/assets/exppdf_101.png | bin | 23188 -> 23194 bytes | |||
-rw-r--r-- | docs/assets/fcdf_101.png | bin | 26071 -> 26071 bytes | |||
-rw-r--r-- | docs/assets/finv_101.png | bin | 24120 -> 24097 bytes | |||
-rw-r--r-- | docs/assets/fitlm_101.png | bin | 46865 -> 46920 bytes | |||
-rw-r--r-- | docs/assets/fitlm_201.png | bin | 45011 -> 44781 bytes | |||
-rw-r--r-- | docs/assets/fpdf_101.png | bin | 23214 -> 23186 bytes | |||
-rw-r--r-- | docs/assets/gamcdf_101.png | bin | 32146 -> 32153 bytes | |||
-rw-r--r-- | docs/assets/gamfit_101.png | bin | 58381 -> 58431 bytes | |||
-rw-r--r-- | docs/assets/gaminv_101.png | bin | 29231 -> 29212 bytes | |||
-rw-r--r-- | docs/assets/gampdf_101.png | bin | 32196 -> 32205 bytes | |||
-rw-r--r-- | docs/assets/geocdf_101.png | bin | 25896 -> 25898 bytes | |||
-rw-r--r-- | docs/assets/geofit_101.png | bin | 36111 -> 36124 bytes | |||
-rw-r--r-- | docs/assets/geoinv_101.png | bin | 24918 -> 24925 bytes | |||
-rw-r--r-- | docs/assets/geopdf_101.png | bin | 24947 -> 24953 bytes | |||
-rw-r--r-- | docs/assets/gevcdf_101.png | bin | 33297 -> 33286 bytes | |||
-rw-r--r-- | docs/assets/gevfit_101.png | bin | 42355 -> 42361 bytes | |||
-rw-r--r-- | docs/assets/gevinv_101.png | bin | 31766 -> 31829 bytes | |||
-rw-r--r-- | docs/assets/gevpdf_101.png | bin | 31239 -> 31232 bytes | |||
-rw-r--r-- | docs/assets/gpcdf_101.png | bin | 33383 -> 33253 bytes | |||
-rw-r--r-- | docs/assets/gpfit_101.png | bin | 42509 -> 42497 bytes | |||
-rw-r--r-- | docs/assets/gpinv_101.png | bin | 31923 -> 31912 bytes | |||
-rw-r--r-- | docs/assets/gppdf_101.png | bin | 32641 -> 32493 bytes | |||
-rw-r--r-- | docs/assets/gscatter_101.png | bin | 15314 -> 15307 bytes | |||
-rw-r--r-- | docs/assets/gumbelcdf_101.png | bin | 27478 -> 27494 bytes | |||
-rw-r--r-- | docs/assets/gumbelfit_101.png | bin | 54286 -> 54286 bytes | |||
-rw-r--r-- | docs/assets/gumbelinv_101.png | bin | 26528 -> 26885 bytes | |||
-rw-r--r-- | docs/assets/gumbelpdf_101.png | bin | 27672 -> 27654 bytes | |||
-rw-r--r-- | docs/assets/histfit_101.png | bin | 10723 -> 10333 bytes | |||
-rw-r--r-- | docs/assets/histfit_201.png | bin | 0 -> 14720 bytes | |||
-rw-r--r-- | docs/assets/histfit_301.png | bin | 0 -> 13291 bytes | |||
-rw-r--r-- | docs/assets/hncdf_101.png | bin | 26597 -> 26602 bytes | |||
-rw-r--r-- | docs/assets/hncdf_201.png | bin | 25524 -> 25521 bytes | |||
-rw-r--r-- | docs/assets/hnfit_101.png | bin | 40603 -> 40614 bytes | |||
-rw-r--r-- | docs/assets/hninv_101.png | bin | 23127 -> 23048 bytes | |||
-rw-r--r-- | docs/assets/hnpdf_101.png | bin | 24618 -> 24582 bytes | |||
-rw-r--r-- | docs/assets/hnpdf_201.png | bin | 24722 -> 24710 bytes | |||
-rw-r--r-- | docs/assets/hygecdf_101.png | bin | 32291 -> 32275 bytes | |||
-rw-r--r-- | docs/assets/hygeinv_101.png | bin | 31248 -> 31219 bytes | |||
-rw-r--r-- | docs/assets/hygepdf_101.png | bin | 30897 -> 30837 bytes | |||
-rw-r--r-- | docs/assets/invgcdf_101.png | bin | 29813 -> 29823 bytes | |||
-rw-r--r-- | docs/assets/invgfit_101.png | bin | 51919 -> 51867 bytes | |||
-rw-r--r-- | docs/assets/invginv_101.png | bin | 27415 -> 27256 bytes | |||
-rw-r--r-- | docs/assets/invgpdf_101.png | bin | 27363 -> 27208 bytes | |||
-rw-r--r-- | docs/assets/isoutlier_201.png | bin | 15108 -> 15108 bytes | |||
-rw-r--r-- | docs/assets/isoutlier_301.png | bin | 22960 -> 22953 bytes | |||
-rw-r--r-- | docs/assets/jackknife_201.png | bin | 16792 -> 16739 bytes | |||
-rw-r--r-- | docs/assets/kmeans_201.png | bin | 31096 -> 31081 bytes | |||
-rw-r--r-- | docs/assets/kmeans_301.png | bin | 22120 -> 22131 bytes | |||
-rw-r--r-- | docs/assets/kmeans_401.png | bin | 50205 -> 50182 bytes | |||
-rw-r--r-- | docs/assets/knnsearch_101.png | bin | 35730 -> 35828 bytes | |||
-rw-r--r-- | docs/assets/knnsearch_201.png | bin | 25630 -> 25729 bytes | |||
-rw-r--r-- | docs/assets/laplacecdf_101.png | bin | 26037 -> 26029 bytes | |||
-rw-r--r-- | docs/assets/laplaceinv_101.png | bin | 25217 -> 25228 bytes | |||
-rw-r--r-- | docs/assets/laplacepdf_101.png | bin | 24899 -> 24905 bytes | |||
-rw-r--r-- | docs/assets/logicdf_101.png | bin | 28630 -> 28631 bytes | |||
-rw-r--r-- | docs/assets/logifit_101.png | bin | 53265 -> 53261 bytes | |||
-rw-r--r-- | docs/assets/logiinv_101.png | bin | 26283 -> 26270 bytes | |||
-rw-r--r-- | docs/assets/logipdf_101.png | bin | 28611 -> 28545 bytes | |||
-rw-r--r-- | docs/assets/loglcdf_101.png | bin | 38630 -> 38645 bytes | |||
-rw-r--r-- | docs/assets/loglfit_101.png | bin | 49799 -> 49736 bytes | |||
-rw-r--r-- | docs/assets/loglinv_101.png | bin | 33193 -> 33222 bytes | |||
-rw-r--r-- | docs/assets/loglpdf_101.png | bin | 36412 -> 36576 bytes | |||
-rw-r--r-- | docs/assets/logncdf_101.png | bin | 25235 -> 25226 bytes | |||
-rw-r--r-- | docs/assets/lognfit_101.png | bin | 50836 -> 50882 bytes | |||
-rw-r--r-- | docs/assets/logninv_101.png | bin | 24735 -> 24772 bytes | |||
-rw-r--r-- | docs/assets/lognpdf_101.png | bin | 21917 -> 21911 bytes | |||
-rw-r--r-- | docs/assets/nakacdf_101.png | bin | 33228 -> 33242 bytes | |||
-rw-r--r-- | docs/assets/nakafit_101.png | bin | 51350 -> 51376 bytes | |||
-rw-r--r-- | docs/assets/nakainv_101.png | bin | 33012 -> 32987 bytes | |||
-rw-r--r-- | docs/assets/nakapdf_101.png | bin | 31439 -> 31382 bytes | |||
-rw-r--r-- | docs/assets/nbincdf_101.png | bin | 36527 -> 36546 bytes | |||
-rw-r--r-- | docs/assets/nbinfit_101.png | bin | 42487 -> 42488 bytes | |||
-rw-r--r-- | docs/assets/nbininv_101.png | bin | 30241 -> 30235 bytes | |||
-rw-r--r-- | docs/assets/nbinpdf_101.png | bin | 36696 -> 36713 bytes | |||
-rw-r--r-- | docs/assets/ncfcdf_101.png | bin | 30247 -> 30216 bytes | |||
-rw-r--r-- | docs/assets/ncfcdf_201.png | bin | 25452 -> 25459 bytes | |||
-rw-r--r-- | docs/assets/ncfinv_101.png | bin | 28299 -> 28329 bytes | |||
-rw-r--r-- | docs/assets/ncfinv_201.png | bin | 24089 -> 24107 bytes | |||
-rw-r--r-- | docs/assets/ncfpdf_101.png | bin | 29168 -> 29197 bytes | |||
-rw-r--r-- | docs/assets/ncfpdf_201.png | bin | 24542 -> 24540 bytes | |||
-rw-r--r-- | docs/assets/nctcdf_101.png | bin | 26339 -> 26320 bytes | |||
-rw-r--r-- | docs/assets/nctcdf_201.png | bin | 23409 -> 23411 bytes | |||
-rw-r--r-- | docs/assets/nctinv_101.png | bin | 24833 -> 24843 bytes | |||
-rw-r--r-- | docs/assets/nctinv_201.png | bin | 22237 -> 22223 bytes | |||
-rw-r--r-- | docs/assets/nctpdf_101.png | bin | 26738 -> 26730 bytes | |||
-rw-r--r-- | docs/assets/nctpdf_201.png | bin | 23871 -> 23807 bytes | |||
-rw-r--r-- | docs/assets/ncx2cdf_101.png | bin | 34347 -> 34341 bytes | |||
-rw-r--r-- | docs/assets/ncx2cdf_201.png | bin | 27232 -> 27190 bytes | |||
-rw-r--r-- | docs/assets/ncx2inv_101.png | bin | 33425 -> 33441 bytes | |||
-rw-r--r-- | docs/assets/ncx2inv_201.png | bin | 25247 -> 25193 bytes | |||
-rw-r--r-- | docs/assets/ncx2pdf_101.png | bin | 35323 -> 35315 bytes | |||
-rw-r--r-- | docs/assets/ncx2pdf_201.png | bin | 26756 -> 26709 bytes | |||
-rw-r--r-- | docs/assets/normcdf_101.png | bin | 25877 -> 25866 bytes | |||
-rw-r--r-- | docs/assets/normfit_101.png | bin | 49298 -> 49340 bytes | |||
-rw-r--r-- | docs/assets/norminv_101.png | bin | 24363 -> 24234 bytes | |||
-rw-r--r-- | docs/assets/normpdf_101.png | bin | 25103 -> 24972 bytes | |||
-rw-r--r-- | docs/assets/plcdf_101.png | bin | 22642 -> 22641 bytes | |||
-rw-r--r-- | docs/assets/plinv_101.png | bin | 21819 -> 21829 bytes | |||
-rw-r--r-- | docs/assets/plpdf_101.png | bin | 19654 -> 19647 bytes | |||
-rw-r--r-- | docs/assets/poisscdf_101.png | bin | 24066 -> 24053 bytes | |||
-rw-r--r-- | docs/assets/poissfit_101.png | bin | 46134 -> 46133 bytes | |||
-rw-r--r-- | docs/assets/poissinv_101.png | bin | 23677 -> 23686 bytes | |||
-rw-r--r-- | docs/assets/poisspdf_101.png | bin | 22312 -> 22313 bytes | |||
-rw-r--r-- | docs/assets/procrustes_201.png | bin | 20744 -> 20782 bytes | |||
-rw-r--r-- | docs/assets/procrustes_301.png | bin | 26306 -> 26300 bytes | |||
-rw-r--r-- | docs/assets/procrustes_302.png | bin | 18767 -> 18756 bytes | |||
-rw-r--r-- | docs/assets/procrustes_401.png | bin | 19685 -> 19680 bytes | |||
-rw-r--r-- | docs/assets/raylcdf_101.png | bin | 26477 -> 26469 bytes | |||
-rw-r--r-- | docs/assets/raylfit_101.png | bin | 53751 -> 53798 bytes | |||
-rw-r--r-- | docs/assets/raylinv_101.png | bin | 25001 -> 24976 bytes | |||
-rw-r--r-- | docs/assets/raylpdf_101.png | bin | 25295 -> 25298 bytes | |||
-rw-r--r-- | docs/assets/regress_gp_301.png | bin | 23252 -> 23248 bytes | |||
-rw-r--r-- | docs/assets/regress_gp_401.png | bin | 23231 -> 23243 bytes | |||
-rw-r--r-- | docs/assets/regress_gp_501.png | bin | 27507 -> 27548 bytes | |||
-rw-r--r-- | docs/assets/regress_gp_601.png | bin | 26513 -> 26561 bytes | |||
-rw-r--r-- | docs/assets/regress_gp_602.png | bin | 27706 -> 27620 bytes | |||
-rw-r--r-- | docs/assets/regress_gp_603.png | bin | 26731 -> 26784 bytes | |||
-rw-r--r-- | docs/assets/regress_gp_604.png | bin | 27130 -> 27176 bytes | |||
-rw-r--r-- | docs/assets/regress_gp_701.png | bin | 34343 -> 34334 bytes | |||
-rw-r--r-- | docs/assets/regress_gp_801.png | bin | 36858 -> 36881 bytes | |||
-rw-r--r-- | docs/assets/ricecdf_101.png | bin | 26883 -> 26874 bytes | |||
-rw-r--r-- | docs/assets/ricecdf_201.png | bin | 29119 -> 29110 bytes | |||
-rw-r--r-- | docs/assets/ricefit_101.png | bin | 55852 -> 55818 bytes | |||
-rw-r--r-- | docs/assets/riceinv_101.png | bin | 24987 -> 24990 bytes | |||
-rw-r--r-- | docs/assets/ricepdf_101.png | bin | 29216 -> 29196 bytes | |||
-rw-r--r-- | docs/assets/ridge_101.png | bin | 45153 -> 45063 bytes | |||
-rw-r--r-- | docs/assets/sigma_pts_101.png | bin | 9454 -> 9462 bytes | |||
-rw-r--r-- | docs/assets/tcdf_101.png | bin | 24488 -> 24491 bytes | |||
-rw-r--r-- | docs/assets/tinv_101.png | bin | 22475 -> 22494 bytes | |||
-rw-r--r-- | docs/assets/tlscdf_101.png | bin | 32116 -> 32121 bytes | |||
-rw-r--r-- | docs/assets/tlsfit_101.png | bin | 59184 -> 59196 bytes | |||
-rw-r--r-- | docs/assets/tlsinv_101.png | bin | 30397 -> 30404 bytes | |||
-rw-r--r-- | docs/assets/tlspdf_101.png | bin | 31079 -> 31064 bytes | |||
-rw-r--r-- | docs/assets/tpdf_101.png | bin | 24566 -> 24551 bytes | |||
-rw-r--r-- | docs/assets/tricdf_101.png | bin | 28680 -> 28681 bytes | |||
-rw-r--r-- | docs/assets/triinv_101.png | bin | 23180 -> 23055 bytes | |||
-rw-r--r-- | docs/assets/tripdf_101.png | bin | 31347 -> 31200 bytes | |||
-rw-r--r-- | docs/assets/unidcdf_101.png | bin | 21391 -> 21391 bytes | |||
-rw-r--r-- | docs/assets/unidfit_101.png | bin | 33801 -> 33793 bytes | |||
-rw-r--r-- | docs/assets/unidinv_101.png | bin | 18568 -> 18565 bytes | |||
-rw-r--r-- | docs/assets/unidpdf_101.png | bin | 20613 -> 20612 bytes | |||
-rw-r--r-- | docs/assets/unifcdf_101.png | bin | 22692 -> 22689 bytes | |||
-rw-r--r-- | docs/assets/unifinv_101.png | bin | 20965 -> 20971 bytes | |||
-rw-r--r-- | docs/assets/unifit_101.png | bin | 36581 -> 36601 bytes | |||
-rw-r--r-- | docs/assets/unifpdf_101.png | bin | 19657 -> 19656 bytes | |||
-rw-r--r-- | docs/assets/violin_201.png | bin | 24858 -> 24866 bytes | |||
-rw-r--r-- | docs/assets/vmcdf_101.png | bin | 26925 -> 26904 bytes | |||
-rw-r--r-- | docs/assets/vminv_101.png | bin | 25840 -> 25812 bytes | |||
-rw-r--r-- | docs/assets/vmpdf_101.png | bin | 26386 -> 26372 bytes | |||
-rw-r--r-- | docs/assets/wblcdf_101.png | bin | 25861 -> 25868 bytes | |||
-rw-r--r-- | docs/assets/wblfit_101.png | bin | 50452 -> 50491 bytes | |||
-rw-r--r-- | docs/assets/wblinv_101.png | bin | 23436 -> 23350 bytes | |||
-rw-r--r-- | docs/assets/wblpdf_101.png | bin | 24677 -> 24587 bytes | |||
-rw-r--r-- | docs/assets/wblplot_101.png | bin | 28542 -> 28837 bytes | |||
-rw-r--r-- | docs/assets/wblplot_201.png | bin | 30952 -> 31037 bytes | |||
-rw-r--r-- | docs/assets/wblplot_301.png | bin | 40954 -> 41298 bytes | |||
-rw-r--r-- | docs/assets/wblplot_401.png | bin | 42026 -> 41608 bytes | |||
-rw-r--r-- | docs/assets/wblplot_501.png | bin | 41687 -> 42290 bytes | |||
-rw-r--r-- | docs/chi2gof.html | 8 | ||||
-rw-r--r-- | docs/editDistance.html | 112 | ||||
-rw-r--r-- | docs/fillmissing.html | 2 | ||||
-rw-r--r-- | docs/fitdist.html | 7 | ||||
-rw-r--r-- | docs/glmfit.html | 116 | ||||
-rw-r--r-- | docs/histfit.html | 106 | ||||
-rw-r--r-- | docs/index.html | 23 | ||||
-rw-r--r-- | docs/mad.html | 86 | ||||
-rw-r--r-- | docs/mean.html | 105 | ||||
-rw-r--r-- | docs/median.html | 77 | ||||
-rw-r--r-- | docs/multcompare.html | 93 | ||||
-rw-r--r-- | docs/normplot.html | 2 | ||||
-rw-r--r-- | docs/pcares.html | 2 | ||||
-rw-r--r-- | docs/std.html | 139 | ||||
-rw-r--r-- | docs/tLocationScaleDistribution.html | 33 | ||||
-rw-r--r-- | docs/var.html | 133 | ||||
-rw-r--r-- | inst/PKG_DEL | 2 | ||||
-rw-r--r-- | inst/anovan.m | 16 | ||||
-rw-r--r-- | inst/dist_fun/fpdf.m | 1 | ||||
-rw-r--r-- | inst/dist_fun/gumbelinv.m | 19 | ||||
-rw-r--r-- | inst/dist_obj/BinomialDistribution.m | 8 | ||||
-rw-r--r-- | inst/dist_obj/GammaDistribution.m | 4 | ||||
-rw-r--r-- | inst/dist_obj/LogisticDistribution.m | 2 | ||||
-rw-r--r-- | inst/dist_obj/LoglogisticDistribution.m | 2 | ||||
-rw-r--r-- | inst/dist_obj/LoguniformDistribution.m | 10 | ||||
-rw-r--r-- | inst/dist_obj/MultinomialDistribution.m | 21 | ||||
-rw-r--r-- | inst/dist_obj/NegativeBinomialDistribution.m | 2 | ||||
-rw-r--r-- | inst/dist_obj/PiecewiseLinearDistribution.m | 9 | ||||
-rw-r--r-- | inst/dist_obj/PoissonDistribution.m | 4 | ||||
-rw-r--r-- | inst/dist_obj/RicianDistribution.m | 2 | ||||
-rw-r--r-- | inst/dist_obj/TriangularDistribution.m | 4 | ||||
-rw-r--r-- | inst/dist_obj/private/__plot__.m | 202 | ||||
-rw-r--r-- | inst/dist_wrap/fitdist.m | 7 | ||||
-rw-r--r-- | inst/fillmissing.m | 1588 | ||||
-rw-r--r-- | inst/glmfit.m | 321 | ||||
-rw-r--r-- | inst/histfit.m | 240 | ||||
-rw-r--r-- | inst/normplot.m | 2 | ||||
-rw-r--r-- | src/Makefile | 1 | ||||
-rw-r--r-- | src/editDistance.cc | 748 |
289 files changed, 5717 insertions, 3428 deletions
diff --git a/DESCRIPTION b/DESCRIPTION index f07ae12..8d94c01 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Name: statistics -Version: 1.6.5 -Date: 2024-3-7 +Version: 1.6.6 +Date: 2024-5-16 Author: various authors Maintainer: Andreas Bertsatos <abertsatos@biol.uoa.gr> Title: Statistics @@ -6,6 +6,7 @@ Clustering confusionmat cophenet crossval + editDistance evalclusters inconsistent kmeans @@ -480,3 +480,31 @@ ** PiecewiseLinearDistribution: fix truncated `mean`, `std`, and `var` methods ** various fixes to avoid errors when testing the package functions + + + Summary of important user-visible changes for statistics 1.6.6: +------------------------------------------------------------------- + + Important Notice: 1) `mad`, `mean`, `median`, `std`, `var` functions + shadow core Octave's respective functions prior + to Octave v9.1 + 2) incompatibility with the `nan` package + New functions: + ============== + + ** editDistance + + Improvements: + ============= + + ** fillmissing: combining `movmedian` method and `missinglocation` option + no longer ignores non-NaN values. + + ** gumbelinv: fix incorrect return value due to misplaced minus sign + + ** glmfit: fix input validation, parameter parsing, and update documentation + + ** histfit: updated support for other distributions, fixed MATLAB compatibility + + ** plot method for probability distribution objects partially implemented to + allow plotting PDF and superimposing it over histograms of fitted data. @@ -21,7 +21,7 @@ You can find its documentation at [https://gnu-octave.github.io/statistics/](htt ## 2. Install statistics -To install the latest release (1.6.4) you need Octave (>=7.2.0) installed on your system. Install it by typing: +To install the latest release (1.6.6) you need Octave (>=7.2.0) installed on your system. Install it by typing: `pkg install -forge statistics` @@ -29,7 +29,7 @@ You can automatically download and install the latest development version of the `pkg install "https://github.com/gnu-octave/statistics/archive/refs/heads/main.zip"` -If you need to install a specific release, for example `1.4.2`, type: +If you need to install a specific older release, for example `1.4.2`, type: `pkg install "https://github.com/gnu-octave/statistics/archive/refs/tags/release-1.4.2.tar.gz"` diff --git a/docs/BetaDistribution.html b/docs/BetaDistribution.html index f2f4c27..3e894e7 100644 --- a/docs/BetaDistribution.html +++ b/docs/BetaDistribution.html @@ -71,66 +71,126 @@ </div> <div class="card-body"> <dl> -<dt><u>statistics:</u> BetaDistribution</dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>, <var>C</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (…, <code>"upper"</code>)</i></dt> </dl> -<p> Beta probability distribution object. +<p> Return the CDF of a univariate distribution evaluated at <var>x</var>. </p> <div class="ms-5"> -<p> A <code>BetaDistribution</code> object consists of parameters, a model - description, and sample data for a beta probability distribution. +<p> <code>cdf</code> is a wrapper for the univariate cumulative distribution functions + available in the statistics package. See the corresponding functions’ help + to learn the signification of the parameters after <var>x</var>. </p> -<p> The beta distribution uses the following parameters. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>)</code> returns the CDF for the + one-parameter distribution family specified by <var>name</var> and the + distribution parameter <var>A</var>, evaluated at the values in <var>x</var>. </p> - <table> -<thead><tr><th width="25%"><var>Parameter</var></th><th width="48%"><var>Description</var></th><th width="27%"><var>Support</var></th></tr></thead> -<tr><td width="25%"><code>a</code></td><td width="48%">1st Shape parameter</td><td width="27%"><math>α > 0</math></td></tr> -<tr><td width="25%"><code>b</code></td><td width="48%">2nd Shape parameter</td><td width="27%"><math>β > 0</math></td></tr> -</table> - -<p> There are several ways to create a <code>BetaDistribution</code> object. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>)</code> returns the CDF + for the two-parameter distribution family specified by <var>name</var> and the + distribution parameters <var>A</var> and <var>B</var>, evaluated at the values in + <var>x</var>. </p> - <ul> -<li> Fit a distribution to data using the <code>fitdist</code> function. - </li><li> Create a distribution with specified parameter values using the - <code>makedist</code> function. - </li><li> Use the constructor <code>BetaDistribution (<var>a</var>, <var>b</var>)</code> - to create a beta distribution with specified parameter values. - </li><li> Use the static method <code>BetaDistribution.fit (<var>x</var>, - <var>censor</var>, <var>freq</var>, <var>options</var>)</code> to a distribution to data <var>x</var>. - </li></ul> - -<p> It is highly recommended to use <code>fitdist</code> and <code>makedist</code> - functions to create probability distribution objects, instead of the - constructor and the aforementioned static method. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>, <var>C</var>)</code> returns + the CDF for the three-parameter distribution family specified by <var>name</var> + and the distribution parameters <var>A</var>, <var>B</var>, and <var>C</var>, evaluated at + the values in <var>x</var>. +</p> +<p> <code><var>p</var> = cdf (…, <code>"upper"</code>)</code> returns the complement of the + CDF using an algorithm that more accurately computes the extreme upper-tail + probabilities. <code>"upper"</code> can follow any of the input arguments in the + previous syntaxes. </p> -<p> A <code>BetaDistribution</code> object contains the following properties, - which can be accessed using dot notation. +<p> <var>name</var> must be a char string of the name or the abbreviation of the + desired cumulative distribution function as listed in the followng table. + The last column shows the number of required parameters that should be parsed + after <var>x</var> to the desired CDF. The optional input argument + <code>"upper"</code> does not count in the required number of parameters. </p> <table> -<tr><td width="25%"><code>DistributionName</code></td><td width="25%"><code>DistributionCode</code></td><td width="25%"><code>NumParameters</code></td><td width="25%"><code>ParameterNames</code></td></tr> -<tr><td width="25%"><code>ParameterDescription</code></td><td width="25%"><code>ParameterValues</code></td><td width="25%"><code>ParameterValues</code></td><td width="25%"><code>ParameterCI</code></td></tr> -<tr><td width="25%"><code>ParameterIsFixed</code></td><td width="25%"><code>Truncation</code></td><td width="25%"><code>IsTruncated</code></td><td width="25%"><code>InputData</code></td></tr> +<thead><tr><th width="40%">Distribution Name</th><th width="5%"></th><th width="20%">Abbreviation</th><th width="5%"></th><th width="30%">Input Parameters</th></tr></thead> +<tr><td width="40%"><code>"Beta"</code></td><td width="5%"></td><td width="20%"><code>"beta"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Binomial"</code></td><td width="5%"></td><td width="20%"><code>"bino"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Birnbaum-Saunders"</code></td><td width="5%"></td><td width="20%"><code>"bisa"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Burr"</code></td><td width="5%"></td><td width="20%"><code>"burr"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Cauchy"</code></td><td width="5%"></td><td width="20%"><code>"cauchy"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Chi-squared"</code></td><td width="5%"></td><td width="20%"><code>"chi2"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Extreme Value"</code></td><td width="5%"></td><td width="20%"><code>"ev"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Exponential"</code></td><td width="5%"></td><td width="20%"><code>"exp"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"F-Distribution"</code></td><td width="5%"></td><td width="20%"><code>"f"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Gamma"</code></td><td width="5%"></td><td width="20%"><code>"gam"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Geometric"</code></td><td width="5%"></td><td width="20%"><code>"geo"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Generalized Extreme Value"</code></td><td width="5%"></td><td width="20%"><code>"gev"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Generalized Pareto"</code></td><td width="5%"></td><td width="20%"><code>"gp"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Gumbel"</code></td><td width="5%"></td><td width="20%"><code>"gumbel"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Half-normal"</code></td><td width="5%"></td><td width="20%"><code>"hn"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Hypergeometric"</code></td><td width="5%"></td><td width="20%"><code>"hyge"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Inverse Gaussian"</code></td><td width="5%"></td><td width="20%"><code>"invg"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Laplace"</code></td><td width="5%"></td><td width="20%"><code>"laplace"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Logistic"</code></td><td width="5%"></td><td width="20%"><code>"logi"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Log-Logistic"</code></td><td width="5%"></td><td width="20%"><code>"logl"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Lognormal"</code></td><td width="5%"></td><td width="20%"><code>"logn"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Nakagami"</code></td><td width="5%"></td><td width="20%"><code>"naka"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Negative Binomial"</code></td><td width="5%"></td><td width="20%"><code>"nbin"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Noncentral F-Distribution"</code></td><td width="5%"></td><td width="20%"><code>"ncf"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Noncentral Student T"</code></td><td width="5%"></td><td width="20%"><code>"nct"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Noncentral Chi-Squared"</code></td><td width="5%"></td><td width="20%"><code>"ncx2"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Normal"</code></td><td width="5%"></td><td width="20%"><code>"norm"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Poisson"</code></td><td width="5%"></td><td width="20%"><code>"poiss"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Rayleigh"</code></td><td width="5%"></td><td width="20%"><code>"rayl"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Rician"</code></td><td width="5%"></td><td width="20%"><code>"rice"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Student T"</code></td><td width="5%"></td><td width="20%"><code>"t"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"location-scale T"</code></td><td width="5%"></td><td width="20%"><code>"tls"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Triangular"</code></td><td width="5%"></td><td width="20%"><code>"tri"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Discrete Uniform"</code></td><td width="5%"></td><td width="20%"><code>"unid"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Uniform"</code></td><td width="5%"></td><td width="20%"><code>"unif"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Von Mises"</code></td><td width="5%"></td><td width="20%"><code>"vm"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Weibull"</code></td><td width="5%"></td><td width="20%"><code>"wbl"</code></td><td width="5%"></td><td width="30%">2</td></tr> </table> -<p> A <code>BetaDistribution</code> object contains the following methods: - <code>cdf</code>, <code>icdf</code>, <code>iqr</code>, <code>mean</code>, <code>median</code>, - <code>negloglik</code>, <code>paramci</code>, <code>pdf</code>, <code>plot</code>, <code>proflik</code>, - <code>random</code>, <code>std</code>, <code>truncate</code>, <code>var</code>. -</p> -<p> Further information about the Beta distribution can be found at - <a href="https://en.wikipedia.org/wiki/Beta_distribution">https://en.wikipedia.org/wiki/Beta_distribution</a> -</p> <p> <strong>See also: </strong> - <a href="fitdist.html">fitdist</a>, - <a href="makedist.html">makedist</a>, + <a href="icdf.html">icdf</a>, + <a href="pdf.html">pdf</a>, + <a href="cdf.html">cdf</a>, <a href="betacdf.html">betacdf</a>, - <a href="betainv.html">betainv</a>, - <a href="betapdf.html">betapdf</a>, - <a href="betarnd.html">betarnd</a>, - <a href="lognfit.html">lognfit</a>, - <a href="betalike.html">betalike</a>, - <a href="betastat.html">betastat</a> + <a href="binocdf.html">binocdf</a>, + <a href="bisacdf.html">bisacdf</a>, + <a href="burrcdf.html">burrcdf</a>, + <a href="cauchycdf.html">cauchycdf</a>, + <a href="chi2cdf.html">chi2cdf</a>, + <a href="evcdf.html">evcdf</a>, + <a href="expcdf.html">expcdf</a>, + <a href="fcdf.html">fcdf</a>, + <a href="gamcdf.html">gamcdf</a>, + <a href="geocdf.html">geocdf</a>, + <a href="gevcdf.html">gevcdf</a>, + <a href="gpcdf.html">gpcdf</a>, + <a href="gumbelcdf.html">gumbelcdf</a>, + <a href="hncdf.html">hncdf</a>, + <a href="hygecdf.html">hygecdf</a>, + <a href="invgcdf.html">invgcdf</a>, + <a href="laplacecdf.html">laplacecdf</a>, + <a href="logicdf.html">logicdf</a>, + <a href="loglcdf.html">loglcdf</a>, + <a href="logncdf.html">logncdf</a>, + <a href="nakacdf.html">nakacdf</a>, + <a href="nbincdf.html">nbincdf</a>, + <a href="ncfcdf.html">ncfcdf</a>, + <a href="nctcdf.html">nctcdf</a>, + <a href="ncx2cdf.html">ncx2cdf</a>, + <a href="normcdf.html">normcdf</a>, + <a href="poisscdf.html">poisscdf</a>, + <a href="raylcdf.html">raylcdf</a>, + <a href="ricecdf.html">ricecdf</a>, + <a href="tcdf.html">tcdf</a>, + <a href="tlscdf.html">tlscdf</a>, + <a href="tricdf.html">tricdf</a>, + <a href="unidcdf.html">unidcdf</a>, + <a href="unifcdf.html">unifcdf</a>, + <a href="vmcdf.html">vmcdf</a>, + <a href="wblcdf.html">wblcdf</a> </p> <p><strong>Source Code: </strong> <a href="https://github.com/gnu-octave/statistics/tree/main/inst/dist_obj/BetaDistribution.m">BetaDistribution</a> @@ -141,39 +201,6 @@ <div class="row d-flex flex-wrap align-items-center"> <div class="col-sm-3 col-md-5 mb-2 mb-sm-0"> <h3 class="d-inline-block mr-2"> - Method: <b><code>cdf</code></b> - </h3> - </div> - </div> - </div> - <div class="card-body"> -<dl> -<dt><u>BetaDistribution:</u> <var>p</var> = <b>icdf</b><i> (<var>pd</var>, <var>p</var>)</i></dt> -</dl> - -<p> Compute the cumulative distribution function (CDF). -</p> -<div class="ms-5"> -<p> <code><var>p</var> = icdf (<var>pd</var>, <var>x</var>)</code> computes the quantile (the - inverse of the CDF) of the probability distribution object, <var>pd</var>, - evaluated at the values in <var>x</var>. -</p> - -</div> - - </div> - </div> - </div> - - - - - <div class="container-xl my-4"> - <div class="card rounded"> - <div class="card-header card-header-mod"> - <div class="row d-flex flex-wrap align-items-center"> - <div class="col-sm-3 col-md-5 mb-2 mb-sm-0"> - <h3 class="d-inline-block mr-2"> Method: <b><code>icdf</code></b> </h3> </div> @@ -227,7 +254,6 @@ </div> </div> - <div class="container-xl my-4"> <div class="card rounded"> <div class="card-header card-header-mod"> diff --git a/docs/BinomialDistribution.html b/docs/BinomialDistribution.html index 88f99c5..284599c 100644 --- a/docs/BinomialDistribution.html +++ b/docs/BinomialDistribution.html @@ -71,66 +71,126 @@ </div> <div class="card-body"> <dl> -<dt><u>statistics:</u> BinomialDistribution</dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>, <var>C</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (…, <code>"upper"</code>)</i></dt> </dl> -<p> Binomial probability distribution object. +<p> Return the CDF of a univariate distribution evaluated at <var>x</var>. </p> <div class="ms-5"> -<p> A <code>BinomialDistribution</code> object consists of parameters, a model - description, and sample data for a binomial probability distribution. +<p> <code>cdf</code> is a wrapper for the univariate cumulative distribution functions + available in the statistics package. See the corresponding functions’ help + to learn the signification of the parameters after <var>x</var>. </p> -<p> The binomial distribution uses the following parameters. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>)</code> returns the CDF for the + one-parameter distribution family specified by <var>name</var> and the + distribution parameter <var>A</var>, evaluated at the values in <var>x</var>. </p> - <table> -<thead><tr><th width="25%"><var>Parameter</var></th><th width="48%"><var>Description</var></th><th width="27%"><var>Support</var></th></tr></thead> -<tr><td width="25%"><code>N</code></td><td width="48%">Number of trials</td><td width="27%">positive integer</td></tr> -<tr><td width="25%"><code>p</code></td><td width="48%">Probability of success</td><td width="27%"><math>0 <= p <= 1</math></td></tr> -</table> - -<p> There are several ways to create a <code>BinomialDistribution</code> object. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>)</code> returns the CDF + for the two-parameter distribution family specified by <var>name</var> and the + distribution parameters <var>A</var> and <var>B</var>, evaluated at the values in + <var>x</var>. </p> - <ul> -<li> Fit a distribution to data using the <code>fitdist</code> function. - </li><li> Create a distribution with specified parameter values using the - <code>makedist</code> function. - </li><li> Use the constructor <code>BinomialDistribution (<var>N</var>, <var>p</var>)</code> - to create a binomial distribution with specified parameter values. - </li><li> Use the static method <code>BinomialDistribution.fit (<var>x</var>, - <var>censor</var>, <var>freq</var>, <var>options</var>)</code> to a distribution to data <var>x</var>. - </li></ul> - -<p> It is highly recommended to use <code>fitdist</code> and <code>makedist</code> - functions to create probability distribution objects, instead of the - constructor and the aforementioned static method. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>, <var>C</var>)</code> returns + the CDF for the three-parameter distribution family specified by <var>name</var> + and the distribution parameters <var>A</var>, <var>B</var>, and <var>C</var>, evaluated at + the values in <var>x</var>. +</p> +<p> <code><var>p</var> = cdf (…, <code>"upper"</code>)</code> returns the complement of the + CDF using an algorithm that more accurately computes the extreme upper-tail + probabilities. <code>"upper"</code> can follow any of the input arguments in the + previous syntaxes. </p> -<p> A <code>BinomialDistribution</code> object contains the following properties, - which can be accessed using dot notation. +<p> <var>name</var> must be a char string of the name or the abbreviation of the + desired cumulative distribution function as listed in the followng table. + The last column shows the number of required parameters that should be parsed + after <var>x</var> to the desired CDF. The optional input argument + <code>"upper"</code> does not count in the required number of parameters. </p> <table> -<tr><td width="25%"><code>DistributionName</code></td><td width="25%"><code>DistributionCode</code></td><td width="25%"><code>NumParameters</code></td><td width="25%"><code>ParameterNames</code></td></tr> -<tr><td width="25%"><code>ParameterDescription</code></td><td width="25%"><code>ParameterValues</code></td><td width="25%"><code>ParameterValues</code></td><td width="25%"><code>ParameterCI</code></td></tr> -<tr><td width="25%"><code>ParameterIsFixed</code></td><td width="25%"><code>Truncation</code></td><td width="25%"><code>IsTruncated</code></td><td width="25%"><code>InputData</code></td></tr> +<thead><tr><th width="40%">Distribution Name</th><th width="5%"></th><th width="20%">Abbreviation</th><th width="5%"></th><th width="30%">Input Parameters</th></tr></thead> +<tr><td width="40%"><code>"Beta"</code></td><td width="5%"></td><td width="20%"><code>"beta"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Binomial"</code></td><td width="5%"></td><td width="20%"><code>"bino"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Birnbaum-Saunders"</code></td><td width="5%"></td><td width="20%"><code>"bisa"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Burr"</code></td><td width="5%"></td><td width="20%"><code>"burr"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Cauchy"</code></td><td width="5%"></td><td width="20%"><code>"cauchy"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Chi-squared"</code></td><td width="5%"></td><td width="20%"><code>"chi2"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Extreme Value"</code></td><td width="5%"></td><td width="20%"><code>"ev"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Exponential"</code></td><td width="5%"></td><td width="20%"><code>"exp"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"F-Distribution"</code></td><td width="5%"></td><td width="20%"><code>"f"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Gamma"</code></td><td width="5%"></td><td width="20%"><code>"gam"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Geometric"</code></td><td width="5%"></td><td width="20%"><code>"geo"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Generalized Extreme Value"</code></td><td width="5%"></td><td width="20%"><code>"gev"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Generalized Pareto"</code></td><td width="5%"></td><td width="20%"><code>"gp"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Gumbel"</code></td><td width="5%"></td><td width="20%"><code>"gumbel"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Half-normal"</code></td><td width="5%"></td><td width="20%"><code>"hn"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Hypergeometric"</code></td><td width="5%"></td><td width="20%"><code>"hyge"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Inverse Gaussian"</code></td><td width="5%"></td><td width="20%"><code>"invg"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Laplace"</code></td><td width="5%"></td><td width="20%"><code>"laplace"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Logistic"</code></td><td width="5%"></td><td width="20%"><code>"logi"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Log-Logistic"</code></td><td width="5%"></td><td width="20%"><code>"logl"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Lognormal"</code></td><td width="5%"></td><td width="20%"><code>"logn"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Nakagami"</code></td><td width="5%"></td><td width="20%"><code>"naka"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Negative Binomial"</code></td><td width="5%"></td><td width="20%"><code>"nbin"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Noncentral F-Distribution"</code></td><td width="5%"></td><td width="20%"><code>"ncf"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Noncentral Student T"</code></td><td width="5%"></td><td width="20%"><code>"nct"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Noncentral Chi-Squared"</code></td><td width="5%"></td><td width="20%"><code>"ncx2"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Normal"</code></td><td width="5%"></td><td width="20%"><code>"norm"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Poisson"</code></td><td width="5%"></td><td width="20%"><code>"poiss"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Rayleigh"</code></td><td width="5%"></td><td width="20%"><code>"rayl"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Rician"</code></td><td width="5%"></td><td width="20%"><code>"rice"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Student T"</code></td><td width="5%"></td><td width="20%"><code>"t"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"location-scale T"</code></td><td width="5%"></td><td width="20%"><code>"tls"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Triangular"</code></td><td width="5%"></td><td width="20%"><code>"tri"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Discrete Uniform"</code></td><td width="5%"></td><td width="20%"><code>"unid"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Uniform"</code></td><td width="5%"></td><td width="20%"><code>"unif"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Von Mises"</code></td><td width="5%"></td><td width="20%"><code>"vm"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Weibull"</code></td><td width="5%"></td><td width="20%"><code>"wbl"</code></td><td width="5%"></td><td width="30%">2</td></tr> </table> -<p> A <code>BinomialDistribution</code> object contains the following methods: - <code>cdf</code>, <code>icdf</code>, <code>iqr</code>, <code>mean</code>, <code>median</code>, - <code>negloglik</code>, <code>paramci</code>, <code>pdf</code>, <code>plot</code>, <code>proflik</code>, - <code>random</code>, <code>std</code>, <code>truncate</code>, <code>var</code>. -</p> -<p> Further information about the binomial distribution can be found at - <a href="https://en.wikipedia.org/wiki/Binomial_distribution">https://en.wikipedia.org/wiki/Binomial_distribution</a> -</p> <p> <strong>See also: </strong> - <a href="fitdist.html">fitdist</a>, - <a href="makedist.html">makedist</a>, + <a href="icdf.html">icdf</a>, + <a href="pdf.html">pdf</a>, + <a href="cdf.html">cdf</a>, + <a href="betacdf.html">betacdf</a>, <a href="binocdf.html">binocdf</a>, - <a href="binoinv.html">binoinv</a>, - <a href="binopdf.html">binopdf</a>, - <a href="binornd.html">binornd</a>, - <a href="binofit.html">binofit</a>, - <a href="binolike.html">binolike</a>, - <a href="binostat.html">binostat</a> + <a href="bisacdf.html">bisacdf</a>, + <a href="burrcdf.html">burrcdf</a>, + <a href="cauchycdf.html">cauchycdf</a>, + <a href="chi2cdf.html">chi2cdf</a>, + <a href="evcdf.html">evcdf</a>, + <a href="expcdf.html">expcdf</a>, + <a href="fcdf.html">fcdf</a>, + <a href="gamcdf.html">gamcdf</a>, + <a href="geocdf.html">geocdf</a>, + <a href="gevcdf.html">gevcdf</a>, + <a href="gpcdf.html">gpcdf</a>, + <a href="gumbelcdf.html">gumbelcdf</a>, + <a href="hncdf.html">hncdf</a>, + <a href="hygecdf.html">hygecdf</a>, + <a href="invgcdf.html">invgcdf</a>, + <a href="laplacecdf.html">laplacecdf</a>, + <a href="logicdf.html">logicdf</a>, + <a href="loglcdf.html">loglcdf</a>, + <a href="logncdf.html">logncdf</a>, + <a href="nakacdf.html">nakacdf</a>, + <a href="nbincdf.html">nbincdf</a>, + <a href="ncfcdf.html">ncfcdf</a>, + <a href="nctcdf.html">nctcdf</a>, + <a href="ncx2cdf.html">ncx2cdf</a>, + <a href="normcdf.html">normcdf</a>, + <a href="poisscdf.html">poisscdf</a>, + <a href="raylcdf.html">raylcdf</a>, + <a href="ricecdf.html">ricecdf</a>, + <a href="tcdf.html">tcdf</a>, + <a href="tlscdf.html">tlscdf</a>, + <a href="tricdf.html">tricdf</a>, + <a href="unidcdf.html">unidcdf</a>, + <a href="unifcdf.html">unifcdf</a>, + <a href="vmcdf.html">vmcdf</a>, + <a href="wblcdf.html">wblcdf</a> </p> <p><strong>Source Code: </strong> <a href="https://github.com/gnu-octave/statistics/tree/main/inst/dist_obj/BinomialDistribution.m">BinomialDistribution</a> @@ -141,39 +201,6 @@ <div class="row d-flex flex-wrap align-items-center"> <div class="col-sm-3 col-md-5 mb-2 mb-sm-0"> <h3 class="d-inline-block mr-2"> - Method: <b><code>cdf</code></b> - </h3> - </div> - </div> - </div> - <div class="card-body"> -<dl> -<dt><u>BinomialDistribution:</u> <var>p</var> = <b>icdf</b><i> (<var>pd</var>, <var>p</var>)</i></dt> -</dl> - -<p> Compute the cumulative distribution function (CDF). -</p> -<div class="ms-5"> -<p> <code><var>p</var> = icdf (<var>pd</var>, <var>x</var>)</code> computes the quantile (the - inverse of the CDF) of the probability distribution object, <var>pd</var>, - evaluated at the values in <var>x</var>. -</p> - -</div> - - </div> - </div> - </div> - - - - - <div class="container-xl my-4"> - <div class="card rounded"> - <div class="card-header card-header-mod"> - <div class="row d-flex flex-wrap align-items-center"> - <div class="col-sm-3 col-md-5 mb-2 mb-sm-0"> - <h3 class="d-inline-block mr-2"> Method: <b><code>icdf</code></b> </h3> </div> @@ -227,7 +254,6 @@ </div> </div> - <div class="container-xl my-4"> <div class="card rounded"> <div class="card-header card-header-mod"> diff --git a/docs/BirnbaumSaundersDistribution.html b/docs/BirnbaumSaundersDistribution.html index 5efdb71..5326706 100644 --- a/docs/BirnbaumSaundersDistribution.html +++ b/docs/BirnbaumSaundersDistribution.html @@ -71,68 +71,126 @@ </div> <div class="card-body"> <dl> -<dt><u>statistics:</u> BirnbaumSaundersDistribution</dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>, <var>C</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (…, <code>"upper"</code>)</i></dt> </dl> -<p> Gamma probability distribution object. +<p> Return the CDF of a univariate distribution evaluated at <var>x</var>. </p> <div class="ms-5"> -<p> A <code>BirnbaumSaundersDistribution</code> object consists of parameters, a - model description, and sample data for a gamma probability distribution. +<p> <code>cdf</code> is a wrapper for the univariate cumulative distribution functions + available in the statistics package. See the corresponding functions’ help + to learn the signification of the parameters after <var>x</var>. </p> -<p> The gamma distribution uses the following parameters. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>)</code> returns the CDF for the + one-parameter distribution family specified by <var>name</var> and the + distribution parameter <var>A</var>, evaluated at the values in <var>x</var>. </p> - <table> -<thead><tr><th width="25%"><var>Parameter</var></th><th width="48%"><var>Description</var></th><th width="27%"><var>Support</var></th></tr></thead> -<tr><td width="25%"><code>a</code></td><td width="48%">Shape parameter</td><td width="27%"><math>α > 0</math></td></tr> -<tr><td width="25%"><code>b</code></td><td width="48%">Scale parameter</td><td width="27%"><math>β > 0</math></td></tr> -</table> - -<p> There are several ways to create a <code>BirnbaumSaundersDistribution</code> - object. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>)</code> returns the CDF + for the two-parameter distribution family specified by <var>name</var> and the + distribution parameters <var>A</var> and <var>B</var>, evaluated at the values in + <var>x</var>. </p> - <ul> -<li> Fit a distribution to data using the <code>fitdist</code> function. - </li><li> Create a distribution with specified parameter values using the - <code>makedist</code> function. - </li><li> Use the constructor <code>BirnbaumSaundersDistribution (<var>a</var>, - <var>b</var>)</code> to create a gamma distribution with specified parameter values. - </li><li> Use the static method <code>BirnbaumSaundersDistribution.fit - (<var>x</var>, <var>censor</var>, <var>freq</var>, <var>options</var>)</code> to a distribution to - data <var>x</var>. - </li></ul> - -<p> It is highly recommended to use <code>fitdist</code> and <code>makedist</code> - functions to create probability distribution objects, instead of the - constructor and the aforementioned static method. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>, <var>C</var>)</code> returns + the CDF for the three-parameter distribution family specified by <var>name</var> + and the distribution parameters <var>A</var>, <var>B</var>, and <var>C</var>, evaluated at + the values in <var>x</var>. +</p> +<p> <code><var>p</var> = cdf (…, <code>"upper"</code>)</code> returns the complement of the + CDF using an algorithm that more accurately computes the extreme upper-tail + probabilities. <code>"upper"</code> can follow any of the input arguments in the + previous syntaxes. </p> -<p> A <code>BirnbaumSaundersDistribution</code> object contains the following - properties, which can be accessed using dot notation. +<p> <var>name</var> must be a char string of the name or the abbreviation of the + desired cumulative distribution function as listed in the followng table. + The last column shows the number of required parameters that should be parsed + after <var>x</var> to the desired CDF. The optional input argument + <code>"upper"</code> does not count in the required number of parameters. </p> <table> -<tr><td width="25%"><code>DistributionName</code></td><td width="25%"><code>DistributionCode</code></td><td width="25%"><code>NumParameters</code></td><td width="25%"><code>ParameterNames</code></td></tr> -<tr><td width="25%"><code>ParameterDescription</code></td><td width="25%"><code>ParameterValues</code></td><td width="25%"><code>ParameterValues</code></td><td width="25%"><code>ParameterCI</code></td></tr> -<tr><td width="25%"><code>ParameterIsFixed</code></td><td width="25%"><code>Truncation</code></td><td width="25%"><code>IsTruncated</code></td><td width="25%"><code>InputData</code></td></tr> +<thead><tr><th width="40%">Distribution Name</th><th width="5%"></th><th width="20%">Abbreviation</th><th width="5%"></th><th width="30%">Input Parameters</th></tr></thead> +<tr><td width="40%"><code>"Beta"</code></td><td width="5%"></td><td width="20%"><code>"beta"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Binomial"</code></td><td width="5%"></td><td width="20%"><code>"bino"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Birnbaum-Saunders"</code></td><td width="5%"></td><td width="20%"><code>"bisa"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Burr"</code></td><td width="5%"></td><td width="20%"><code>"burr"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Cauchy"</code></td><td width="5%"></td><td width="20%"><code>"cauchy"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Chi-squared"</code></td><td width="5%"></td><td width="20%"><code>"chi2"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Extreme Value"</code></td><td width="5%"></td><td width="20%"><code>"ev"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Exponential"</code></td><td width="5%"></td><td width="20%"><code>"exp"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"F-Distribution"</code></td><td width="5%"></td><td width="20%"><code>"f"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Gamma"</code></td><td width="5%"></td><td width="20%"><code>"gam"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Geometric"</code></td><td width="5%"></td><td width="20%"><code>"geo"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Generalized Extreme Value"</code></td><td width="5%"></td><td width="20%"><code>"gev"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Generalized Pareto"</code></td><td width="5%"></td><td width="20%"><code>"gp"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Gumbel"</code></td><td width="5%"></td><td width="20%"><code>"gumbel"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Half-normal"</code></td><td width="5%"></td><td width="20%"><code>"hn"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Hypergeometric"</code></td><td width="5%"></td><td width="20%"><code>"hyge"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Inverse Gaussian"</code></td><td width="5%"></td><td width="20%"><code>"invg"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Laplace"</code></td><td width="5%"></td><td width="20%"><code>"laplace"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Logistic"</code></td><td width="5%"></td><td width="20%"><code>"logi"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Log-Logistic"</code></td><td width="5%"></td><td width="20%"><code>"logl"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Lognormal"</code></td><td width="5%"></td><td width="20%"><code>"logn"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Nakagami"</code></td><td width="5%"></td><td width="20%"><code>"naka"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Negative Binomial"</code></td><td width="5%"></td><td width="20%"><code>"nbin"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Noncentral F-Distribution"</code></td><td width="5%"></td><td width="20%"><code>"ncf"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Noncentral Student T"</code></td><td width="5%"></td><td width="20%"><code>"nct"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Noncentral Chi-Squared"</code></td><td width="5%"></td><td width="20%"><code>"ncx2"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Normal"</code></td><td width="5%"></td><td width="20%"><code>"norm"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Poisson"</code></td><td width="5%"></td><td width="20%"><code>"poiss"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Rayleigh"</code></td><td width="5%"></td><td width="20%"><code>"rayl"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Rician"</code></td><td width="5%"></td><td width="20%"><code>"rice"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Student T"</code></td><td width="5%"></td><td width="20%"><code>"t"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"location-scale T"</code></td><td width="5%"></td><td width="20%"><code>"tls"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Triangular"</code></td><td width="5%"></td><td width="20%"><code>"tri"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Discrete Uniform"</code></td><td width="5%"></td><td width="20%"><code>"unid"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Uniform"</code></td><td width="5%"></td><td width="20%"><code>"unif"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Von Mises"</code></td><td width="5%"></td><td width="20%"><code>"vm"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Weibull"</code></td><td width="5%"></td><td width="20%"><code>"wbl"</code></td><td width="5%"></td><td width="30%">2</td></tr> </table> -<p> A <code>BirnbaumSaundersDistribution</code> object contains the following methods: - <code>cdf</code>, <code>icdf</code>, <code>iqr</code>, <code>mean</code>, <code>median</code>, - <code>negloglik</code>, <code>paramci</code>, <code>pdf</code>, <code>plot</code>, <code>proflik</code>, - <code>random</code>, <code>std</code>, <code>truncate</code>, <code>var</code>. -</p> -<p> Further information about the Birnbaum-Saunders distribution can be found at - <a href="https://en.wikipedia.org/wiki/Birnbaum%E2%80%93Saunders_distribution">https://en.wikipedia.org/wiki/Birnbaum%E2%80%93Saunders_distribution</a> -</p> <p> <strong>See also: </strong> - <a href="fitdist.html">fitdist</a>, - <a href="makedist.html">makedist</a>, + <a href="icdf.html">icdf</a>, + <a href="pdf.html">pdf</a>, + <a href="cdf.html">cdf</a>, + <a href="betacdf.html">betacdf</a>, + <a href="binocdf.html">binocdf</a>, <a href="bisacdf.html">bisacdf</a>, - <a href="bisainv.html">bisainv</a>, - <a href="bisapdf.html">bisapdf</a>, - <a href="bisarnd.html">bisarnd</a>, - <a href="lognfit.html">lognfit</a>, - <a href="bisalike.html">bisalike</a>, - <a href="bisastat.html">bisastat</a> + <a href="burrcdf.html">burrcdf</a>, + <a href="cauchycdf.html">cauchycdf</a>, + <a href="chi2cdf.html">chi2cdf</a>, + <a href="evcdf.html">evcdf</a>, + <a href="expcdf.html">expcdf</a>, + <a href="fcdf.html">fcdf</a>, + <a href="gamcdf.html">gamcdf</a>, + <a href="geocdf.html">geocdf</a>, + <a href="gevcdf.html">gevcdf</a>, + <a href="gpcdf.html">gpcdf</a>, + <a href="gumbelcdf.html">gumbelcdf</a>, + <a href="hncdf.html">hncdf</a>, + <a href="hygecdf.html">hygecdf</a>, + <a href="invgcdf.html">invgcdf</a>, + <a href="laplacecdf.html">laplacecdf</a>, + <a href="logicdf.html">logicdf</a>, + <a href="loglcdf.html">loglcdf</a>, + <a href="logncdf.html">logncdf</a>, + <a href="nakacdf.html">nakacdf</a>, + <a href="nbincdf.html">nbincdf</a>, + <a href="ncfcdf.html">ncfcdf</a>, + <a href="nctcdf.html">nctcdf</a>, + <a href="ncx2cdf.html">ncx2cdf</a>, + <a href="normcdf.html">normcdf</a>, + <a href="poisscdf.html">poisscdf</a>, + <a href="raylcdf.html">raylcdf</a>, + <a href="ricecdf.html">ricecdf</a>, + <a href="tcdf.html">tcdf</a>, + <a href="tlscdf.html">tlscdf</a>, + <a href="tricdf.html">tricdf</a>, + <a href="unidcdf.html">unidcdf</a>, + <a href="unifcdf.html">unifcdf</a>, + <a href="vmcdf.html">vmcdf</a>, + <a href="wblcdf.html">wblcdf</a> </p> <p><strong>Source Code: </strong> <a href="https://github.com/gnu-octave/statistics/tree/main/inst/dist_obj/BirnbaumSaundersDistribution.m">BirnbaumSaundersDistribution</a> @@ -143,39 +201,6 @@ <div class="row d-flex flex-wrap align-items-center"> <div class="col-sm-3 col-md-5 mb-2 mb-sm-0"> <h3 class="d-inline-block mr-2"> - Method: <b><code>cdf</code></b> - </h3> - </div> - </div> - </div> - <div class="card-body"> -<dl> -<dt><u>BirnbaumSaundersDistribution:</u> <var>p</var> = <b>icdf</b><i> (<var>pd</var>, <var>p</var>)</i></dt> -</dl> - -<p> Compute the cumulative distribution function (CDF). -</p> -<div class="ms-5"> -<p> <code><var>p</var> = icdf (<var>pd</var>, <var>x</var>)</code> computes the quantile (the - inverse of the CDF) of the probability distribution object, <var>pd</var>, - evaluated at the values in <var>x</var>. -</p> - -</div> - - </div> - </div> - </div> - - - - - <div class="container-xl my-4"> - <div class="card rounded"> - <div class="card-header card-header-mod"> - <div class="row d-flex flex-wrap align-items-center"> - <div class="col-sm-3 col-md-5 mb-2 mb-sm-0"> - <h3 class="d-inline-block mr-2"> Method: <b><code>icdf</code></b> </h3> </div> @@ -229,7 +254,6 @@ </div> </div> - <div class="container-xl my-4"> <div class="card rounded"> <div class="card-header card-header-mod"> diff --git a/docs/BurrDistribution.html b/docs/BurrDistribution.html index 1274516..832e198 100644 --- a/docs/BurrDistribution.html +++ b/docs/BurrDistribution.html @@ -71,69 +71,126 @@ </div> <div class="card-body"> <dl> -<dt><u>statistics:</u> BurrDistribution</dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>, <var>C</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (…, <code>"upper"</code>)</i></dt> </dl> -<p> Burr probability distribution object. +<p> Return the CDF of a univariate distribution evaluated at <var>x</var>. </p> <div class="ms-5"> -<p> A <code>BurrDistribution</code> object consists of parameters, a model - description, and sample data for a Burr probability distribution. +<p> <code>cdf</code> is a wrapper for the univariate cumulative distribution functions + available in the statistics package. See the corresponding functions’ help + to learn the signification of the parameters after <var>x</var>. </p> -<p> The Burr distribution uses the following parameters. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>)</code> returns the CDF for the + one-parameter distribution family specified by <var>name</var> and the + distribution parameter <var>A</var>, evaluated at the values in <var>x</var>. </p> - <table> -<thead><tr><th width="25%"><var>Parameter</var></th><th width="48%"><var>Description</var></th><th width="27%"><var>Support</var></th></tr></thead> -<tr><td width="25%"><code>alpha</code></td><td width="48%">Shape</td><td width="27%"><math>-Inf < alpha < Inf</math></td></tr> -<tr><td width="25%"><code>c</code></td><td width="48%">Scale</td><td width="27%"><math>c > 0</math></td></tr> -<tr><td width="25%"><code>k</code></td><td width="48%">Location</td><td width="27%"><math>-Inf < k < Inf</math></td></tr> -</table> - -<p> There are several ways to create a <code>BurrDistribution</code> object. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>)</code> returns the CDF + for the two-parameter distribution family specified by <var>name</var> and the + distribution parameters <var>A</var> and <var>B</var>, evaluated at the values in + <var>x</var>. </p> - <ul> -<li> Fit a distribution to data using the <code>fitdist</code> function. - </li><li> Create a distribution with specified parameter values using the - <code>makedist</code> function. - </li><li> Use the constructor <code>BurrDistribution (<var>alpha</var>, <var>c</var>)</code> - to create a generalized extreme value distribution - with specified parameter values. - </li><li> Use the static method <code>BurrDistribution.fit - (<var>x</var>, <var>alpha</var>, <var>freq</var>)</code> to a distribution to data <var>x</var>. - </li></ul> - -<p> It is highly recommended to use <code>fitdist</code> and <code>makedist</code> - functions to create probability distribution objects, instead of the - constructor and the aforementioned static method. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>, <var>C</var>)</code> returns + the CDF for the three-parameter distribution family specified by <var>name</var> + and the distribution parameters <var>A</var>, <var>B</var>, and <var>C</var>, evaluated at + the values in <var>x</var>. +</p> +<p> <code><var>p</var> = cdf (…, <code>"upper"</code>)</code> returns the complement of the + CDF using an algorithm that more accurately computes the extreme upper-tail + probabilities. <code>"upper"</code> can follow any of the input arguments in the + previous syntaxes. </p> -<p> A <code>BurrDistribution</code> object contains the following - properties, which can be accessed using dot notation. +<p> <var>name</var> must be a char string of the name or the abbreviation of the + desired cumulative distribution function as listed in the followng table. + The last column shows the number of required parameters that should be parsed + after <var>x</var> to the desired CDF. The optional input argument + <code>"upper"</code> does not count in the required number of parameters. </p> <table> -<tr><td width="25%"><code>DistributionName</code></td><td width="25%"><code>DistributionCode</code></td><td width="25%"><code>NumParameters</code></td><td width="25%"><code>ParameterNames</code></td></tr> -<tr><td width="25%"><code>ParameterDescription</code></td><td width="25%"><code>ParameterValues</code></td><td width="25%"><code>ParameterValues</code></td><td width="25%"><code>ParameterCI</code></td></tr> -<tr><td width="25%"><code>ParameterIsFixed</code></td><td width="25%"><code>Truncation</code></td><td width="25%"><code>IsTruncated</code></td><td width="25%"><code>InputData</code></td></tr> +<thead><tr><th width="40%">Distribution Name</th><th width="5%"></th><th width="20%">Abbreviation</th><th width="5%"></th><th width="30%">Input Parameters</th></tr></thead> +<tr><td width="40%"><code>"Beta"</code></td><td width="5%"></td><td width="20%"><code>"beta"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Binomial"</code></td><td width="5%"></td><td width="20%"><code>"bino"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Birnbaum-Saunders"</code></td><td width="5%"></td><td width="20%"><code>"bisa"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Burr"</code></td><td width="5%"></td><td width="20%"><code>"burr"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Cauchy"</code></td><td width="5%"></td><td width="20%"><code>"cauchy"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Chi-squared"</code></td><td width="5%"></td><td width="20%"><code>"chi2"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Extreme Value"</code></td><td width="5%"></td><td width="20%"><code>"ev"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Exponential"</code></td><td width="5%"></td><td width="20%"><code>"exp"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"F-Distribution"</code></td><td width="5%"></td><td width="20%"><code>"f"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Gamma"</code></td><td width="5%"></td><td width="20%"><code>"gam"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Geometric"</code></td><td width="5%"></td><td width="20%"><code>"geo"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Generalized Extreme Value"</code></td><td width="5%"></td><td width="20%"><code>"gev"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Generalized Pareto"</code></td><td width="5%"></td><td width="20%"><code>"gp"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Gumbel"</code></td><td width="5%"></td><td width="20%"><code>"gumbel"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Half-normal"</code></td><td width="5%"></td><td width="20%"><code>"hn"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Hypergeometric"</code></td><td width="5%"></td><td width="20%"><code>"hyge"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Inverse Gaussian"</code></td><td width="5%"></td><td width="20%"><code>"invg"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Laplace"</code></td><td width="5%"></td><td width="20%"><code>"laplace"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Logistic"</code></td><td width="5%"></td><td width="20%"><code>"logi"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Log-Logistic"</code></td><td width="5%"></td><td width="20%"><code>"logl"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Lognormal"</code></td><td width="5%"></td><td width="20%"><code>"logn"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Nakagami"</code></td><td width="5%"></td><td width="20%"><code>"naka"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Negative Binomial"</code></td><td width="5%"></td><td width="20%"><code>"nbin"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Noncentral F-Distribution"</code></td><td width="5%"></td><td width="20%"><code>"ncf"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Noncentral Student T"</code></td><td width="5%"></td><td width="20%"><code>"nct"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Noncentral Chi-Squared"</code></td><td width="5%"></td><td width="20%"><code>"ncx2"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Normal"</code></td><td width="5%"></td><td width="20%"><code>"norm"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Poisson"</code></td><td width="5%"></td><td width="20%"><code>"poiss"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Rayleigh"</code></td><td width="5%"></td><td width="20%"><code>"rayl"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Rician"</code></td><td width="5%"></td><td width="20%"><code>"rice"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Student T"</code></td><td width="5%"></td><td width="20%"><code>"t"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"location-scale T"</code></td><td width="5%"></td><td width="20%"><code>"tls"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Triangular"</code></td><td width="5%"></td><td width="20%"><code>"tri"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Discrete Uniform"</code></td><td width="5%"></td><td width="20%"><code>"unid"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Uniform"</code></td><td width="5%"></td><td width="20%"><code>"unif"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Von Mises"</code></td><td width="5%"></td><td width="20%"><code>"vm"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Weibull"</code></td><td width="5%"></td><td width="20%"><code>"wbl"</code></td><td width="5%"></td><td width="30%">2</td></tr> </table> -<p> A <code>BurrDistribution</code> object contains the following - methods: - <code>cdf</code>, <code>icdf</code>, <code>iqr</code>, <code>mean</code>, <code>median</code>, - <code>negloglik</code>, <code>paramci</code>, <code>pdf</code>, <code>plot</code>, <code>proflik</code>, - <code>random</code>, <code>std</code>, <code>truncate</code>, <code>var</code>. -</p> -<p> Further information about the Burr distribution can be found at - <a href="https://en.wikipedia.org/wiki/Burr_distribution">https://en.wikipedia.org/wiki/Burr_distribution</a> -</p> <p> <strong>See also: </strong> - <a href="fitdist.html">fitdist</a>, - <a href="makedist.html">makedist</a>, + <a href="icdf.html">icdf</a>, + <a href="pdf.html">pdf</a>, + <a href="cdf.html">cdf</a>, + <a href="betacdf.html">betacdf</a>, + <a href="binocdf.html">binocdf</a>, + <a href="bisacdf.html">bisacdf</a>, <a href="burrcdf.html">burrcdf</a>, - <a href="burrinv.html">burrinv</a>, - <a href="burrpdf.html">burrpdf</a>, - <a href="burrrnd.html">burrrnd</a>, - <a href="burrfit.html">burrfit</a>, - <a href="burrlike.html">burrlike</a>, - <a href="burrstat.html">burrstat</a> + <a href="cauchycdf.html">cauchycdf</a>, + <a href="chi2cdf.html">chi2cdf</a>, + <a href="evcdf.html">evcdf</a>, + <a href="expcdf.html">expcdf</a>, + <a href="fcdf.html">fcdf</a>, + <a href="gamcdf.html">gamcdf</a>, + <a href="geocdf.html">geocdf</a>, + <a href="gevcdf.html">gevcdf</a>, + <a href="gpcdf.html">gpcdf</a>, + <a href="gumbelcdf.html">gumbelcdf</a>, + <a href="hncdf.html">hncdf</a>, + <a href="hygecdf.html">hygecdf</a>, + <a href="invgcdf.html">invgcdf</a>, + <a href="laplacecdf.html">laplacecdf</a>, + <a href="logicdf.html">logicdf</a>, + <a href="loglcdf.html">loglcdf</a>, + <a href="logncdf.html">logncdf</a>, + <a href="nakacdf.html">nakacdf</a>, + <a href="nbincdf.html">nbincdf</a>, + <a href="ncfcdf.html">ncfcdf</a>, + <a href="nctcdf.html">nctcdf</a>, + <a href="ncx2cdf.html">ncx2cdf</a>, + <a href="normcdf.html">normcdf</a>, + <a href="poisscdf.html">poisscdf</a>, + <a href="raylcdf.html">raylcdf</a>, + <a href="ricecdf.html">ricecdf</a>, + <a href="tcdf.html">tcdf</a>, + <a href="tlscdf.html">tlscdf</a>, + <a href="tricdf.html">tricdf</a>, + <a href="unidcdf.html">unidcdf</a>, + <a href="unifcdf.html">unifcdf</a>, + <a href="vmcdf.html">vmcdf</a>, + <a href="wblcdf.html">wblcdf</a> </p> <p><strong>Source Code: </strong> <a href="https://github.com/gnu-octave/statistics/tree/main/inst/dist_obj/BurrDistribution.m">BurrDistribution</a> @@ -144,39 +201,6 @@ <div class="row d-flex flex-wrap align-items-center"> <div class="col-sm-3 col-md-5 mb-2 mb-sm-0"> <h3 class="d-inline-block mr-2"> - Method: <b><code>cdf</code></b> - </h3> - </div> - </div> - </div> - <div class="card-body"> -<dl> -<dt><u>BurrDistribution:</u> <var>p</var> = <b>icdf</b><i> (<var>pd</var>, <var>p</var>)</i></dt> -</dl> - -<p> Compute the cumulative distribution function (CDF). -</p> -<div class="ms-5"> -<p> <code><var>p</var> = icdf (<var>pd</var>, <var>x</var>)</code> computes the quantile (the - inverse of the CDF) of the probability distribution object, <var>pd</var>, - evaluated at the values in <var>x</var>. -</p> - -</div> - - </div> - </div> - </div> - - - - - <div class="container-xl my-4"> - <div class="card rounded"> - <div class="card-header card-header-mod"> - <div class="row d-flex flex-wrap align-items-center"> - <div class="col-sm-3 col-md-5 mb-2 mb-sm-0"> - <h3 class="d-inline-block mr-2"> Method: <b><code>icdf</code></b> </h3> </div> @@ -230,7 +254,6 @@ </div> </div> - <div class="container-xl my-4"> <div class="card rounded"> <div class="card-header card-header-mod"> diff --git a/docs/CalinskiHarabaszEvaluation.html b/docs/CalinskiHarabaszEvaluation.html index ff910f2..616dc8c 100644 --- a/docs/CalinskiHarabaszEvaluation.html +++ b/docs/CalinskiHarabaszEvaluation.html @@ -154,8 +154,6 @@ </div> - - <div class="container-xl my-4"> <div class="card rounded"> <div class="card-header card-header-mod"> diff --git a/docs/ClusterCriterion.html b/docs/ClusterCriterion.html index 7970d08..8f72a91 100644 --- a/docs/ClusterCriterion.html +++ b/docs/ClusterCriterion.html @@ -215,7 +215,6 @@ </div> - <div class="container-xl my-4"> <div class="card rounded"> <div class="card-header card-header-mod"> diff --git a/docs/ConfusionMatrixChart.html b/docs/ConfusionMatrixChart.html index c393748..f385a79 100644 --- a/docs/ConfusionMatrixChart.html +++ b/docs/ConfusionMatrixChart.html @@ -121,7 +121,6 @@ <a href="https://github.com/gnu-octave/statistics/tree/main/inst/Classification/ConfusionMatrixChart.m">ConfusionMatrixChart</a> </div> - <div class="container-xl my-4"> <div class="card rounded"> <div class="card-header card-header-mod"> @@ -148,8 +147,6 @@ </div> </div> - - <div class="container-xl my-4"> <div class="card rounded"> <div class="card-header card-header-mod"> @@ -181,10 +178,6 @@ </div> </div> - - - - <div class="container-xl my-4"> <div class="card rounded"> <div class="card-header card-header-mod"> diff --git a/docs/DaviesBouldinEvaluation.html b/docs/DaviesBouldinEvaluation.html index 922b00b..a7250e8 100644 --- a/docs/DaviesBouldinEvaluation.html +++ b/docs/DaviesBouldinEvaluation.html @@ -152,8 +152,6 @@ </div> - - <div class="container-xl my-4"> <div class="card rounded"> <div class="card-header card-header-mod"> diff --git a/docs/ExponentialDistribution.html b/docs/ExponentialDistribution.html index 2c597e9..4aefdb5 100644 --- a/docs/ExponentialDistribution.html +++ b/docs/ExponentialDistribution.html @@ -71,65 +71,126 @@ </div> <div class="card-body"> <dl> -<dt><u>statistics:</u> ExponentialDistribution</dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>, <var>C</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (…, <code>"upper"</code>)</i></dt> </dl> -<p> Exponential probability distribution object. +<p> Return the CDF of a univariate distribution evaluated at <var>x</var>. </p> <div class="ms-5"> -<p> A <code>ExponentialDistribution</code> object consists of parameters, a model - description, and sample data for a exponential probability distribution. +<p> <code>cdf</code> is a wrapper for the univariate cumulative distribution functions + available in the statistics package. See the corresponding functions’ help + to learn the signification of the parameters after <var>x</var>. </p> -<p> The exponential distribution uses the following parameters. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>)</code> returns the CDF for the + one-parameter distribution family specified by <var>name</var> and the + distribution parameter <var>A</var>, evaluated at the values in <var>x</var>. </p> - <table> -<thead><tr><th width="25%"><var>Parameter</var></th><th width="48%"><var>Description</var></th><th width="27%"><var>Support</var></th></tr></thead> -<tr><td width="25%"><code>mu</code></td><td width="48%">Mean</td><td width="27%"><math>mu > 0</math></td></tr> -</table> - -<p> There are several ways to create a <code>ExponentialDistribution</code> object. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>)</code> returns the CDF + for the two-parameter distribution family specified by <var>name</var> and the + distribution parameters <var>A</var> and <var>B</var>, evaluated at the values in + <var>x</var>. </p> - <ul> -<li> Fit a distribution to data using the <code>fitdist</code> function. - </li><li> Create a distribution with specified parameter values using the - <code>makedist</code> function. - </li><li> Use the constructor <code>ExponentialDistribution (<var>mu</var>)</code> - to create a exponential distribution with specified parameter values. - </li><li> Use the static method <code>ExponentialDistribution.fit (<var>x</var>, - <var>censor</var>, <var>freq</var>, <var>options</var>)</code> to a distribution to data <var>x</var>. - </li></ul> - -<p> It is highly recommended to use <code>fitdist</code> and <code>makedist</code> - functions to create probability distribution objects, instead of the - constructor and the aforementioned static method. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>, <var>C</var>)</code> returns + the CDF for the three-parameter distribution family specified by <var>name</var> + and the distribution parameters <var>A</var>, <var>B</var>, and <var>C</var>, evaluated at + the values in <var>x</var>. +</p> +<p> <code><var>p</var> = cdf (…, <code>"upper"</code>)</code> returns the complement of the + CDF using an algorithm that more accurately computes the extreme upper-tail + probabilities. <code>"upper"</code> can follow any of the input arguments in the + previous syntaxes. </p> -<p> A <code>ExponentialDistribution</code> object contains the following properties, - which can be accessed using dot notation. +<p> <var>name</var> must be a char string of the name or the abbreviation of the + desired cumulative distribution function as listed in the followng table. + The last column shows the number of required parameters that should be parsed + after <var>x</var> to the desired CDF. The optional input argument + <code>"upper"</code> does not count in the required number of parameters. </p> <table> -<tr><td width="25%"><code>DistributionName</code></td><td width="25%"><code>DistributionCode</code></td><td width="25%"><code>NumParameters</code></td><td width="25%"><code>ParameterNames</code></td></tr> -<tr><td width="25%"><code>ParameterDescription</code></td><td width="25%"><code>ParameterValues</code></td><td width="25%"><code>ParameterValues</code></td><td width="25%"><code>ParameterCI</code></td></tr> -<tr><td width="25%"><code>ParameterIsFixed</code></td><td width="25%"><code>Truncation</code></td><td width="25%"><code>IsTruncated</code></td><td width="25%"><code>InputData</code></td></tr> +<thead><tr><th width="40%">Distribution Name</th><th width="5%"></th><th width="20%">Abbreviation</th><th width="5%"></th><th width="30%">Input Parameters</th></tr></thead> +<tr><td width="40%"><code>"Beta"</code></td><td width="5%"></td><td width="20%"><code>"beta"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Binomial"</code></td><td width="5%"></td><td width="20%"><code>"bino"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Birnbaum-Saunders"</code></td><td width="5%"></td><td width="20%"><code>"bisa"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Burr"</code></td><td width="5%"></td><td width="20%"><code>"burr"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Cauchy"</code></td><td width="5%"></td><td width="20%"><code>"cauchy"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Chi-squared"</code></td><td width="5%"></td><td width="20%"><code>"chi2"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Extreme Value"</code></td><td width="5%"></td><td width="20%"><code>"ev"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Exponential"</code></td><td width="5%"></td><td width="20%"><code>"exp"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"F-Distribution"</code></td><td width="5%"></td><td width="20%"><code>"f"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Gamma"</code></td><td width="5%"></td><td width="20%"><code>"gam"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Geometric"</code></td><td width="5%"></td><td width="20%"><code>"geo"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Generalized Extreme Value"</code></td><td width="5%"></td><td width="20%"><code>"gev"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Generalized Pareto"</code></td><td width="5%"></td><td width="20%"><code>"gp"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Gumbel"</code></td><td width="5%"></td><td width="20%"><code>"gumbel"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Half-normal"</code></td><td width="5%"></td><td width="20%"><code>"hn"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Hypergeometric"</code></td><td width="5%"></td><td width="20%"><code>"hyge"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Inverse Gaussian"</code></td><td width="5%"></td><td width="20%"><code>"invg"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Laplace"</code></td><td width="5%"></td><td width="20%"><code>"laplace"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Logistic"</code></td><td width="5%"></td><td width="20%"><code>"logi"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Log-Logistic"</code></td><td width="5%"></td><td width="20%"><code>"logl"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Lognormal"</code></td><td width="5%"></td><td width="20%"><code>"logn"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Nakagami"</code></td><td width="5%"></td><td width="20%"><code>"naka"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Negative Binomial"</code></td><td width="5%"></td><td width="20%"><code>"nbin"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Noncentral F-Distribution"</code></td><td width="5%"></td><td width="20%"><code>"ncf"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Noncentral Student T"</code></td><td width="5%"></td><td width="20%"><code>"nct"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Noncentral Chi-Squared"</code></td><td width="5%"></td><td width="20%"><code>"ncx2"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Normal"</code></td><td width="5%"></td><td width="20%"><code>"norm"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Poisson"</code></td><td width="5%"></td><td width="20%"><code>"poiss"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Rayleigh"</code></td><td width="5%"></td><td width="20%"><code>"rayl"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Rician"</code></td><td width="5%"></td><td width="20%"><code>"rice"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Student T"</code></td><td width="5%"></td><td width="20%"><code>"t"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"location-scale T"</code></td><td width="5%"></td><td width="20%"><code>"tls"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Triangular"</code></td><td width="5%"></td><td width="20%"><code>"tri"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Discrete Uniform"</code></td><td width="5%"></td><td width="20%"><code>"unid"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Uniform"</code></td><td width="5%"></td><td width="20%"><code>"unif"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Von Mises"</code></td><td width="5%"></td><td width="20%"><code>"vm"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Weibull"</code></td><td width="5%"></td><td width="20%"><code>"wbl"</code></td><td width="5%"></td><td width="30%">2</td></tr> </table> -<p> A <code>ExponentialDistribution</code> object contains the following methods: - <code>cdf</code>, <code>icdf</code>, <code>iqr</code>, <code>mean</code>, <code>median</code>, - <code>negloglik</code>, <code>paramci</code>, <code>pdf</code>, <code>plot</code>, <code>proflik</code>, - <code>random</code>, <code>std</code>, <code>truncate</code>, <code>var</code>. -</p> -<p> Further information about the exponential distribution can be found at - <a href="https://en.wikipedia.org/wiki/Exponential_distribution">https://en.wikipedia.org/wiki/Exponential_distribution</a> -</p> <p> <strong>See also: </strong> - <a href="fitdist.html">fitdist</a>, - <a href="makedist.html">makedist</a>, + <a href="icdf.html">icdf</a>, + <a href="pdf.html">pdf</a>, + <a href="cdf.html">cdf</a>, + <a href="betacdf.html">betacdf</a>, + <a href="binocdf.html">binocdf</a>, + <a href="bisacdf.html">bisacdf</a>, + <a href="burrcdf.html">burrcdf</a>, + <a href="cauchycdf.html">cauchycdf</a>, + <a href="chi2cdf.html">chi2cdf</a>, + <a href="evcdf.html">evcdf</a>, <a href="expcdf.html">expcdf</a>, - <a href="expinv.html">expinv</a>, - <a href="exppdf.html">exppdf</a>, - <a href="exprnd.html">exprnd</a>, - <a href="expfit.html">expfit</a>, - <a href="explike.html">explike</a>, - <a href="expstat.html">expstat</a> + <a href="fcdf.html">fcdf</a>, + <a href="gamcdf.html">gamcdf</a>, + <a href="geocdf.html">geocdf</a>, + <a href="gevcdf.html">gevcdf</a>, + <a href="gpcdf.html">gpcdf</a>, + <a href="gumbelcdf.html">gumbelcdf</a>, + <a href="hncdf.html">hncdf</a>, + <a href="hygecdf.html">hygecdf</a>, + <a href="invgcdf.html">invgcdf</a>, + <a href="laplacecdf.html">laplacecdf</a>, + <a href="logicdf.html">logicdf</a>, + <a href="loglcdf.html">loglcdf</a>, + <a href="logncdf.html">logncdf</a>, + <a href="nakacdf.html">nakacdf</a>, + <a href="nbincdf.html">nbincdf</a>, + <a href="ncfcdf.html">ncfcdf</a>, + <a href="nctcdf.html">nctcdf</a>, + <a href="ncx2cdf.html">ncx2cdf</a>, + <a href="normcdf.html">normcdf</a>, + <a href="poisscdf.html">poisscdf</a>, + <a href="raylcdf.html">raylcdf</a>, + <a href="ricecdf.html">ricecdf</a>, + <a href="tcdf.html">tcdf</a>, + <a href="tlscdf.html">tlscdf</a>, + <a href="tricdf.html">tricdf</a>, + <a href="unidcdf.html">unidcdf</a>, + <a href="unifcdf.html">unifcdf</a>, + <a href="vmcdf.html">vmcdf</a>, + <a href="wblcdf.html">wblcdf</a> </p> <p><strong>Source Code: </strong> <a href="https://github.com/gnu-octave/statistics/tree/main/inst/dist_obj/ExponentialDistribution.m">ExponentialDistribution</a> @@ -140,39 +201,6 @@ <div class="row d-flex flex-wrap align-items-center"> <div class="col-sm-3 col-md-5 mb-2 mb-sm-0"> <h3 class="d-inline-block mr-2"> - Method: <b><code>cdf</code></b> - </h3> - </div> - </div> - </div> - <div class="card-body"> -<dl> -<dt><u>ExponentialDistribution:</u> <var>p</var> = <b>icdf</b><i> (<var>pd</var>, <var>p</var>)</i></dt> -</dl> - -<p> Compute the cumulative distribution function (CDF). -</p> -<div class="ms-5"> -<p> <code><var>p</var> = icdf (<var>pd</var>, <var>x</var>)</code> computes the quantile (the - inverse of the CDF) of the probability distribution object, <var>pd</var>, - evaluated at the values in <var>x</var>. -</p> - -</div> - - </div> - </div> - </div> - - - - - <div class="container-xl my-4"> - <div class="card rounded"> - <div class="card-header card-header-mod"> - <div class="row d-flex flex-wrap align-items-center"> - <div class="col-sm-3 col-md-5 mb-2 mb-sm-0"> - <h3 class="d-inline-block mr-2"> Method: <b><code>icdf</code></b> </h3> </div> @@ -226,7 +254,6 @@ </div> </div> - <div class="container-xl my-4"> <div class="card rounded"> <div class="card-header card-header-mod"> diff --git a/docs/ExtremeValueDistribution.html b/docs/ExtremeValueDistribution.html index fb7a20c..4a06437 100644 --- a/docs/ExtremeValueDistribution.html +++ b/docs/ExtremeValueDistribution.html @@ -71,66 +71,126 @@ </div> <div class="card-body"> <dl> -<dt><u>statistics:</u> ExtremeValueDistribution</dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>, <var>C</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (…, <code>"upper"</code>)</i></dt> </dl> -<p> Extreme value probability distribution object. +<p> Return the CDF of a univariate distribution evaluated at <var>x</var>. </p> <div class="ms-5"> -<p> A <code>ExtremeValueDistribution</code> object consists of parameters, a model - description, and sample data for a extreme value probability distribution. +<p> <code>cdf</code> is a wrapper for the univariate cumulative distribution functions + available in the statistics package. See the corresponding functions’ help + to learn the signification of the parameters after <var>x</var>. </p> -<p> The extreme value distribution uses the following parameters. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>)</code> returns the CDF for the + one-parameter distribution family specified by <var>name</var> and the + distribution parameter <var>A</var>, evaluated at the values in <var>x</var>. </p> - <table> -<thead><tr><th width="25%"><var>Parameter</var></th><th width="48%"><var>Description</var></th><th width="27%"><var>Support</var></th></tr></thead> -<tr><td width="25%"><code>mu</code></td><td width="48%">Location parameter</td><td width="27%"><math>-Inf < mu < Inf</math></td></tr> -<tr><td width="25%"><code>sigma</code></td><td width="48%">Scale parameter</td><td width="27%"><math>sigma > 0</math></td></tr> -</table> - -<p> There are several ways to create a <code>ExtremeValueDistribution</code> object. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>)</code> returns the CDF + for the two-parameter distribution family specified by <var>name</var> and the + distribution parameters <var>A</var> and <var>B</var>, evaluated at the values in + <var>x</var>. </p> - <ul> -<li> Fit a distribution to data using the <code>fitdist</code> function. - </li><li> Create a distribution with specified parameter values using the - <code>makedist</code> function. - </li><li> Use the constructor <code>ExtremeValueDistribution (<var>mu</var>, <var>sigma</var>)</code> - to create a extreme value distribution with specified parameter values. - </li><li> Use the static method <code>ExtremeValueDistribution.fit (<var>x</var>, - <var>censor</var>, <var>freq</var>, <var>options</var>)</code> to a distribution to data <var>x</var>. - </li></ul> - -<p> It is highly recommended to use <code>fitdist</code> and <code>makedist</code> - functions to create probability distribution objects, instead of the - constructor and the aforementioned static method. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>, <var>C</var>)</code> returns + the CDF for the three-parameter distribution family specified by <var>name</var> + and the distribution parameters <var>A</var>, <var>B</var>, and <var>C</var>, evaluated at + the values in <var>x</var>. +</p> +<p> <code><var>p</var> = cdf (…, <code>"upper"</code>)</code> returns the complement of the + CDF using an algorithm that more accurately computes the extreme upper-tail + probabilities. <code>"upper"</code> can follow any of the input arguments in the + previous syntaxes. </p> -<p> A <code>ExtremeValueDistribution</code> object contains the following properties, - which can be accessed using dot notation. +<p> <var>name</var> must be a char string of the name or the abbreviation of the + desired cumulative distribution function as listed in the followng table. + The last column shows the number of required parameters that should be parsed + after <var>x</var> to the desired CDF. The optional input argument + <code>"upper"</code> does not count in the required number of parameters. </p> <table> -<tr><td width="25%"><code>DistributionName</code></td><td width="25%"><code>DistributionCode</code></td><td width="25%"><code>NumParameters</code></td><td width="25%"><code>ParameterNames</code></td></tr> -<tr><td width="25%"><code>ParameterDescription</code></td><td width="25%"><code>ParameterValues</code></td><td width="25%"><code>ParameterValues</code></td><td width="25%"><code>ParameterCI</code></td></tr> -<tr><td width="25%"><code>ParameterIsFixed</code></td><td width="25%"><code>Truncation</code></td><td width="25%"><code>IsTruncated</code></td><td width="25%"><code>InputData</code></td></tr> +<thead><tr><th width="40%">Distribution Name</th><th width="5%"></th><th width="20%">Abbreviation</th><th width="5%"></th><th width="30%">Input Parameters</th></tr></thead> +<tr><td width="40%"><code>"Beta"</code></td><td width="5%"></td><td width="20%"><code>"beta"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Binomial"</code></td><td width="5%"></td><td width="20%"><code>"bino"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Birnbaum-Saunders"</code></td><td width="5%"></td><td width="20%"><code>"bisa"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Burr"</code></td><td width="5%"></td><td width="20%"><code>"burr"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Cauchy"</code></td><td width="5%"></td><td width="20%"><code>"cauchy"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Chi-squared"</code></td><td width="5%"></td><td width="20%"><code>"chi2"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Extreme Value"</code></td><td width="5%"></td><td width="20%"><code>"ev"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Exponential"</code></td><td width="5%"></td><td width="20%"><code>"exp"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"F-Distribution"</code></td><td width="5%"></td><td width="20%"><code>"f"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Gamma"</code></td><td width="5%"></td><td width="20%"><code>"gam"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Geometric"</code></td><td width="5%"></td><td width="20%"><code>"geo"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Generalized Extreme Value"</code></td><td width="5%"></td><td width="20%"><code>"gev"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Generalized Pareto"</code></td><td width="5%"></td><td width="20%"><code>"gp"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Gumbel"</code></td><td width="5%"></td><td width="20%"><code>"gumbel"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Half-normal"</code></td><td width="5%"></td><td width="20%"><code>"hn"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Hypergeometric"</code></td><td width="5%"></td><td width="20%"><code>"hyge"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Inverse Gaussian"</code></td><td width="5%"></td><td width="20%"><code>"invg"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Laplace"</code></td><td width="5%"></td><td width="20%"><code>"laplace"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Logistic"</code></td><td width="5%"></td><td width="20%"><code>"logi"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Log-Logistic"</code></td><td width="5%"></td><td width="20%"><code>"logl"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Lognormal"</code></td><td width="5%"></td><td width="20%"><code>"logn"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Nakagami"</code></td><td width="5%"></td><td width="20%"><code>"naka"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Negative Binomial"</code></td><td width="5%"></td><td width="20%"><code>"nbin"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Noncentral F-Distribution"</code></td><td width="5%"></td><td width="20%"><code>"ncf"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Noncentral Student T"</code></td><td width="5%"></td><td width="20%"><code>"nct"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Noncentral Chi-Squared"</code></td><td width="5%"></td><td width="20%"><code>"ncx2"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Normal"</code></td><td width="5%"></td><td width="20%"><code>"norm"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Poisson"</code></td><td width="5%"></td><td width="20%"><code>"poiss"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Rayleigh"</code></td><td width="5%"></td><td width="20%"><code>"rayl"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Rician"</code></td><td width="5%"></td><td width="20%"><code>"rice"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Student T"</code></td><td width="5%"></td><td width="20%"><code>"t"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"location-scale T"</code></td><td width="5%"></td><td width="20%"><code>"tls"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Triangular"</code></td><td width="5%"></td><td width="20%"><code>"tri"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Discrete Uniform"</code></td><td width="5%"></td><td width="20%"><code>"unid"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Uniform"</code></td><td width="5%"></td><td width="20%"><code>"unif"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Von Mises"</code></td><td width="5%"></td><td width="20%"><code>"vm"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Weibull"</code></td><td width="5%"></td><td width="20%"><code>"wbl"</code></td><td width="5%"></td><td width="30%">2</td></tr> </table> -<p> A <code>ExtremeValueDistribution</code> object contains the following methods: - <code>cdf</code>, <code>icdf</code>, <code>iqr</code>, <code>mean</code>, <code>median</code>, - <code>negloglik</code>, <code>paramci</code>, <code>pdf</code>, <code>plot</code>, <code>proflik</code>, - <code>random</code>, <code>std</code>, <code>truncate</code>, <code>var</code>. -</p> -<p> Further information about the Gumbel distribution can be found at - <a href="https://en.wikipedia.org/wiki/Gumbel_distribution">https://en.wikipedia.org/wiki/Gumbel_distribution</a> -</p> <p> <strong>See also: </strong> - <a href="fitdist.html">fitdist</a>, - <a href="makedist.html">makedist</a>, + <a href="icdf.html">icdf</a>, + <a href="pdf.html">pdf</a>, + <a href="cdf.html">cdf</a>, + <a href="betacdf.html">betacdf</a>, + <a href="binocdf.html">binocdf</a>, + <a href="bisacdf.html">bisacdf</a>, + <a href="burrcdf.html">burrcdf</a>, + <a href="cauchycdf.html">cauchycdf</a>, + <a href="chi2cdf.html">chi2cdf</a>, <a href="evcdf.html">evcdf</a>, - <a href="evinv.html">evinv</a>, - <a href="evpdf.html">evpdf</a>, - <a href="evrnd.html">evrnd</a>, - <a href="evfit.html">evfit</a>, - <a href="evlike.html">evlike</a>, - <a href="evstat.html">evstat</a> + <a href="expcdf.html">expcdf</a>, + <a href="fcdf.html">fcdf</a>, + <a href="gamcdf.html">gamcdf</a>, + <a href="geocdf.html">geocdf</a>, + <a href="gevcdf.html">gevcdf</a>, + <a href="gpcdf.html">gpcdf</a>, + <a href="gumbelcdf.html">gumbelcdf</a>, + <a href="hncdf.html">hncdf</a>, + <a href="hygecdf.html">hygecdf</a>, + <a href="invgcdf.html">invgcdf</a>, + <a href="laplacecdf.html">laplacecdf</a>, + <a href="logicdf.html">logicdf</a>, + <a href="loglcdf.html">loglcdf</a>, + <a href="logncdf.html">logncdf</a>, + <a href="nakacdf.html">nakacdf</a>, + <a href="nbincdf.html">nbincdf</a>, + <a href="ncfcdf.html">ncfcdf</a>, + <a href="nctcdf.html">nctcdf</a>, + <a href="ncx2cdf.html">ncx2cdf</a>, + <a href="normcdf.html">normcdf</a>, + <a href="poisscdf.html">poisscdf</a>, + <a href="raylcdf.html">raylcdf</a>, + <a href="ricecdf.html">ricecdf</a>, + <a href="tcdf.html">tcdf</a>, + <a href="tlscdf.html">tlscdf</a>, + <a href="tricdf.html">tricdf</a>, + <a href="unidcdf.html">unidcdf</a>, + <a href="unifcdf.html">unifcdf</a>, + <a href="vmcdf.html">vmcdf</a>, + <a href="wblcdf.html">wblcdf</a> </p> <p><strong>Source Code: </strong> <a href="https://github.com/gnu-octave/statistics/tree/main/inst/dist_obj/ExtremeValueDistribution.m">ExtremeValueDistribution</a> @@ -141,39 +201,6 @@ <div class="row d-flex flex-wrap align-items-center"> <div class="col-sm-3 col-md-5 mb-2 mb-sm-0"> <h3 class="d-inline-block mr-2"> - Method: <b><code>cdf</code></b> - </h3> - </div> - </div> - </div> - <div class="card-body"> -<dl> -<dt><u>ExtremeValueDistribution:</u> <var>p</var> = <b>icdf</b><i> (<var>pd</var>, <var>p</var>)</i></dt> -</dl> - -<p> Compute the cumulative distribution function (CDF). -</p> -<div class="ms-5"> -<p> <code><var>p</var> = icdf (<var>pd</var>, <var>x</var>)</code> computes the quantile (the - inverse of the CDF) of the probability distribution object, <var>pd</var>, - evaluated at the values in <var>x</var>. -</p> - -</div> - - </div> - </div> - </div> - - - - - <div class="container-xl my-4"> - <div class="card rounded"> - <div class="card-header card-header-mod"> - <div class="row d-flex flex-wrap align-items-center"> - <div class="col-sm-3 col-md-5 mb-2 mb-sm-0"> - <h3 class="d-inline-block mr-2"> Method: <b><code>icdf</code></b> </h3> </div> @@ -227,7 +254,6 @@ </div> </div> - <div class="container-xl my-4"> <div class="card rounded"> <div class="card-header card-header-mod"> diff --git a/docs/GammaDistribution.html b/docs/GammaDistribution.html index 074cb40..9ff3731 100644 --- a/docs/GammaDistribution.html +++ b/docs/GammaDistribution.html @@ -71,66 +71,126 @@ </div> <div class="card-body"> <dl> -<dt><u>statistics:</u> GammaDistribution</dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>, <var>C</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (…, <code>"upper"</code>)</i></dt> </dl> -<p> Gamma probability distribution object. +<p> Return the CDF of a univariate distribution evaluated at <var>x</var>. </p> <div class="ms-5"> -<p> A <code>GammaDistribution</code> object consists of parameters, a model - description, and sample data for a gamma probability distribution. +<p> <code>cdf</code> is a wrapper for the univariate cumulative distribution functions + available in the statistics package. See the corresponding functions’ help + to learn the signification of the parameters after <var>x</var>. </p> -<p> The gamma distribution uses the following parameters. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>)</code> returns the CDF for the + one-parameter distribution family specified by <var>name</var> and the + distribution parameter <var>A</var>, evaluated at the values in <var>x</var>. </p> - <table> -<thead><tr><th width="25%"><var>Parameter</var></th><th width="48%"><var>Description</var></th><th width="27%"><var>Support</var></th></tr></thead> -<tr><td width="25%"><code>a</code></td><td width="48%">Shape parameter</td><td width="27%"><math>α > 0</math></td></tr> -<tr><td width="25%"><code>b</code></td><td width="48%">Scale parameter</td><td width="27%"><math>β > 0</math></td></tr> -</table> - -<p> There are several ways to create a <code>GammaDistribution</code> object. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>)</code> returns the CDF + for the two-parameter distribution family specified by <var>name</var> and the + distribution parameters <var>A</var> and <var>B</var>, evaluated at the values in + <var>x</var>. </p> - <ul> -<li> Fit a distribution to data using the <code>fitdist</code> function. - </li><li> Create a distribution with specified parameter values using the - <code>makedist</code> function. - </li><li> Use the constructor <code>GammaDistribution (<var>a</var>, <var>b</var>)</code> - to create a gamma distribution with specified parameter values. - </li><li> Use the static method <code>GammaDistribution.fit (<var>x</var>, - <var>censor</var>, <var>freq</var>, <var>options</var>)</code> to a distribution to data <var>x</var>. - </li></ul> - -<p> It is highly recommended to use <code>fitdist</code> and <code>makedist</code> - functions to create probability distribution objects, instead of the - constructor and the aforementioned static method. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>, <var>C</var>)</code> returns + the CDF for the three-parameter distribution family specified by <var>name</var> + and the distribution parameters <var>A</var>, <var>B</var>, and <var>C</var>, evaluated at + the values in <var>x</var>. +</p> +<p> <code><var>p</var> = cdf (…, <code>"upper"</code>)</code> returns the complement of the + CDF using an algorithm that more accurately computes the extreme upper-tail + probabilities. <code>"upper"</code> can follow any of the input arguments in the + previous syntaxes. </p> -<p> A <code>GammaDistribution</code> object contains the following properties, - which can be accessed using dot notation. +<p> <var>name</var> must be a char string of the name or the abbreviation of the + desired cumulative distribution function as listed in the followng table. + The last column shows the number of required parameters that should be parsed + after <var>x</var> to the desired CDF. The optional input argument + <code>"upper"</code> does not count in the required number of parameters. </p> <table> -<tr><td width="25%"><code>DistributionName</code></td><td width="25%"><code>DistributionCode</code></td><td width="25%"><code>NumParameters</code></td><td width="25%"><code>ParameterNames</code></td></tr> -<tr><td width="25%"><code>ParameterDescription</code></td><td width="25%"><code>ParameterValues</code></td><td width="25%"><code>ParameterValues</code></td><td width="25%"><code>ParameterCI</code></td></tr> -<tr><td width="25%"><code>ParameterIsFixed</code></td><td width="25%"><code>Truncation</code></td><td width="25%"><code>IsTruncated</code></td><td width="25%"><code>InputData</code></td></tr> +<thead><tr><th width="40%">Distribution Name</th><th width="5%"></th><th width="20%">Abbreviation</th><th width="5%"></th><th width="30%">Input Parameters</th></tr></thead> +<tr><td width="40%"><code>"Beta"</code></td><td width="5%"></td><td width="20%"><code>"beta"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Binomial"</code></td><td width="5%"></td><td width="20%"><code>"bino"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Birnbaum-Saunders"</code></td><td width="5%"></td><td width="20%"><code>"bisa"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Burr"</code></td><td width="5%"></td><td width="20%"><code>"burr"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Cauchy"</code></td><td width="5%"></td><td width="20%"><code>"cauchy"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Chi-squared"</code></td><td width="5%"></td><td width="20%"><code>"chi2"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Extreme Value"</code></td><td width="5%"></td><td width="20%"><code>"ev"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Exponential"</code></td><td width="5%"></td><td width="20%"><code>"exp"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"F-Distribution"</code></td><td width="5%"></td><td width="20%"><code>"f"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Gamma"</code></td><td width="5%"></td><td width="20%"><code>"gam"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Geometric"</code></td><td width="5%"></td><td width="20%"><code>"geo"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Generalized Extreme Value"</code></td><td width="5%"></td><td width="20%"><code>"gev"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Generalized Pareto"</code></td><td width="5%"></td><td width="20%"><code>"gp"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Gumbel"</code></td><td width="5%"></td><td width="20%"><code>"gumbel"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Half-normal"</code></td><td width="5%"></td><td width="20%"><code>"hn"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Hypergeometric"</code></td><td width="5%"></td><td width="20%"><code>"hyge"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Inverse Gaussian"</code></td><td width="5%"></td><td width="20%"><code>"invg"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Laplace"</code></td><td width="5%"></td><td width="20%"><code>"laplace"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Logistic"</code></td><td width="5%"></td><td width="20%"><code>"logi"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Log-Logistic"</code></td><td width="5%"></td><td width="20%"><code>"logl"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Lognormal"</code></td><td width="5%"></td><td width="20%"><code>"logn"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Nakagami"</code></td><td width="5%"></td><td width="20%"><code>"naka"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Negative Binomial"</code></td><td width="5%"></td><td width="20%"><code>"nbin"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Noncentral F-Distribution"</code></td><td width="5%"></td><td width="20%"><code>"ncf"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Noncentral Student T"</code></td><td width="5%"></td><td width="20%"><code>"nct"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Noncentral Chi-Squared"</code></td><td width="5%"></td><td width="20%"><code>"ncx2"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Normal"</code></td><td width="5%"></td><td width="20%"><code>"norm"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Poisson"</code></td><td width="5%"></td><td width="20%"><code>"poiss"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Rayleigh"</code></td><td width="5%"></td><td width="20%"><code>"rayl"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Rician"</code></td><td width="5%"></td><td width="20%"><code>"rice"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Student T"</code></td><td width="5%"></td><td width="20%"><code>"t"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"location-scale T"</code></td><td width="5%"></td><td width="20%"><code>"tls"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Triangular"</code></td><td width="5%"></td><td width="20%"><code>"tri"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Discrete Uniform"</code></td><td width="5%"></td><td width="20%"><code>"unid"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Uniform"</code></td><td width="5%"></td><td width="20%"><code>"unif"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Von Mises"</code></td><td width="5%"></td><td width="20%"><code>"vm"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Weibull"</code></td><td width="5%"></td><td width="20%"><code>"wbl"</code></td><td width="5%"></td><td width="30%">2</td></tr> </table> -<p> A <code>GammaDistribution</code> object contains the following methods: - <code>cdf</code>, <code>icdf</code>, <code>iqr</code>, <code>mean</code>, <code>median</code>, - <code>negloglik</code>, <code>paramci</code>, <code>pdf</code>, <code>plot</code>, <code>proflik</code>, - <code>random</code>, <code>std</code>, <code>truncate</code>, <code>var</code>. -</p> -<p> Further information about the inverse Gaussian distribution can be found at - <a href="https://en.wikipedia.org/wiki/Inverse_Gaussian_distribution">https://en.wikipedia.org/wiki/Inverse_Gaussian_distribution</a> -</p> <p> <strong>See also: </strong> - <a href="fitdist.html">fitdist</a>, - <a href="makedist.html">makedist</a>, + <a href="icdf.html">icdf</a>, + <a href="pdf.html">pdf</a>, + <a href="cdf.html">cdf</a>, + <a href="betacdf.html">betacdf</a>, + <a href="binocdf.html">binocdf</a>, + <a href="bisacdf.html">bisacdf</a>, + <a href="burrcdf.html">burrcdf</a>, + <a href="cauchycdf.html">cauchycdf</a>, + <a href="chi2cdf.html">chi2cdf</a>, + <a href="evcdf.html">evcdf</a>, + <a href="expcdf.html">expcdf</a>, + <a href="fcdf.html">fcdf</a>, <a href="gamcdf.html">gamcdf</a>, - <a href="gaminv.html">gaminv</a>, - <a href="gampdf.html">gampdf</a>, - <a href="gamrnd.html">gamrnd</a>, - <a href="lognfit.html">lognfit</a>, - <a href="gamlike.html">gamlike</a>, - <a href="gamstat.html">gamstat</a> + <a href="geocdf.html">geocdf</a>, + <a href="gevcdf.html">gevcdf</a>, + <a href="gpcdf.html">gpcdf</a>, + <a href="gumbelcdf.html">gumbelcdf</a>, + <a href="hncdf.html">hncdf</a>, + <a href="hygecdf.html">hygecdf</a>, + <a href="invgcdf.html">invgcdf</a>, + <a href="laplacecdf.html">laplacecdf</a>, + <a href="logicdf.html">logicdf</a>, + <a href="loglcdf.html">loglcdf</a>, + <a href="logncdf.html">logncdf</a>, + <a href="nakacdf.html">nakacdf</a>, + <a href="nbincdf.html">nbincdf</a>, + <a href="ncfcdf.html">ncfcdf</a>, + <a href="nctcdf.html">nctcdf</a>, + <a href="ncx2cdf.html">ncx2cdf</a>, + <a href="normcdf.html">normcdf</a>, + <a href="poisscdf.html">poisscdf</a>, + <a href="raylcdf.html">raylcdf</a>, + <a href="ricecdf.html">ricecdf</a>, + <a href="tcdf.html">tcdf</a>, + <a href="tlscdf.html">tlscdf</a>, + <a href="tricdf.html">tricdf</a>, + <a href="unidcdf.html">unidcdf</a>, + <a href="unifcdf.html">unifcdf</a>, + <a href="vmcdf.html">vmcdf</a>, + <a href="wblcdf.html">wblcdf</a> </p> <p><strong>Source Code: </strong> <a href="https://github.com/gnu-octave/statistics/tree/main/inst/dist_obj/GammaDistribution.m">GammaDistribution</a> @@ -141,39 +201,6 @@ <div class="row d-flex flex-wrap align-items-center"> <div class="col-sm-3 col-md-5 mb-2 mb-sm-0"> <h3 class="d-inline-block mr-2"> - Method: <b><code>cdf</code></b> - </h3> - </div> - </div> - </div> - <div class="card-body"> -<dl> -<dt><u>GammaDistribution:</u> <var>p</var> = <b>icdf</b><i> (<var>pd</var>, <var>p</var>)</i></dt> -</dl> - -<p> Compute the cumulative distribution function (CDF). -</p> -<div class="ms-5"> -<p> <code><var>p</var> = icdf (<var>pd</var>, <var>x</var>)</code> computes the quantile (the - inverse of the CDF) of the probability distribution object, <var>pd</var>, - evaluated at the values in <var>x</var>. -</p> - -</div> - - </div> - </div> - </div> - - - - - <div class="container-xl my-4"> - <div class="card rounded"> - <div class="card-header card-header-mod"> - <div class="row d-flex flex-wrap align-items-center"> - <div class="col-sm-3 col-md-5 mb-2 mb-sm-0"> - <h3 class="d-inline-block mr-2"> Method: <b><code>icdf</code></b> </h3> </div> @@ -227,7 +254,6 @@ </div> </div> - <div class="container-xl my-4"> <div class="card rounded"> <div class="card-header card-header-mod"> diff --git a/docs/GapEvaluation.html b/docs/GapEvaluation.html index 1dea841..a91339c 100644 --- a/docs/GapEvaluation.html +++ b/docs/GapEvaluation.html @@ -201,8 +201,6 @@ </div> - - <div class="container-xl my-4"> <div class="card rounded"> <div class="card-header card-header-mod"> diff --git a/docs/GeneralizedExtremeValueDistribution.html b/docs/GeneralizedExtremeValueDistribution.html index f33d118..de6ae08 100644 --- a/docs/GeneralizedExtremeValueDistribution.html +++ b/docs/GeneralizedExtremeValueDistribution.html @@ -71,72 +71,126 @@ </div> <div class="card-body"> <dl> -<dt><u>statistics:</u> GeneralizedExtremeValueDistribution</dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>, <var>C</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (…, <code>"upper"</code>)</i></dt> </dl> -<p> Generalized extreme value probability distribution object. +<p> Return the CDF of a univariate distribution evaluated at <var>x</var>. </p> <div class="ms-5"> -<p> A <code>GeneralizedExtremeValueDistribution</code> object consists of parameters, - a model description, and sample data for a generalized extreme value - probability distribution. +<p> <code>cdf</code> is a wrapper for the univariate cumulative distribution functions + available in the statistics package. See the corresponding functions’ help + to learn the signification of the parameters after <var>x</var>. </p> -<p> The generalized extreme value distribution uses the following parameters. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>)</code> returns the CDF for the + one-parameter distribution family specified by <var>name</var> and the + distribution parameter <var>A</var>, evaluated at the values in <var>x</var>. </p> - <table> -<thead><tr><th width="25%"><var>Parameter</var></th><th width="48%"><var>Description</var></th><th width="27%"><var>Support</var></th></tr></thead> -<tr><td width="25%"><code>k</code></td><td width="48%">Shape</td><td width="27%"><math>-Inf < k < Inf</math></td></tr> -<tr><td width="25%"><code>sigma</code></td><td width="48%">Scale</td><td width="27%"><math>sigma > 0</math></td></tr> -<tr><td width="25%"><code>mu</code></td><td width="48%">Location</td><td width="27%"><math>-Inf < mu < Inf</math></td></tr> -</table> - -<p> There are several ways to create a <code>GeneralizedExtremeValueDistribution</code> - object. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>)</code> returns the CDF + for the two-parameter distribution family specified by <var>name</var> and the + distribution parameters <var>A</var> and <var>B</var>, evaluated at the values in + <var>x</var>. </p> - <ul> -<li> Fit a distribution to data using the <code>fitdist</code> function. - </li><li> Create a distribution with specified parameter values using the - <code>makedist</code> function. - </li><li> Use the constructor <code>GeneralizedExtremeValueDistribution - (<var>k</var>, <var>sigma</var>)</code> to create a generalized extreme value distribution - with specified parameter values. - </li><li> Use the static method <code>GeneralizedExtremeValueDistribution.fit - (<var>x</var>, <var>k</var>, <var>freq</var>)</code> to a distribution to data <var>x</var>. - </li></ul> - -<p> It is highly recommended to use <code>fitdist</code> and <code>makedist</code> - functions to create probability distribution objects, instead of the - constructor and the aforementioned static method. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>, <var>C</var>)</code> returns + the CDF for the three-parameter distribution family specified by <var>name</var> + and the distribution parameters <var>A</var>, <var>B</var>, and <var>C</var>, evaluated at + the values in <var>x</var>. +</p> +<p> <code><var>p</var> = cdf (…, <code>"upper"</code>)</code> returns the complement of the + CDF using an algorithm that more accurately computes the extreme upper-tail + probabilities. <code>"upper"</code> can follow any of the input arguments in the + previous syntaxes. </p> -<p> A <code>GeneralizedExtremeValueDistribution</code> object contains the following - properties, which can be accessed using dot notation. +<p> <var>name</var> must be a char string of the name or the abbreviation of the + desired cumulative distribution function as listed in the followng table. + The last column shows the number of required parameters that should be parsed + after <var>x</var> to the desired CDF. The optional input argument + <code>"upper"</code> does not count in the required number of parameters. </p> <table> -<tr><td width="25%"><code>DistributionName</code></td><td width="25%"><code>DistributionCode</code></td><td width="25%"><code>NumParameters</code></td><td width="25%"><code>ParameterNames</code></td></tr> -<tr><td width="25%"><code>ParameterDescription</code></td><td width="25%"><code>ParameterValues</code></td><td width="25%"><code>ParameterValues</code></td><td width="25%"><code>ParameterCI</code></td></tr> -<tr><td width="25%"><code>ParameterIsFixed</code></td><td width="25%"><code>Truncation</code></td><td width="25%"><code>IsTruncated</code></td><td width="25%"><code>InputData</code></td></tr> +<thead><tr><th width="40%">Distribution Name</th><th width="5%"></th><th width="20%">Abbreviation</th><th width="5%"></th><th width="30%">Input Parameters</th></tr></thead> +<tr><td width="40%"><code>"Beta"</code></td><td width="5%"></td><td width="20%"><code>"beta"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Binomial"</code></td><td width="5%"></td><td width="20%"><code>"bino"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Birnbaum-Saunders"</code></td><td width="5%"></td><td width="20%"><code>"bisa"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Burr"</code></td><td width="5%"></td><td width="20%"><code>"burr"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Cauchy"</code></td><td width="5%"></td><td width="20%"><code>"cauchy"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Chi-squared"</code></td><td width="5%"></td><td width="20%"><code>"chi2"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Extreme Value"</code></td><td width="5%"></td><td width="20%"><code>"ev"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Exponential"</code></td><td width="5%"></td><td width="20%"><code>"exp"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"F-Distribution"</code></td><td width="5%"></td><td width="20%"><code>"f"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Gamma"</code></td><td width="5%"></td><td width="20%"><code>"gam"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Geometric"</code></td><td width="5%"></td><td width="20%"><code>"geo"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Generalized Extreme Value"</code></td><td width="5%"></td><td width="20%"><code>"gev"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Generalized Pareto"</code></td><td width="5%"></td><td width="20%"><code>"gp"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Gumbel"</code></td><td width="5%"></td><td width="20%"><code>"gumbel"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Half-normal"</code></td><td width="5%"></td><td width="20%"><code>"hn"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Hypergeometric"</code></td><td width="5%"></td><td width="20%"><code>"hyge"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Inverse Gaussian"</code></td><td width="5%"></td><td width="20%"><code>"invg"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Laplace"</code></td><td width="5%"></td><td width="20%"><code>"laplace"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Logistic"</code></td><td width="5%"></td><td width="20%"><code>"logi"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Log-Logistic"</code></td><td width="5%"></td><td width="20%"><code>"logl"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Lognormal"</code></td><td width="5%"></td><td width="20%"><code>"logn"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Nakagami"</code></td><td width="5%"></td><td width="20%"><code>"naka"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Negative Binomial"</code></td><td width="5%"></td><td width="20%"><code>"nbin"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Noncentral F-Distribution"</code></td><td width="5%"></td><td width="20%"><code>"ncf"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Noncentral Student T"</code></td><td width="5%"></td><td width="20%"><code>"nct"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Noncentral Chi-Squared"</code></td><td width="5%"></td><td width="20%"><code>"ncx2"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Normal"</code></td><td width="5%"></td><td width="20%"><code>"norm"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Poisson"</code></td><td width="5%"></td><td width="20%"><code>"poiss"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Rayleigh"</code></td><td width="5%"></td><td width="20%"><code>"rayl"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Rician"</code></td><td width="5%"></td><td width="20%"><code>"rice"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Student T"</code></td><td width="5%"></td><td width="20%"><code>"t"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"location-scale T"</code></td><td width="5%"></td><td width="20%"><code>"tls"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Triangular"</code></td><td width="5%"></td><td width="20%"><code>"tri"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Discrete Uniform"</code></td><td width="5%"></td><td width="20%"><code>"unid"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Uniform"</code></td><td width="5%"></td><td width="20%"><code>"unif"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Von Mises"</code></td><td width="5%"></td><td width="20%"><code>"vm"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Weibull"</code></td><td width="5%"></td><td width="20%"><code>"wbl"</code></td><td width="5%"></td><td width="30%">2</td></tr> </table> -<p> A <code>GeneralizedExtremeValueDistribution</code> object contains the following - methods: - <code>cdf</code>, <code>icdf</code>, <code>iqr</code>, <code>mean</code>, <code>median</code>, - <code>negloglik</code>, <code>paramci</code>, <code>pdf</code>, <code>plot</code>, <code>proflik</code>, - <code>random</code>, <code>std</code>, <code>truncate</code>, <code>var</code>. -</p> -<p> Further information about the generalized extreme value distribution can be - found at - <a href="https://en.wikipedia.org/wiki/Generalized_extreme_value_distribution">https://en.wikipedia.org/wiki/Generalized_extreme_value_distribution</a> -</p> <p> <strong>See also: </strong> - <a href="fitdist.html">fitdist</a>, - <a href="makedist.html">makedist</a>, + <a href="icdf.html">icdf</a>, + <a href="pdf.html">pdf</a>, + <a href="cdf.html">cdf</a>, + <a href="betacdf.html">betacdf</a>, + <a href="binocdf.html">binocdf</a>, + <a href="bisacdf.html">bisacdf</a>, + <a href="burrcdf.html">burrcdf</a>, + <a href="cauchycdf.html">cauchycdf</a>, + <a href="chi2cdf.html">chi2cdf</a>, + <a href="evcdf.html">evcdf</a>, + <a href="expcdf.html">expcdf</a>, + <a href="fcdf.html">fcdf</a>, + <a href="gamcdf.html">gamcdf</a>, + <a href="geocdf.html">geocdf</a>, <a href="gevcdf.html">gevcdf</a>, - <a href="gevinv.html">gevinv</a>, - <a href="gevpdf.html">gevpdf</a>, - <a href="gevrnd.html">gevrnd</a>, - <a href="gevfit.html">gevfit</a>, - <a href="gevlike.html">gevlike</a>, - <a href="gevstat.html">gevstat</a> + <a href="gpcdf.html">gpcdf</a>, + <a href="gumbelcdf.html">gumbelcdf</a>, + <a href="hncdf.html">hncdf</a>, + <a href="hygecdf.html">hygecdf</a>, + <a href="invgcdf.html">invgcdf</a>, + <a href="laplacecdf.html">laplacecdf</a>, + <a href="logicdf.html">logicdf</a>, + <a href="loglcdf.html">loglcdf</a>, + <a href="logncdf.html">logncdf</a>, + <a href="nakacdf.html">nakacdf</a>, + <a href="nbincdf.html">nbincdf</a>, + <a href="ncfcdf.html">ncfcdf</a>, + <a href="nctcdf.html">nctcdf</a>, + <a href="ncx2cdf.html">ncx2cdf</a>, + <a href="normcdf.html">normcdf</a>, + <a href="poisscdf.html">poisscdf</a>, + <a href="raylcdf.html">raylcdf</a>, + <a href="ricecdf.html">ricecdf</a>, + <a href="tcdf.html">tcdf</a>, + <a href="tlscdf.html">tlscdf</a>, + <a href="tricdf.html">tricdf</a>, + <a href="unidcdf.html">unidcdf</a>, + <a href="unifcdf.html">unifcdf</a>, + <a href="vmcdf.html">vmcdf</a>, + <a href="wblcdf.html">wblcdf</a> </p> <p><strong>Source Code: </strong> <a href="https://github.com/gnu-octave/statistics/tree/main/inst/dist_obj/GeneralizedExtremeValueDistribution.m">GeneralizedExtremeValueDistribution</a> @@ -147,39 +201,6 @@ <div class="row d-flex flex-wrap align-items-center"> <div class="col-sm-3 col-md-5 mb-2 mb-sm-0"> <h3 class="d-inline-block mr-2"> - Method: <b><code>cdf</code></b> - </h3> - </div> - </div> - </div> - <div class="card-body"> -<dl> -<dt><u>GeneralizedExtremeValueDistribution:</u> <var>p</var> = <b>icdf</b><i> (<var>pd</var>, <var>p</var>)</i></dt> -</dl> - -<p> Compute the cumulative distribution function (CDF). -</p> -<div class="ms-5"> -<p> <code><var>p</var> = icdf (<var>pd</var>, <var>x</var>)</code> computes the quantile (the - inverse of the CDF) of the probability distribution object, <var>pd</var>, - evaluated at the values in <var>x</var>. -</p> - -</div> - - </div> - </div> - </div> - - - - - <div class="container-xl my-4"> - <div class="card rounded"> - <div class="card-header card-header-mod"> - <div class="row d-flex flex-wrap align-items-center"> - <div class="col-sm-3 col-md-5 mb-2 mb-sm-0"> - <h3 class="d-inline-block mr-2"> Method: <b><code>icdf</code></b> </h3> </div> @@ -233,7 +254,6 @@ </div> </div> - <div class="container-xl my-4"> <div class="card rounded"> <div class="card-header card-header-mod"> diff --git a/docs/GeneralizedParetoDistribution.html b/docs/GeneralizedParetoDistribution.html index 8506ddf..531a8d8 100644 --- a/docs/GeneralizedParetoDistribution.html +++ b/docs/GeneralizedParetoDistribution.html @@ -71,68 +71,126 @@ </div> <div class="card-body"> <dl> -<dt><u>statistics:</u> GeneralizedParetoDistribution</dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>, <var>C</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (…, <code>"upper"</code>)</i></dt> </dl> -<p> Generalized Pareto probability distribution object. +<p> Return the CDF of a univariate distribution evaluated at <var>x</var>. </p> <div class="ms-5"> -<p> A <code>GeneralizedParetoDistribution</code> object consists of parameters, a - model description, and sample data for a generalized Pareto probability - distribution. +<p> <code>cdf</code> is a wrapper for the univariate cumulative distribution functions + available in the statistics package. See the corresponding functions’ help + to learn the signification of the parameters after <var>x</var>. </p> -<p> The generalized Pareto distribution uses the following parameters. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>)</code> returns the CDF for the + one-parameter distribution family specified by <var>name</var> and the + distribution parameter <var>A</var>, evaluated at the values in <var>x</var>. </p> - <table> -<thead><tr><th width="25%"><var>Parameter</var></th><th width="48%"><var>Description</var></th><th width="27%"><var>Support</var></th></tr></thead> -<tr><td width="25%"><code>k</code></td><td width="48%">Shape</td><td width="27%"><math>-Inf < k < Inf</math></td></tr> -<tr><td width="25%"><code>sigma</code></td><td width="48%">Scale</td><td width="27%"><math>sigma > 0</math></td></tr> -<tr><td width="25%"><code>theta</code></td><td width="48%">Location</td><td width="27%"><math>-Inf < theta < Inf</math></td></tr> -</table> - -<p> There are several ways to create a <code>GeneralizedParetoDistribution</code> object. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>)</code> returns the CDF + for the two-parameter distribution family specified by <var>name</var> and the + distribution parameters <var>A</var> and <var>B</var>, evaluated at the values in + <var>x</var>. </p> - <ul> -<li> Fit a distribution to data using the <code>fitdist</code> function. - </li><li> Create a distribution with specified parameter values using the - <code>makedist</code> function. - </li><li> Use the constructor <code>GeneralizedParetoDistribution (<var>k</var>, <var>sigma</var>)</code> - to create a generalized Pareto distribution with specified parameter values. - </li><li> Use the static method <code>GeneralizedParetoDistribution.fit (<var>x</var>, - <var>k</var>, <var>freq</var>)</code> to a distribution to data <var>x</var>. - </li></ul> - -<p> It is highly recommended to use <code>fitdist</code> and <code>makedist</code> - functions to create probability distribution objects, instead of the - constructor and the aforementioned static method. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>, <var>C</var>)</code> returns + the CDF for the three-parameter distribution family specified by <var>name</var> + and the distribution parameters <var>A</var>, <var>B</var>, and <var>C</var>, evaluated at + the values in <var>x</var>. +</p> +<p> <code><var>p</var> = cdf (…, <code>"upper"</code>)</code> returns the complement of the + CDF using an algorithm that more accurately computes the extreme upper-tail + probabilities. <code>"upper"</code> can follow any of the input arguments in the + previous syntaxes. </p> -<p> A <code>GeneralizedParetoDistribution</code> object contains the following - properties, which can be accessed using dot notation. +<p> <var>name</var> must be a char string of the name or the abbreviation of the + desired cumulative distribution function as listed in the followng table. + The last column shows the number of required parameters that should be parsed + after <var>x</var> to the desired CDF. The optional input argument + <code>"upper"</code> does not count in the required number of parameters. </p> <table> -<tr><td width="25%"><code>DistributionName</code></td><td width="25%"><code>DistributionCode</code></td><td width="25%"><code>NumParameters</code></td><td width="25%"><code>ParameterNames</code></td></tr> -<tr><td width="25%"><code>ParameterDescription</code></td><td width="25%"><code>ParameterValues</code></td><td width="25%"><code>ParameterValues</code></td><td width="25%"><code>ParameterCI</code></td></tr> -<tr><td width="25%"><code>ParameterIsFixed</code></td><td width="25%"><code>Truncation</code></td><td width="25%"><code>IsTruncated</code></td><td width="25%"><code>InputData</code></td></tr> +<thead><tr><th width="40%">Distribution Name</th><th width="5%"></th><th width="20%">Abbreviation</th><th width="5%"></th><th width="30%">Input Parameters</th></tr></thead> +<tr><td width="40%"><code>"Beta"</code></td><td width="5%"></td><td width="20%"><code>"beta"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Binomial"</code></td><td width="5%"></td><td width="20%"><code>"bino"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Birnbaum-Saunders"</code></td><td width="5%"></td><td width="20%"><code>"bisa"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Burr"</code></td><td width="5%"></td><td width="20%"><code>"burr"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Cauchy"</code></td><td width="5%"></td><td width="20%"><code>"cauchy"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Chi-squared"</code></td><td width="5%"></td><td width="20%"><code>"chi2"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Extreme Value"</code></td><td width="5%"></td><td width="20%"><code>"ev"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Exponential"</code></td><td width="5%"></td><td width="20%"><code>"exp"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"F-Distribution"</code></td><td width="5%"></td><td width="20%"><code>"f"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Gamma"</code></td><td width="5%"></td><td width="20%"><code>"gam"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Geometric"</code></td><td width="5%"></td><td width="20%"><code>"geo"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Generalized Extreme Value"</code></td><td width="5%"></td><td width="20%"><code>"gev"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Generalized Pareto"</code></td><td width="5%"></td><td width="20%"><code>"gp"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Gumbel"</code></td><td width="5%"></td><td width="20%"><code>"gumbel"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Half-normal"</code></td><td width="5%"></td><td width="20%"><code>"hn"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Hypergeometric"</code></td><td width="5%"></td><td width="20%"><code>"hyge"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Inverse Gaussian"</code></td><td width="5%"></td><td width="20%"><code>"invg"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Laplace"</code></td><td width="5%"></td><td width="20%"><code>"laplace"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Logistic"</code></td><td width="5%"></td><td width="20%"><code>"logi"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Log-Logistic"</code></td><td width="5%"></td><td width="20%"><code>"logl"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Lognormal"</code></td><td width="5%"></td><td width="20%"><code>"logn"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Nakagami"</code></td><td width="5%"></td><td width="20%"><code>"naka"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Negative Binomial"</code></td><td width="5%"></td><td width="20%"><code>"nbin"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Noncentral F-Distribution"</code></td><td width="5%"></td><td width="20%"><code>"ncf"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Noncentral Student T"</code></td><td width="5%"></td><td width="20%"><code>"nct"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Noncentral Chi-Squared"</code></td><td width="5%"></td><td width="20%"><code>"ncx2"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Normal"</code></td><td width="5%"></td><td width="20%"><code>"norm"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Poisson"</code></td><td width="5%"></td><td width="20%"><code>"poiss"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Rayleigh"</code></td><td width="5%"></td><td width="20%"><code>"rayl"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Rician"</code></td><td width="5%"></td><td width="20%"><code>"rice"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Student T"</code></td><td width="5%"></td><td width="20%"><code>"t"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"location-scale T"</code></td><td width="5%"></td><td width="20%"><code>"tls"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Triangular"</code></td><td width="5%"></td><td width="20%"><code>"tri"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Discrete Uniform"</code></td><td width="5%"></td><td width="20%"><code>"unid"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Uniform"</code></td><td width="5%"></td><td width="20%"><code>"unif"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Von Mises"</code></td><td width="5%"></td><td width="20%"><code>"vm"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Weibull"</code></td><td width="5%"></td><td width="20%"><code>"wbl"</code></td><td width="5%"></td><td width="30%">2</td></tr> </table> -<p> A <code>GeneralizedParetoDistribution</code> object contains the following methods: - <code>cdf</code>, <code>icdf</code>, <code>iqr</code>, <code>mean</code>, <code>median</code>, - <code>negloglik</code>, <code>paramci</code>, <code>pdf</code>, <code>plot</code>, <code>proflik</code>, - <code>random</code>, <code>std</code>, <code>truncate</code>, <code>var</code>. -</p> -<p> Further information about the generalized Pareto distribution can be found - at <a href="https://en.wikipedia.org/wiki/Generalized_Pareto_distribution">https://en.wikipedia.org/wiki/Generalized_Pareto_distribution</a> -</p> <p> <strong>See also: </strong> - <a href="fitdist.html">fitdist</a>, - <a href="makedist.html">makedist</a>, + <a href="icdf.html">icdf</a>, + <a href="pdf.html">pdf</a>, + <a href="cdf.html">cdf</a>, + <a href="betacdf.html">betacdf</a>, + <a href="binocdf.html">binocdf</a>, + <a href="bisacdf.html">bisacdf</a>, + <a href="burrcdf.html">burrcdf</a>, + <a href="cauchycdf.html">cauchycdf</a>, + <a href="chi2cdf.html">chi2cdf</a>, + <a href="evcdf.html">evcdf</a>, + <a href="expcdf.html">expcdf</a>, + <a href="fcdf.html">fcdf</a>, + <a href="gamcdf.html">gamcdf</a>, + <a href="geocdf.html">geocdf</a>, + <a href="gevcdf.html">gevcdf</a>, <a href="gpcdf.html">gpcdf</a>, - <a href="gpinv.html">gpinv</a>, - <a href="gppdf.html">gppdf</a>, - <a href="gprnd.html">gprnd</a>, - <a href="gpfit.html">gpfit</a>, - <a href="gplike.html">gplike</a>, - <a href="gpstat.html">gpstat</a> + <a href="gumbelcdf.html">gumbelcdf</a>, + <a href="hncdf.html">hncdf</a>, + <a href="hygecdf.html">hygecdf</a>, + <a href="invgcdf.html">invgcdf</a>, + <a href="laplacecdf.html">laplacecdf</a>, + <a href="logicdf.html">logicdf</a>, + <a href="loglcdf.html">loglcdf</a>, + <a href="logncdf.html">logncdf</a>, + <a href="nakacdf.html">nakacdf</a>, + <a href="nbincdf.html">nbincdf</a>, + <a href="ncfcdf.html">ncfcdf</a>, + <a href="nctcdf.html">nctcdf</a>, + <a href="ncx2cdf.html">ncx2cdf</a>, + <a href="normcdf.html">normcdf</a>, + <a href="poisscdf.html">poisscdf</a>, + <a href="raylcdf.html">raylcdf</a>, + <a href="ricecdf.html">ricecdf</a>, + <a href="tcdf.html">tcdf</a>, + <a href="tlscdf.html">tlscdf</a>, + <a href="tricdf.html">tricdf</a>, + <a href="unidcdf.html">unidcdf</a>, + <a href="unifcdf.html">unifcdf</a>, + <a href="vmcdf.html">vmcdf</a>, + <a href="wblcdf.html">wblcdf</a> </p> <p><strong>Source Code: </strong> <a href="https://github.com/gnu-octave/statistics/tree/main/inst/dist_obj/GeneralizedParetoDistribution.m">GeneralizedParetoDistribution</a> @@ -143,39 +201,6 @@ <div class="row d-flex flex-wrap align-items-center"> <div class="col-sm-3 col-md-5 mb-2 mb-sm-0"> <h3 class="d-inline-block mr-2"> - Method: <b><code>cdf</code></b> - </h3> - </div> - </div> - </div> - <div class="card-body"> -<dl> -<dt><u>GeneralizedParetoDistribution:</u> <var>p</var> = <b>icdf</b><i> (<var>pd</var>, <var>p</var>)</i></dt> -</dl> - -<p> Compute the cumulative distribution function (CDF). -</p> -<div class="ms-5"> -<p> <code><var>p</var> = icdf (<var>pd</var>, <var>x</var>)</code> computes the quantile (the - inverse of the CDF) of the probability distribution object, <var>pd</var>, - evaluated at the values in <var>x</var>. -</p> - -</div> - - </div> - </div> - </div> - - - - - <div class="container-xl my-4"> - <div class="card rounded"> - <div class="card-header card-header-mod"> - <div class="row d-flex flex-wrap align-items-center"> - <div class="col-sm-3 col-md-5 mb-2 mb-sm-0"> - <h3 class="d-inline-block mr-2"> Method: <b><code>icdf</code></b> </h3> </div> @@ -229,7 +254,6 @@ </div> </div> - <div class="container-xl my-4"> <div class="card rounded"> <div class="card-header card-header-mod"> diff --git a/docs/HalfNormalDistribution.html b/docs/HalfNormalDistribution.html index 6654861..41bbb89 100644 --- a/docs/HalfNormalDistribution.html +++ b/docs/HalfNormalDistribution.html @@ -71,66 +71,126 @@ </div> <div class="card-body"> <dl> -<dt><u>statistics:</u> HalfNormalDistribution</dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>, <var>C</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (…, <code>"upper"</code>)</i></dt> </dl> -<p> Half-normal probability distribution object. +<p> Return the CDF of a univariate distribution evaluated at <var>x</var>. </p> <div class="ms-5"> -<p> A <code>HalfNormalDistribution</code> object consists of parameters, a model - description, and sample data for a half-normal probability distribution. +<p> <code>cdf</code> is a wrapper for the univariate cumulative distribution functions + available in the statistics package. See the corresponding functions’ help + to learn the signification of the parameters after <var>x</var>. </p> -<p> The half-normal distribution uses the following parameters. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>)</code> returns the CDF for the + one-parameter distribution family specified by <var>name</var> and the + distribution parameter <var>A</var>, evaluated at the values in <var>x</var>. </p> - <table> -<thead><tr><th width="25%"><var>Parameter</var></th><th width="48%"><var>Description</var></th><th width="27%"><var>Support</var></th></tr></thead> -<tr><td width="25%"><code>mu</code></td><td width="48%">Location</td><td width="27%"><math>-Inf < mu < Inf</math></td></tr> -<tr><td width="25%"><code>sigma</code></td><td width="48%">Scale</td><td width="27%"><math>sigma > 0</math></td></tr> -</table> - -<p> There are several ways to create a <code>HalfNormalDistribution</code> object. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>)</code> returns the CDF + for the two-parameter distribution family specified by <var>name</var> and the + distribution parameters <var>A</var> and <var>B</var>, evaluated at the values in + <var>x</var>. </p> - <ul> -<li> Fit a distribution to data using the <code>fitdist</code> function. - </li><li> Create a distribution with specified parameter values using the - <code>makedist</code> function. - </li><li> Use the constructor <code>HalfNormalDistribution (<var>mu</var>, <var>sigma</var>)</code> - to create a half-normal distribution with specified parameter values. - </li><li> Use the static method <code>HalfNormalDistribution.fit (<var>x</var>, - <var>mu</var>, <var>freq</var>)</code> to a distribution to data <var>x</var>. - </li></ul> - -<p> It is highly recommended to use <code>fitdist</code> and <code>makedist</code> - functions to create probability distribution objects, instead of the - constructor and the aforementioned static method. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>, <var>C</var>)</code> returns + the CDF for the three-parameter distribution family specified by <var>name</var> + and the distribution parameters <var>A</var>, <var>B</var>, and <var>C</var>, evaluated at + the values in <var>x</var>. +</p> +<p> <code><var>p</var> = cdf (…, <code>"upper"</code>)</code> returns the complement of the + CDF using an algorithm that more accurately computes the extreme upper-tail + probabilities. <code>"upper"</code> can follow any of the input arguments in the + previous syntaxes. </p> -<p> A <code>HalfNormalDistribution</code> object contains the following properties, - which can be accessed using dot notation. +<p> <var>name</var> must be a char string of the name or the abbreviation of the + desired cumulative distribution function as listed in the followng table. + The last column shows the number of required parameters that should be parsed + after <var>x</var> to the desired CDF. The optional input argument + <code>"upper"</code> does not count in the required number of parameters. </p> <table> -<tr><td width="25%"><code>DistributionName</code></td><td width="25%"><code>DistributionCode</code></td><td width="25%"><code>NumParameters</code></td><td width="25%"><code>ParameterNames</code></td></tr> -<tr><td width="25%"><code>ParameterDescription</code></td><td width="25%"><code>ParameterValues</code></td><td width="25%"><code>ParameterValues</code></td><td width="25%"><code>ParameterCI</code></td></tr> -<tr><td width="25%"><code>ParameterIsFixed</code></td><td width="25%"><code>Truncation</code></td><td width="25%"><code>IsTruncated</code></td><td width="25%"><code>InputData</code></td></tr> +<thead><tr><th width="40%">Distribution Name</th><th width="5%"></th><th width="20%">Abbreviation</th><th width="5%"></th><th width="30%">Input Parameters</th></tr></thead> +<tr><td width="40%"><code>"Beta"</code></td><td width="5%"></td><td width="20%"><code>"beta"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Binomial"</code></td><td width="5%"></td><td width="20%"><code>"bino"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Birnbaum-Saunders"</code></td><td width="5%"></td><td width="20%"><code>"bisa"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Burr"</code></td><td width="5%"></td><td width="20%"><code>"burr"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Cauchy"</code></td><td width="5%"></td><td width="20%"><code>"cauchy"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Chi-squared"</code></td><td width="5%"></td><td width="20%"><code>"chi2"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Extreme Value"</code></td><td width="5%"></td><td width="20%"><code>"ev"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Exponential"</code></td><td width="5%"></td><td width="20%"><code>"exp"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"F-Distribution"</code></td><td width="5%"></td><td width="20%"><code>"f"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Gamma"</code></td><td width="5%"></td><td width="20%"><code>"gam"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Geometric"</code></td><td width="5%"></td><td width="20%"><code>"geo"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Generalized Extreme Value"</code></td><td width="5%"></td><td width="20%"><code>"gev"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Generalized Pareto"</code></td><td width="5%"></td><td width="20%"><code>"gp"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Gumbel"</code></td><td width="5%"></td><td width="20%"><code>"gumbel"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Half-normal"</code></td><td width="5%"></td><td width="20%"><code>"hn"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Hypergeometric"</code></td><td width="5%"></td><td width="20%"><code>"hyge"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Inverse Gaussian"</code></td><td width="5%"></td><td width="20%"><code>"invg"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Laplace"</code></td><td width="5%"></td><td width="20%"><code>"laplace"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Logistic"</code></td><td width="5%"></td><td width="20%"><code>"logi"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Log-Logistic"</code></td><td width="5%"></td><td width="20%"><code>"logl"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Lognormal"</code></td><td width="5%"></td><td width="20%"><code>"logn"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Nakagami"</code></td><td width="5%"></td><td width="20%"><code>"naka"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Negative Binomial"</code></td><td width="5%"></td><td width="20%"><code>"nbin"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Noncentral F-Distribution"</code></td><td width="5%"></td><td width="20%"><code>"ncf"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Noncentral Student T"</code></td><td width="5%"></td><td width="20%"><code>"nct"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Noncentral Chi-Squared"</code></td><td width="5%"></td><td width="20%"><code>"ncx2"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Normal"</code></td><td width="5%"></td><td width="20%"><code>"norm"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Poisson"</code></td><td width="5%"></td><td width="20%"><code>"poiss"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Rayleigh"</code></td><td width="5%"></td><td width="20%"><code>"rayl"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Rician"</code></td><td width="5%"></td><td width="20%"><code>"rice"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Student T"</code></td><td width="5%"></td><td width="20%"><code>"t"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"location-scale T"</code></td><td width="5%"></td><td width="20%"><code>"tls"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Triangular"</code></td><td width="5%"></td><td width="20%"><code>"tri"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Discrete Uniform"</code></td><td width="5%"></td><td width="20%"><code>"unid"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Uniform"</code></td><td width="5%"></td><td width="20%"><code>"unif"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Von Mises"</code></td><td width="5%"></td><td width="20%"><code>"vm"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Weibull"</code></td><td width="5%"></td><td width="20%"><code>"wbl"</code></td><td width="5%"></td><td width="30%">2</td></tr> </table> -<p> A <code>HalfNormalDistribution</code> object contains the following methods: - <code>cdf</code>, <code>icdf</code>, <code>iqr</code>, <code>mean</code>, <code>median</code>, - <code>negloglik</code>, <code>paramci</code>, <code>pdf</code>, <code>plot</code>, <code>proflik</code>, - <code>random</code>, <code>std</code>, <code>truncate</code>, <code>var</code>. -</p> -<p> Further information about the half-normal distribution can be found at - <a href="https://en.wikipedia.org/wiki/Half-normal_distribution">https://en.wikipedia.org/wiki/Half-normal_distribution</a> -</p> <p> <strong>See also: </strong> - <a href="fitdist.html">fitdist</a>, - <a href="makedist.html">makedist</a>, + <a href="icdf.html">icdf</a>, + <a href="pdf.html">pdf</a>, + <a href="cdf.html">cdf</a>, + <a href="betacdf.html">betacdf</a>, + <a href="binocdf.html">binocdf</a>, + <a href="bisacdf.html">bisacdf</a>, + <a href="burrcdf.html">burrcdf</a>, + <a href="cauchycdf.html">cauchycdf</a>, + <a href="chi2cdf.html">chi2cdf</a>, + <a href="evcdf.html">evcdf</a>, + <a href="expcdf.html">expcdf</a>, + <a href="fcdf.html">fcdf</a>, + <a href="gamcdf.html">gamcdf</a>, + <a href="geocdf.html">geocdf</a>, + <a href="gevcdf.html">gevcdf</a>, + <a href="gpcdf.html">gpcdf</a>, + <a href="gumbelcdf.html">gumbelcdf</a>, <a href="hncdf.html">hncdf</a>, - <a href="hninv.html">hninv</a>, - <a href="hnpdf.html">hnpdf</a>, - <a href="hnrnd.html">hnrnd</a>, - <a href="hnfit.html">hnfit</a>, - <a href="hnlike.html">hnlike</a>, - <a href="hnstat.html">hnstat</a> + <a href="hygecdf.html">hygecdf</a>, + <a href="invgcdf.html">invgcdf</a>, + <a href="laplacecdf.html">laplacecdf</a>, + <a href="logicdf.html">logicdf</a>, + <a href="loglcdf.html">loglcdf</a>, + <a href="logncdf.html">logncdf</a>, + <a href="nakacdf.html">nakacdf</a>, + <a href="nbincdf.html">nbincdf</a>, + <a href="ncfcdf.html">ncfcdf</a>, + <a href="nctcdf.html">nctcdf</a>, + <a href="ncx2cdf.html">ncx2cdf</a>, + <a href="normcdf.html">normcdf</a>, + <a href="poisscdf.html">poisscdf</a>, + <a href="raylcdf.html">raylcdf</a>, + <a href="ricecdf.html">ricecdf</a>, + <a href="tcdf.html">tcdf</a>, + <a href="tlscdf.html">tlscdf</a>, + <a href="tricdf.html">tricdf</a>, + <a href="unidcdf.html">unidcdf</a>, + <a href="unifcdf.html">unifcdf</a>, + <a href="vmcdf.html">vmcdf</a>, + <a href="wblcdf.html">wblcdf</a> </p> <p><strong>Source Code: </strong> <a href="https://github.com/gnu-octave/statistics/tree/main/inst/dist_obj/HalfNormalDistribution.m">HalfNormalDistribution</a> @@ -141,39 +201,6 @@ <div class="row d-flex flex-wrap align-items-center"> <div class="col-sm-3 col-md-5 mb-2 mb-sm-0"> <h3 class="d-inline-block mr-2"> - Method: <b><code>cdf</code></b> - </h3> - </div> - </div> - </div> - <div class="card-body"> -<dl> -<dt><u>HalfNormalDistribution:</u> <var>p</var> = <b>icdf</b><i> (<var>pd</var>, <var>p</var>)</i></dt> -</dl> - -<p> Compute the cumulative distribution function (CDF). -</p> -<div class="ms-5"> -<p> <code><var>p</var> = icdf (<var>pd</var>, <var>x</var>)</code> computes the quantile (the - inverse of the CDF) of the probability distribution object, <var>pd</var>, - evaluated at the values in <var>x</var>. -</p> - -</div> - - </div> - </div> - </div> - - - - - <div class="container-xl my-4"> - <div class="card rounded"> - <div class="card-header card-header-mod"> - <div class="row d-flex flex-wrap align-items-center"> - <div class="col-sm-3 col-md-5 mb-2 mb-sm-0"> - <h3 class="d-inline-block mr-2"> Method: <b><code>icdf</code></b> </h3> </div> @@ -227,7 +254,6 @@ </div> </div> - <div class="container-xl my-4"> <div class="card rounded"> <div class="card-header card-header-mod"> diff --git a/docs/InverseGaussianDistribution.html b/docs/InverseGaussianDistribution.html index 2a030bd..d2920b1 100644 --- a/docs/InverseGaussianDistribution.html +++ b/docs/InverseGaussianDistribution.html @@ -71,66 +71,126 @@ </div> <div class="card-body"> <dl> -<dt><u>statistics:</u> InverseGaussianDistribution</dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>, <var>C</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (…, <code>"upper"</code>)</i></dt> </dl> -<p> Logistic probability distribution object. +<p> Return the CDF of a univariate distribution evaluated at <var>x</var>. </p> <div class="ms-5"> -<p> A <code>InverseGaussianDistribution</code> object consists of parameters, a model - description, and sample data for a logistic probability distribution. +<p> <code>cdf</code> is a wrapper for the univariate cumulative distribution functions + available in the statistics package. See the corresponding functions’ help + to learn the signification of the parameters after <var>x</var>. </p> -<p> The logistic distribution uses the following parameters. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>)</code> returns the CDF for the + one-parameter distribution family specified by <var>name</var> and the + distribution parameter <var>A</var>, evaluated at the values in <var>x</var>. </p> - <table> -<thead><tr><th width="25%"><var>Parameter</var></th><th width="48%"><var>Description</var></th><th width="27%"><var>Support</var></th></tr></thead> -<tr><td width="25%"><code>mu</code></td><td width="48%">Scale parameter</td><td width="27%"><math>mu >= 0</math></td></tr> -<tr><td width="25%"><code>lambda</code></td><td width="48%">Shape parameter</td><td width="27%"><math>lambda > 0</math></td></tr> -</table> - -<p> There are several ways to create a <code>InverseGaussianDistribution</code> object. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>)</code> returns the CDF + for the two-parameter distribution family specified by <var>name</var> and the + distribution parameters <var>A</var> and <var>B</var>, evaluated at the values in + <var>x</var>. </p> - <ul> -<li> Fit a distribution to data using the <code>fitdist</code> function. - </li><li> Create a distribution with specified parameter values using the - <code>makedist</code> function. - </li><li> Use the constructor <code>InverseGaussianDistribution (<var>mu</var>, <var>lambda</var>)</code> - to create a logistic distribution with specified parameter values. - </li><li> Use the static method <code>InverseGaussianDistribution.fit (<var>x</var>, - <var>censor</var>, <var>freq</var>, <var>options</var>)</code> to a distribution to data <var>x</var>. - </li></ul> - -<p> It is highly recommended to use <code>fitdist</code> and <code>makedist</code> - functions to create probability distribution objects, instead of the - constructor and the aforementioned static method. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>, <var>C</var>)</code> returns + the CDF for the three-parameter distribution family specified by <var>name</var> + and the distribution parameters <var>A</var>, <var>B</var>, and <var>C</var>, evaluated at + the values in <var>x</var>. +</p> +<p> <code><var>p</var> = cdf (…, <code>"upper"</code>)</code> returns the complement of the + CDF using an algorithm that more accurately computes the extreme upper-tail + probabilities. <code>"upper"</code> can follow any of the input arguments in the + previous syntaxes. </p> -<p> A <code>InverseGaussianDistribution</code> object contains the following properties, - which can be accessed using dot notation. +<p> <var>name</var> must be a char string of the name or the abbreviation of the + desired cumulative distribution function as listed in the followng table. + The last column shows the number of required parameters that should be parsed + after <var>x</var> to the desired CDF. The optional input argument + <code>"upper"</code> does not count in the required number of parameters. </p> <table> -<tr><td width="25%"><code>DistributionName</code></td><td width="25%"><code>DistributionCode</code></td><td width="25%"><code>NumParameters</code></td><td width="25%"><code>ParameterNames</code></td></tr> -<tr><td width="25%"><code>ParameterDescription</code></td><td width="25%"><code>ParameterValues</code></td><td width="25%"><code>ParameterValues</code></td><td width="25%"><code>ParameterCI</code></td></tr> -<tr><td width="25%"><code>ParameterIsFixed</code></td><td width="25%"><code>Truncation</code></td><td width="25%"><code>IsTruncated</code></td><td width="25%"><code>InputData</code></td></tr> +<thead><tr><th width="40%">Distribution Name</th><th width="5%"></th><th width="20%">Abbreviation</th><th width="5%"></th><th width="30%">Input Parameters</th></tr></thead> +<tr><td width="40%"><code>"Beta"</code></td><td width="5%"></td><td width="20%"><code>"beta"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Binomial"</code></td><td width="5%"></td><td width="20%"><code>"bino"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Birnbaum-Saunders"</code></td><td width="5%"></td><td width="20%"><code>"bisa"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Burr"</code></td><td width="5%"></td><td width="20%"><code>"burr"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Cauchy"</code></td><td width="5%"></td><td width="20%"><code>"cauchy"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Chi-squared"</code></td><td width="5%"></td><td width="20%"><code>"chi2"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Extreme Value"</code></td><td width="5%"></td><td width="20%"><code>"ev"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Exponential"</code></td><td width="5%"></td><td width="20%"><code>"exp"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"F-Distribution"</code></td><td width="5%"></td><td width="20%"><code>"f"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Gamma"</code></td><td width="5%"></td><td width="20%"><code>"gam"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Geometric"</code></td><td width="5%"></td><td width="20%"><code>"geo"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Generalized Extreme Value"</code></td><td width="5%"></td><td width="20%"><code>"gev"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Generalized Pareto"</code></td><td width="5%"></td><td width="20%"><code>"gp"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Gumbel"</code></td><td width="5%"></td><td width="20%"><code>"gumbel"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Half-normal"</code></td><td width="5%"></td><td width="20%"><code>"hn"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Hypergeometric"</code></td><td width="5%"></td><td width="20%"><code>"hyge"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Inverse Gaussian"</code></td><td width="5%"></td><td width="20%"><code>"invg"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Laplace"</code></td><td width="5%"></td><td width="20%"><code>"laplace"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Logistic"</code></td><td width="5%"></td><td width="20%"><code>"logi"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Log-Logistic"</code></td><td width="5%"></td><td width="20%"><code>"logl"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Lognormal"</code></td><td width="5%"></td><td width="20%"><code>"logn"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Nakagami"</code></td><td width="5%"></td><td width="20%"><code>"naka"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Negative Binomial"</code></td><td width="5%"></td><td width="20%"><code>"nbin"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Noncentral F-Distribution"</code></td><td width="5%"></td><td width="20%"><code>"ncf"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Noncentral Student T"</code></td><td width="5%"></td><td width="20%"><code>"nct"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Noncentral Chi-Squared"</code></td><td width="5%"></td><td width="20%"><code>"ncx2"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Normal"</code></td><td width="5%"></td><td width="20%"><code>"norm"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Poisson"</code></td><td width="5%"></td><td width="20%"><code>"poiss"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Rayleigh"</code></td><td width="5%"></td><td width="20%"><code>"rayl"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Rician"</code></td><td width="5%"></td><td width="20%"><code>"rice"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Student T"</code></td><td width="5%"></td><td width="20%"><code>"t"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"location-scale T"</code></td><td width="5%"></td><td width="20%"><code>"tls"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Triangular"</code></td><td width="5%"></td><td width="20%"><code>"tri"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Discrete Uniform"</code></td><td width="5%"></td><td width="20%"><code>"unid"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Uniform"</code></td><td width="5%"></td><td width="20%"><code>"unif"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Von Mises"</code></td><td width="5%"></td><td width="20%"><code>"vm"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Weibull"</code></td><td width="5%"></td><td width="20%"><code>"wbl"</code></td><td width="5%"></td><td width="30%">2</td></tr> </table> -<p> A <code>InverseGaussianDistribution</code> object contains the following methods: - <code>cdf</code>, <code>icdf</code>, <code>iqr</code>, <code>mean</code>, <code>median</code>, - <code>negloglik</code>, <code>paramci</code>, <code>pdf</code>, <code>plot</code>, <code>proflik</code>, - <code>random</code>, <code>std</code>, <code>truncate</code>, <code>var</code>. -</p> -<p> Further information about the inverse Gaussian distribution can be found at - <a href="https://en.wikipedia.org/wiki/Inverse_Gaussian_distribution">https://en.wikipedia.org/wiki/Inverse_Gaussian_distribution</a> -</p> <p> <strong>See also: </strong> - <a href="fitdist.html">fitdist</a>, - <a href="makedist.html">makedist</a>, + <a href="icdf.html">icdf</a>, + <a href="pdf.html">pdf</a>, + <a href="cdf.html">cdf</a>, + <a href="betacdf.html">betacdf</a>, + <a href="binocdf.html">binocdf</a>, + <a href="bisacdf.html">bisacdf</a>, + <a href="burrcdf.html">burrcdf</a>, + <a href="cauchycdf.html">cauchycdf</a>, + <a href="chi2cdf.html">chi2cdf</a>, + <a href="evcdf.html">evcdf</a>, + <a href="expcdf.html">expcdf</a>, + <a href="fcdf.html">fcdf</a>, + <a href="gamcdf.html">gamcdf</a>, + <a href="geocdf.html">geocdf</a>, + <a href="gevcdf.html">gevcdf</a>, + <a href="gpcdf.html">gpcdf</a>, + <a href="gumbelcdf.html">gumbelcdf</a>, + <a href="hncdf.html">hncdf</a>, + <a href="hygecdf.html">hygecdf</a>, <a href="invgcdf.html">invgcdf</a>, - <a href="invginv.html">invginv</a>, - <a href="invgpdf.html">invgpdf</a>, - <a href="invgrnd.html">invgrnd</a>, - <a href="lognfit.html">lognfit</a>, - <a href="invglike.html">invglike</a>, - <a href="invgstat.html">invgstat</a> + <a href="laplacecdf.html">laplacecdf</a>, + <a href="logicdf.html">logicdf</a>, + <a href="loglcdf.html">loglcdf</a>, + <a href="logncdf.html">logncdf</a>, + <a href="nakacdf.html">nakacdf</a>, + <a href="nbincdf.html">nbincdf</a>, + <a href="ncfcdf.html">ncfcdf</a>, + <a href="nctcdf.html">nctcdf</a>, + <a href="ncx2cdf.html">ncx2cdf</a>, + <a href="normcdf.html">normcdf</a>, + <a href="poisscdf.html">poisscdf</a>, + <a href="raylcdf.html">raylcdf</a>, + <a href="ricecdf.html">ricecdf</a>, + <a href="tcdf.html">tcdf</a>, + <a href="tlscdf.html">tlscdf</a>, + <a href="tricdf.html">tricdf</a>, + <a href="unidcdf.html">unidcdf</a>, + <a href="unifcdf.html">unifcdf</a>, + <a href="vmcdf.html">vmcdf</a>, + <a href="wblcdf.html">wblcdf</a> </p> <p><strong>Source Code: </strong> <a href="https://github.com/gnu-octave/statistics/tree/main/inst/dist_obj/InverseGaussianDistribution.m">InverseGaussianDistribution</a> @@ -141,39 +201,6 @@ <div class="row d-flex flex-wrap align-items-center"> <div class="col-sm-3 col-md-5 mb-2 mb-sm-0"> <h3 class="d-inline-block mr-2"> - Method: <b><code>cdf</code></b> - </h3> - </div> - </div> - </div> - <div class="card-body"> -<dl> -<dt><u>InverseGaussianDistribution:</u> <var>p</var> = <b>icdf</b><i> (<var>pd</var>, <var>p</var>)</i></dt> -</dl> - -<p> Compute the cumulative distribution function (CDF). -</p> -<div class="ms-5"> -<p> <code><var>p</var> = icdf (<var>pd</var>, <var>x</var>)</code> computes the quantile (the - inverse of the CDF) of the probability distribution object, <var>pd</var>, - evaluated at the values in <var>x</var>. -</p> - -</div> - - </div> - </div> - </div> - - - - - <div class="container-xl my-4"> - <div class="card rounded"> - <div class="card-header card-header-mod"> - <div class="row d-flex flex-wrap align-items-center"> - <div class="col-sm-3 col-md-5 mb-2 mb-sm-0"> - <h3 class="d-inline-block mr-2"> Method: <b><code>icdf</code></b> </h3> </div> @@ -227,7 +254,6 @@ </div> </div> - <div class="container-xl my-4"> <div class="card rounded"> <div class="card-header card-header-mod"> diff --git a/docs/LogisticDistribution.html b/docs/LogisticDistribution.html index 5060242..856fece 100644 --- a/docs/LogisticDistribution.html +++ b/docs/LogisticDistribution.html @@ -71,76 +71,126 @@ </div> <div class="card-body"> <dl> -<dt><u>statistics:</u> LogisticDistribution</dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>, <var>C</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (…, <code>"upper"</code>)</i></dt> </dl> -<p> Logistic probability distribution object. +<p> Return the CDF of a univariate distribution evaluated at <var>x</var>. </p> <div class="ms-5"> -<p> A <code>LogisticDistribution</code> object consists of parameters, a model - description, and sample data for a logistic probability distribution. +<p> <code>cdf</code> is a wrapper for the univariate cumulative distribution functions + available in the statistics package. See the corresponding functions’ help + to learn the signification of the parameters after <var>x</var>. </p> -<p> The logistic distribution uses the following parameters. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>)</code> returns the CDF for the + one-parameter distribution family specified by <var>name</var> and the + distribution parameter <var>A</var>, evaluated at the values in <var>x</var>. </p> - <table> -<thead><tr><th width="25%"><var>Parameter</var></th><th width="48%"><var>Description</var></th><th width="27%"><var>Support</var></th></tr></thead> -<tr><td width="25%"><code>mu</code></td><td width="48%">Mean of logarithmic values</td><td width="27%"><math>mu >= 0</math></td></tr> -<tr><td width="25%"><code>sigma</code></td><td width="48%">Scale of logarithmic values</td><td width="27%"><math>sigma > 0</math></td></tr> -</table> - -<p> There are several ways to create a <code>LogisticDistribution</code> object. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>)</code> returns the CDF + for the two-parameter distribution family specified by <var>name</var> and the + distribution parameters <var>A</var> and <var>B</var>, evaluated at the values in + <var>x</var>. </p> - <ul> -<li> Fit a distribution to data using the <code>fitdist</code> function. - </li><li> Create a distribution with specified parameter values using the - <code>makedist</code> function. - </li><li> Use the constructor <code>LogisticDistribution (<var>mu</var>, <var>sigma</var>)</code> - to create a logistic distribution with specified parameter values. - </li><li> Use the static method <code>LogisticDistribution.fit (<var>x</var>, - <var>censor</var>, <var>freq</var>, <var>options</var>)</code> to a distribution to data <var>x</var>. - </li></ul> - -<p> It is highly recommended to use <code>fitdist</code> and <code>makedist</code> - functions to create probability distribution objects, instead of the - constructor and the aforementioned static method. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>, <var>C</var>)</code> returns + the CDF for the three-parameter distribution family specified by <var>name</var> + and the distribution parameters <var>A</var>, <var>B</var>, and <var>C</var>, evaluated at + the values in <var>x</var>. +</p> +<p> <code><var>p</var> = cdf (…, <code>"upper"</code>)</code> returns the complement of the + CDF using an algorithm that more accurately computes the extreme upper-tail + probabilities. <code>"upper"</code> can follow any of the input arguments in the + previous syntaxes. </p> -<p> A <code>LogisticDistribution</code> object contains the following properties, - which can be accessed using dot notation. +<p> <var>name</var> must be a char string of the name or the abbreviation of the + desired cumulative distribution function as listed in the followng table. + The last column shows the number of required parameters that should be parsed + after <var>x</var> to the desired CDF. The optional input argument + <code>"upper"</code> does not count in the required number of parameters. </p> <table> -<tr><td width="25%"><code>DistributionName</code></td><td width="25%"><code>DistributionCode</code></td><td width="25%"><code>NumParameters</code></td><td width="25%"><code>ParameterNames</code></td></tr> -<tr><td width="25%"><code>ParameterDescription</code></td><td width="25%"><code>ParameterValues</code></td><td width="25%"><code>ParameterValues</code></td><td width="25%"><code>ParameterCI</code></td></tr> -<tr><td width="25%"><code>ParameterIsFixed</code></td><td width="25%"><code>Truncation</code></td><td width="25%"><code>IsTruncated</code></td><td width="25%"><code>InputData</code></td></tr> +<thead><tr><th width="40%">Distribution Name</th><th width="5%"></th><th width="20%">Abbreviation</th><th width="5%"></th><th width="30%">Input Parameters</th></tr></thead> +<tr><td width="40%"><code>"Beta"</code></td><td width="5%"></td><td width="20%"><code>"beta"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Binomial"</code></td><td width="5%"></td><td width="20%"><code>"bino"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Birnbaum-Saunders"</code></td><td width="5%"></td><td width="20%"><code>"bisa"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Burr"</code></td><td width="5%"></td><td width="20%"><code>"burr"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Cauchy"</code></td><td width="5%"></td><td width="20%"><code>"cauchy"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Chi-squared"</code></td><td width="5%"></td><td width="20%"><code>"chi2"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Extreme Value"</code></td><td width="5%"></td><td width="20%"><code>"ev"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Exponential"</code></td><td width="5%"></td><td width="20%"><code>"exp"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"F-Distribution"</code></td><td width="5%"></td><td width="20%"><code>"f"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Gamma"</code></td><td width="5%"></td><td width="20%"><code>"gam"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Geometric"</code></td><td width="5%"></td><td width="20%"><code>"geo"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Generalized Extreme Value"</code></td><td width="5%"></td><td width="20%"><code>"gev"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Generalized Pareto"</code></td><td width="5%"></td><td width="20%"><code>"gp"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Gumbel"</code></td><td width="5%"></td><td width="20%"><code>"gumbel"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Half-normal"</code></td><td width="5%"></td><td width="20%"><code>"hn"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Hypergeometric"</code></td><td width="5%"></td><td width="20%"><code>"hyge"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Inverse Gaussian"</code></td><td width="5%"></td><td width="20%"><code>"invg"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Laplace"</code></td><td width="5%"></td><td width="20%"><code>"laplace"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Logistic"</code></td><td width="5%"></td><td width="20%"><code>"logi"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Log-Logistic"</code></td><td width="5%"></td><td width="20%"><code>"logl"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Lognormal"</code></td><td width="5%"></td><td width="20%"><code>"logn"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Nakagami"</code></td><td width="5%"></td><td width="20%"><code>"naka"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Negative Binomial"</code></td><td width="5%"></td><td width="20%"><code>"nbin"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Noncentral F-Distribution"</code></td><td width="5%"></td><td width="20%"><code>"ncf"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Noncentral Student T"</code></td><td width="5%"></td><td width="20%"><code>"nct"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Noncentral Chi-Squared"</code></td><td width="5%"></td><td width="20%"><code>"ncx2"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Normal"</code></td><td width="5%"></td><td width="20%"><code>"norm"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Poisson"</code></td><td width="5%"></td><td width="20%"><code>"poiss"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Rayleigh"</code></td><td width="5%"></td><td width="20%"><code>"rayl"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Rician"</code></td><td width="5%"></td><td width="20%"><code>"rice"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Student T"</code></td><td width="5%"></td><td width="20%"><code>"t"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"location-scale T"</code></td><td width="5%"></td><td width="20%"><code>"tls"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Triangular"</code></td><td width="5%"></td><td width="20%"><code>"tri"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Discrete Uniform"</code></td><td width="5%"></td><td width="20%"><code>"unid"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Uniform"</code></td><td width="5%"></td><td width="20%"><code>"unif"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Von Mises"</code></td><td width="5%"></td><td width="20%"><code>"vm"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Weibull"</code></td><td width="5%"></td><td width="20%"><code>"wbl"</code></td><td width="5%"></td><td width="30%">2</td></tr> </table> -<p> A <code>LogisticDistribution</code> object contains the following methods: - <code>cdf</code>, <code>icdf</code>, <code>iqr</code>, <code>mean</code>, <code>median</code>, - <code>negloglik</code>, <code>paramci</code>, <code>pdf</code>, <code>plot</code>, <code>proflik</code>, - <code>random</code>, <code>std</code>, <code>truncate</code>, <code>var</code>. -</p> -<p> Further information about the logistic distribution can be found at - <a href="https://en.wikipedia.org/wiki/Log-normal_distribution">https://en.wikipedia.org/wiki/Log-normal_distribution</a> -</p> -<p> OCTAVE/MATLAB use an alternative parameterization given by the pair - <math>μ, s</math>, i.e. <var>mu</var> and <var>sigma</var>, in analogy with the logistic - distribution. Their relation to the <math>α</math> and <math>b</math> parameters used - in Wikipedia are given below: -</p> - <ul> -<li> <code><var>mu</var> = log (<var>a</var>)</code> - </li><li> <code><var>sigma</var> = 1 / <var>a</var></code> - </li></ul> - <p> <strong>See also: </strong> - <a href="fitdist.html">fitdist</a>, - <a href="makedist.html">makedist</a>, + <a href="icdf.html">icdf</a>, + <a href="pdf.html">pdf</a>, + <a href="cdf.html">cdf</a>, + <a href="betacdf.html">betacdf</a>, + <a href="binocdf.html">binocdf</a>, + <a href="bisacdf.html">bisacdf</a>, + <a href="burrcdf.html">burrcdf</a>, + <a href="cauchycdf.html">cauchycdf</a>, + <a href="chi2cdf.html">chi2cdf</a>, + <a href="evcdf.html">evcdf</a>, + <a href="expcdf.html">expcdf</a>, + <a href="fcdf.html">fcdf</a>, + <a href="gamcdf.html">gamcdf</a>, + <a href="geocdf.html">geocdf</a>, + <a href="gevcdf.html">gevcdf</a>, + <a href="gpcdf.html">gpcdf</a>, + <a href="gumbelcdf.html">gumbelcdf</a>, + <a href="hncdf.html">hncdf</a>, + <a href="hygecdf.html">hygecdf</a>, + <a href="invgcdf.html">invgcdf</a>, + <a href="laplacecdf.html">laplacecdf</a>, <a href="logicdf.html">logicdf</a>, - <a href="logiinv.html">logiinv</a>, - <a href="logipdf.html">logipdf</a>, - <a href="logirnd.html">logirnd</a>, - <a href="lognfit.html">lognfit</a>, - <a href="logilike.html">logilike</a>, - <a href="logistat.html">logistat</a> + <a href="loglcdf.html">loglcdf</a>, + <a href="logncdf.html">logncdf</a>, + <a href="nakacdf.html">nakacdf</a>, + <a href="nbincdf.html">nbincdf</a>, + <a href="ncfcdf.html">ncfcdf</a>, + <a href="nctcdf.html">nctcdf</a>, + <a href="ncx2cdf.html">ncx2cdf</a>, + <a href="normcdf.html">normcdf</a>, + <a href="poisscdf.html">poisscdf</a>, + <a href="raylcdf.html">raylcdf</a>, + <a href="ricecdf.html">ricecdf</a>, + <a href="tcdf.html">tcdf</a>, + <a href="tlscdf.html">tlscdf</a>, + <a href="tricdf.html">tricdf</a>, + <a href="unidcdf.html">unidcdf</a>, + <a href="unifcdf.html">unifcdf</a>, + <a href="vmcdf.html">vmcdf</a>, + <a href="wblcdf.html">wblcdf</a> </p> <p><strong>Source Code: </strong> <a href="https://github.com/gnu-octave/statistics/tree/main/inst/dist_obj/LogisticDistribution.m">LogisticDistribution</a> @@ -151,39 +201,6 @@ <div class="row d-flex flex-wrap align-items-center"> <div class="col-sm-3 col-md-5 mb-2 mb-sm-0"> <h3 class="d-inline-block mr-2"> - Method: <b><code>cdf</code></b> - </h3> - </div> - </div> - </div> - <div class="card-body"> -<dl> -<dt><u>LogisticDistribution:</u> <var>p</var> = <b>icdf</b><i> (<var>pd</var>, <var>p</var>)</i></dt> -</dl> - -<p> Compute the cumulative distribution function (CDF). -</p> -<div class="ms-5"> -<p> <code><var>p</var> = icdf (<var>pd</var>, <var>x</var>)</code> computes the quantile (the - inverse of the CDF) of the probability distribution object, <var>pd</var>, - evaluated at the values in <var>x</var>. -</p> - -</div> - - </div> - </div> - </div> - - - - - <div class="container-xl my-4"> - <div class="card rounded"> - <div class="card-header card-header-mod"> - <div class="row d-flex flex-wrap align-items-center"> - <div class="col-sm-3 col-md-5 mb-2 mb-sm-0"> - <h3 class="d-inline-block mr-2"> Method: <b><code>icdf</code></b> </h3> </div> @@ -237,7 +254,6 @@ </div> </div> - <div class="container-xl my-4"> <div class="card rounded"> <div class="card-header card-header-mod"> diff --git a/docs/LoglogisticDistribution.html b/docs/LoglogisticDistribution.html index ae197e9..ebc77ac 100644 --- a/docs/LoglogisticDistribution.html +++ b/docs/LoglogisticDistribution.html @@ -71,76 +71,126 @@ </div> <div class="card-body"> <dl> -<dt><u>statistics:</u> LoglogisticDistribution</dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>, <var>C</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (…, <code>"upper"</code>)</i></dt> </dl> -<p> Loglogistic probability distribution object. +<p> Return the CDF of a univariate distribution evaluated at <var>x</var>. </p> <div class="ms-5"> -<p> A <code>LoglogisticDistribution</code> object consists of parameters, a model - description, and sample data for a loglogistic probability distribution. +<p> <code>cdf</code> is a wrapper for the univariate cumulative distribution functions + available in the statistics package. See the corresponding functions’ help + to learn the signification of the parameters after <var>x</var>. </p> -<p> The loglogistic distribution uses the following parameters. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>)</code> returns the CDF for the + one-parameter distribution family specified by <var>name</var> and the + distribution parameter <var>A</var>, evaluated at the values in <var>x</var>. </p> - <table> -<thead><tr><th width="25%"><var>Parameter</var></th><th width="48%"><var>Description</var></th><th width="27%"><var>Support</var></th></tr></thead> -<tr><td width="25%"><code>mu</code></td><td width="48%">Mean of logarithmic values</td><td width="27%"><math>mu >= 0</math></td></tr> -<tr><td width="25%"><code>sigma</code></td><td width="48%">Scale of logarithmic values</td><td width="27%"><math>sigma > 0</math></td></tr> -</table> - -<p> There are several ways to create a <code>LoglogisticDistribution</code> object. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>)</code> returns the CDF + for the two-parameter distribution family specified by <var>name</var> and the + distribution parameters <var>A</var> and <var>B</var>, evaluated at the values in + <var>x</var>. </p> - <ul> -<li> Fit a distribution to data using the <code>fitdist</code> function. - </li><li> Create a distribution with specified parameter values using the - <code>makedist</code> function. - </li><li> Use the constructor <code>LoglogisticDistribution (<var>mu</var>, <var>sigma</var>)</code> - to create a loglogistic distribution with specified parameter values. - </li><li> Use the static method <code>LoglogisticDistribution.fit (<var>x</var>, - <var>censor</var>, <var>freq</var>, <var>options</var>)</code> to a distribution to data <var>x</var>. - </li></ul> - -<p> It is highly recommended to use <code>fitdist</code> and <code>makedist</code> - functions to create probability distribution objects, instead of the - constructor and the aforementioned static method. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>, <var>C</var>)</code> returns + the CDF for the three-parameter distribution family specified by <var>name</var> + and the distribution parameters <var>A</var>, <var>B</var>, and <var>C</var>, evaluated at + the values in <var>x</var>. +</p> +<p> <code><var>p</var> = cdf (…, <code>"upper"</code>)</code> returns the complement of the + CDF using an algorithm that more accurately computes the extreme upper-tail + probabilities. <code>"upper"</code> can follow any of the input arguments in the + previous syntaxes. </p> -<p> A <code>LoglogisticDistribution</code> object contains the following properties, - which can be accessed using dot notation. +<p> <var>name</var> must be a char string of the name or the abbreviation of the + desired cumulative distribution function as listed in the followng table. + The last column shows the number of required parameters that should be parsed + after <var>x</var> to the desired CDF. The optional input argument + <code>"upper"</code> does not count in the required number of parameters. </p> <table> -<tr><td width="25%"><code>DistributionName</code></td><td width="25%"><code>DistributionCode</code></td><td width="25%"><code>NumParameters</code></td><td width="25%"><code>ParameterNames</code></td></tr> -<tr><td width="25%"><code>ParameterDescription</code></td><td width="25%"><code>ParameterValues</code></td><td width="25%"><code>ParameterValues</code></td><td width="25%"><code>ParameterCI</code></td></tr> -<tr><td width="25%"><code>ParameterIsFixed</code></td><td width="25%"><code>Truncation</code></td><td width="25%"><code>IsTruncated</code></td><td width="25%"><code>InputData</code></td></tr> +<thead><tr><th width="40%">Distribution Name</th><th width="5%"></th><th width="20%">Abbreviation</th><th width="5%"></th><th width="30%">Input Parameters</th></tr></thead> +<tr><td width="40%"><code>"Beta"</code></td><td width="5%"></td><td width="20%"><code>"beta"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Binomial"</code></td><td width="5%"></td><td width="20%"><code>"bino"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Birnbaum-Saunders"</code></td><td width="5%"></td><td width="20%"><code>"bisa"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Burr"</code></td><td width="5%"></td><td width="20%"><code>"burr"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Cauchy"</code></td><td width="5%"></td><td width="20%"><code>"cauchy"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Chi-squared"</code></td><td width="5%"></td><td width="20%"><code>"chi2"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Extreme Value"</code></td><td width="5%"></td><td width="20%"><code>"ev"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Exponential"</code></td><td width="5%"></td><td width="20%"><code>"exp"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"F-Distribution"</code></td><td width="5%"></td><td width="20%"><code>"f"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Gamma"</code></td><td width="5%"></td><td width="20%"><code>"gam"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Geometric"</code></td><td width="5%"></td><td width="20%"><code>"geo"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Generalized Extreme Value"</code></td><td width="5%"></td><td width="20%"><code>"gev"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Generalized Pareto"</code></td><td width="5%"></td><td width="20%"><code>"gp"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Gumbel"</code></td><td width="5%"></td><td width="20%"><code>"gumbel"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Half-normal"</code></td><td width="5%"></td><td width="20%"><code>"hn"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Hypergeometric"</code></td><td width="5%"></td><td width="20%"><code>"hyge"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Inverse Gaussian"</code></td><td width="5%"></td><td width="20%"><code>"invg"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Laplace"</code></td><td width="5%"></td><td width="20%"><code>"laplace"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Logistic"</code></td><td width="5%"></td><td width="20%"><code>"logi"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Log-Logistic"</code></td><td width="5%"></td><td width="20%"><code>"logl"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Lognormal"</code></td><td width="5%"></td><td width="20%"><code>"logn"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Nakagami"</code></td><td width="5%"></td><td width="20%"><code>"naka"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Negative Binomial"</code></td><td width="5%"></td><td width="20%"><code>"nbin"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Noncentral F-Distribution"</code></td><td width="5%"></td><td width="20%"><code>"ncf"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Noncentral Student T"</code></td><td width="5%"></td><td width="20%"><code>"nct"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Noncentral Chi-Squared"</code></td><td width="5%"></td><td width="20%"><code>"ncx2"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Normal"</code></td><td width="5%"></td><td width="20%"><code>"norm"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Poisson"</code></td><td width="5%"></td><td width="20%"><code>"poiss"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Rayleigh"</code></td><td width="5%"></td><td width="20%"><code>"rayl"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Rician"</code></td><td width="5%"></td><td width="20%"><code>"rice"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Student T"</code></td><td width="5%"></td><td width="20%"><code>"t"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"location-scale T"</code></td><td width="5%"></td><td width="20%"><code>"tls"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Triangular"</code></td><td width="5%"></td><td width="20%"><code>"tri"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Discrete Uniform"</code></td><td width="5%"></td><td width="20%"><code>"unid"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Uniform"</code></td><td width="5%"></td><td width="20%"><code>"unif"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Von Mises"</code></td><td width="5%"></td><td width="20%"><code>"vm"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Weibull"</code></td><td width="5%"></td><td width="20%"><code>"wbl"</code></td><td width="5%"></td><td width="30%">2</td></tr> </table> -<p> A <code>LoglogisticDistribution</code> object contains the following methods: - <code>cdf</code>, <code>icdf</code>, <code>iqr</code>, <code>mean</code>, <code>median</code>, - <code>negloglik</code>, <code>paramci</code>, <code>pdf</code>, <code>plot</code>, <code>proflik</code>, - <code>random</code>, <code>std</code>, <code>truncate</code>, <code>var</code>. -</p> -<p> Further information about the loglogistic distribution can be found at - <a href="https://en.wikipedia.org/wiki/Log-normal_distribution">https://en.wikipedia.org/wiki/Log-normal_distribution</a> -</p> -<p> OCTAVE/MATLAB use an alternative parameterization given by the pair - <math>μ, s</math>, i.e. <var>mu</var> and <var>sigma</var>, in analogy with the logistic - distribution. Their relation to the <math>α</math> and <math>b</math> parameters used - in Wikipedia are given below: -</p> - <ul> -<li> <code><var>mu</var> = log (<var>a</var>)</code> - </li><li> <code><var>sigma</var> = 1 / <var>a</var></code> - </li></ul> - <p> <strong>See also: </strong> - <a href="fitdist.html">fitdist</a>, - <a href="makedist.html">makedist</a>, + <a href="icdf.html">icdf</a>, + <a href="pdf.html">pdf</a>, + <a href="cdf.html">cdf</a>, + <a href="betacdf.html">betacdf</a>, + <a href="binocdf.html">binocdf</a>, + <a href="bisacdf.html">bisacdf</a>, + <a href="burrcdf.html">burrcdf</a>, + <a href="cauchycdf.html">cauchycdf</a>, + <a href="chi2cdf.html">chi2cdf</a>, + <a href="evcdf.html">evcdf</a>, + <a href="expcdf.html">expcdf</a>, + <a href="fcdf.html">fcdf</a>, + <a href="gamcdf.html">gamcdf</a>, + <a href="geocdf.html">geocdf</a>, + <a href="gevcdf.html">gevcdf</a>, + <a href="gpcdf.html">gpcdf</a>, + <a href="gumbelcdf.html">gumbelcdf</a>, + <a href="hncdf.html">hncdf</a>, + <a href="hygecdf.html">hygecdf</a>, + <a href="invgcdf.html">invgcdf</a>, + <a href="laplacecdf.html">laplacecdf</a>, + <a href="logicdf.html">logicdf</a>, <a href="loglcdf.html">loglcdf</a>, - <a href="loglinv.html">loglinv</a>, - <a href="loglpdf.html">loglpdf</a>, - <a href="loglrnd.html">loglrnd</a>, - <a href="lognfit.html">lognfit</a>, - <a href="logllike.html">logllike</a>, - <a href="loglstat.html">loglstat</a> + <a href="logncdf.html">logncdf</a>, + <a href="nakacdf.html">nakacdf</a>, + <a href="nbincdf.html">nbincdf</a>, + <a href="ncfcdf.html">ncfcdf</a>, + <a href="nctcdf.html">nctcdf</a>, + <a href="ncx2cdf.html">ncx2cdf</a>, + <a href="normcdf.html">normcdf</a>, + <a href="poisscdf.html">poisscdf</a>, + <a href="raylcdf.html">raylcdf</a>, + <a href="ricecdf.html">ricecdf</a>, + <a href="tcdf.html">tcdf</a>, + <a href="tlscdf.html">tlscdf</a>, + <a href="tricdf.html">tricdf</a>, + <a href="unidcdf.html">unidcdf</a>, + <a href="unifcdf.html">unifcdf</a>, + <a href="vmcdf.html">vmcdf</a>, + <a href="wblcdf.html">wblcdf</a> </p> <p><strong>Source Code: </strong> <a href="https://github.com/gnu-octave/statistics/tree/main/inst/dist_obj/LoglogisticDistribution.m">LoglogisticDistribution</a> @@ -151,39 +201,6 @@ <div class="row d-flex flex-wrap align-items-center"> <div class="col-sm-3 col-md-5 mb-2 mb-sm-0"> <h3 class="d-inline-block mr-2"> - Method: <b><code>cdf</code></b> - </h3> - </div> - </div> - </div> - <div class="card-body"> -<dl> -<dt><u>LoglogisticDistribution:</u> <var>p</var> = <b>icdf</b><i> (<var>pd</var>, <var>p</var>)</i></dt> -</dl> - -<p> Compute the cumulative distribution function (CDF). -</p> -<div class="ms-5"> -<p> <code><var>p</var> = icdf (<var>pd</var>, <var>x</var>)</code> computes the quantile (the - inverse of the CDF) of the probability distribution object, <var>pd</var>, - evaluated at the values in <var>x</var>. -</p> - -</div> - - </div> - </div> - </div> - - - - - <div class="container-xl my-4"> - <div class="card rounded"> - <div class="card-header card-header-mod"> - <div class="row d-flex flex-wrap align-items-center"> - <div class="col-sm-3 col-md-5 mb-2 mb-sm-0"> - <h3 class="d-inline-block mr-2"> Method: <b><code>icdf</code></b> </h3> </div> @@ -237,7 +254,6 @@ </div> </div> - <div class="container-xl my-4"> <div class="card rounded"> <div class="card-header card-header-mod"> diff --git a/docs/LognormalDistribution.html b/docs/LognormalDistribution.html index db4a3e9..648ecfb 100644 --- a/docs/LognormalDistribution.html +++ b/docs/LognormalDistribution.html @@ -71,66 +71,126 @@ </div> <div class="card-body"> <dl> -<dt><u>statistics:</u> LognormalDistribution</dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>, <var>C</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (…, <code>"upper"</code>)</i></dt> </dl> -<p> Lognormal probability distribution object. +<p> Return the CDF of a univariate distribution evaluated at <var>x</var>. </p> <div class="ms-5"> -<p> A <code>LognormalDistribution</code> object consists of parameters, a model - description, and sample data for a lognormal probability distribution. +<p> <code>cdf</code> is a wrapper for the univariate cumulative distribution functions + available in the statistics package. See the corresponding functions’ help + to learn the signification of the parameters after <var>x</var>. </p> -<p> The lognormal distribution uses the following parameters. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>)</code> returns the CDF for the + one-parameter distribution family specified by <var>name</var> and the + distribution parameter <var>A</var>, evaluated at the values in <var>x</var>. </p> - <table> -<thead><tr><th width="25%"><var>Parameter</var></th><th width="48%"><var>Description</var></th><th width="27%"><var>Support</var></th></tr></thead> -<tr><td width="25%"><code>mu</code></td><td width="48%">Mean of logarithmic values</td><td width="27%"><math>-Inf < mu < Inf</math></td></tr> -<tr><td width="25%"><code>sigma</code></td><td width="48%">Standard deviation of logarithmic values</td><td width="27%"><math>sigma > 0</math></td></tr> -</table> - -<p> There are several ways to create a <code>LognormalDistribution</code> object. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>)</code> returns the CDF + for the two-parameter distribution family specified by <var>name</var> and the + distribution parameters <var>A</var> and <var>B</var>, evaluated at the values in + <var>x</var>. </p> - <ul> -<li> Fit a distribution to data using the <code>fitdist</code> function. - </li><li> Create a distribution with specified parameter values using the - <code>makedist</code> function. - </li><li> Use the constructor <code>LognormalDistribution (<var>mu</var>, <var>sigma</var>)</code> - to create a lognormal distribution with specified parameter values. - </li><li> Use the static method <code>LognormalDistribution.fit (<var>x</var>, - <var>censor</var>, <var>freq</var>, <var>options</var>)</code> to a distribution to data <var>x</var>. - </li></ul> - -<p> It is highly recommended to use <code>fitdist</code> and <code>makedist</code> - functions to create probability distribution objects, instead of the - constructor and the aforementioned static method. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>, <var>C</var>)</code> returns + the CDF for the three-parameter distribution family specified by <var>name</var> + and the distribution parameters <var>A</var>, <var>B</var>, and <var>C</var>, evaluated at + the values in <var>x</var>. +</p> +<p> <code><var>p</var> = cdf (…, <code>"upper"</code>)</code> returns the complement of the + CDF using an algorithm that more accurately computes the extreme upper-tail + probabilities. <code>"upper"</code> can follow any of the input arguments in the + previous syntaxes. </p> -<p> A <code>LognormalDistribution</code> object contains the following properties, - which can be accessed using dot notation. +<p> <var>name</var> must be a char string of the name or the abbreviation of the + desired cumulative distribution function as listed in the followng table. + The last column shows the number of required parameters that should be parsed + after <var>x</var> to the desired CDF. The optional input argument + <code>"upper"</code> does not count in the required number of parameters. </p> <table> -<tr><td width="25%"><code>DistributionName</code></td><td width="25%"><code>DistributionCode</code></td><td width="25%"><code>NumParameters</code></td><td width="25%"><code>ParameterNames</code></td></tr> -<tr><td width="25%"><code>ParameterDescription</code></td><td width="25%"><code>ParameterValues</code></td><td width="25%"><code>ParameterValues</code></td><td width="25%"><code>ParameterCI</code></td></tr> -<tr><td width="25%"><code>ParameterIsFixed</code></td><td width="25%"><code>Truncation</code></td><td width="25%"><code>IsTruncated</code></td><td width="25%"><code>InputData</code></td></tr> +<thead><tr><th width="40%">Distribution Name</th><th width="5%"></th><th width="20%">Abbreviation</th><th width="5%"></th><th width="30%">Input Parameters</th></tr></thead> +<tr><td width="40%"><code>"Beta"</code></td><td width="5%"></td><td width="20%"><code>"beta"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Binomial"</code></td><td width="5%"></td><td width="20%"><code>"bino"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Birnbaum-Saunders"</code></td><td width="5%"></td><td width="20%"><code>"bisa"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Burr"</code></td><td width="5%"></td><td width="20%"><code>"burr"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Cauchy"</code></td><td width="5%"></td><td width="20%"><code>"cauchy"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Chi-squared"</code></td><td width="5%"></td><td width="20%"><code>"chi2"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Extreme Value"</code></td><td width="5%"></td><td width="20%"><code>"ev"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Exponential"</code></td><td width="5%"></td><td width="20%"><code>"exp"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"F-Distribution"</code></td><td width="5%"></td><td width="20%"><code>"f"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Gamma"</code></td><td width="5%"></td><td width="20%"><code>"gam"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Geometric"</code></td><td width="5%"></td><td width="20%"><code>"geo"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Generalized Extreme Value"</code></td><td width="5%"></td><td width="20%"><code>"gev"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Generalized Pareto"</code></td><td width="5%"></td><td width="20%"><code>"gp"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Gumbel"</code></td><td width="5%"></td><td width="20%"><code>"gumbel"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Half-normal"</code></td><td width="5%"></td><td width="20%"><code>"hn"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Hypergeometric"</code></td><td width="5%"></td><td width="20%"><code>"hyge"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Inverse Gaussian"</code></td><td width="5%"></td><td width="20%"><code>"invg"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Laplace"</code></td><td width="5%"></td><td width="20%"><code>"laplace"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Logistic"</code></td><td width="5%"></td><td width="20%"><code>"logi"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Log-Logistic"</code></td><td width="5%"></td><td width="20%"><code>"logl"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Lognormal"</code></td><td width="5%"></td><td width="20%"><code>"logn"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Nakagami"</code></td><td width="5%"></td><td width="20%"><code>"naka"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Negative Binomial"</code></td><td width="5%"></td><td width="20%"><code>"nbin"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Noncentral F-Distribution"</code></td><td width="5%"></td><td width="20%"><code>"ncf"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Noncentral Student T"</code></td><td width="5%"></td><td width="20%"><code>"nct"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Noncentral Chi-Squared"</code></td><td width="5%"></td><td width="20%"><code>"ncx2"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Normal"</code></td><td width="5%"></td><td width="20%"><code>"norm"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Poisson"</code></td><td width="5%"></td><td width="20%"><code>"poiss"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Rayleigh"</code></td><td width="5%"></td><td width="20%"><code>"rayl"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Rician"</code></td><td width="5%"></td><td width="20%"><code>"rice"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Student T"</code></td><td width="5%"></td><td width="20%"><code>"t"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"location-scale T"</code></td><td width="5%"></td><td width="20%"><code>"tls"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Triangular"</code></td><td width="5%"></td><td width="20%"><code>"tri"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Discrete Uniform"</code></td><td width="5%"></td><td width="20%"><code>"unid"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Uniform"</code></td><td width="5%"></td><td width="20%"><code>"unif"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Von Mises"</code></td><td width="5%"></td><td width="20%"><code>"vm"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Weibull"</code></td><td width="5%"></td><td width="20%"><code>"wbl"</code></td><td width="5%"></td><td width="30%">2</td></tr> </table> -<p> A <code>LognormalDistribution</code> object contains the following methods: - <code>cdf</code>, <code>icdf</code>, <code>iqr</code>, <code>mean</code>, <code>median</code>, - <code>negloglik</code>, <code>paramci</code>, <code>pdf</code>, <code>plot</code>, <code>proflik</code>, - <code>random</code>, <code>std</code>, <code>truncate</code>, <code>var</code>. -</p> -<p> Further information about the lognormal distribution can be found at - <a href="https://en.wikipedia.org/wiki/Log-normal_distribution">https://en.wikipedia.org/wiki/Log-normal_distribution</a> -</p> <p> <strong>See also: </strong> - <a href="fitdist.html">fitdist</a>, - <a href="makedist.html">makedist</a>, + <a href="icdf.html">icdf</a>, + <a href="pdf.html">pdf</a>, + <a href="cdf.html">cdf</a>, + <a href="betacdf.html">betacdf</a>, + <a href="binocdf.html">binocdf</a>, + <a href="bisacdf.html">bisacdf</a>, + <a href="burrcdf.html">burrcdf</a>, + <a href="cauchycdf.html">cauchycdf</a>, + <a href="chi2cdf.html">chi2cdf</a>, + <a href="evcdf.html">evcdf</a>, + <a href="expcdf.html">expcdf</a>, + <a href="fcdf.html">fcdf</a>, + <a href="gamcdf.html">gamcdf</a>, + <a href="geocdf.html">geocdf</a>, + <a href="gevcdf.html">gevcdf</a>, + <a href="gpcdf.html">gpcdf</a>, + <a href="gumbelcdf.html">gumbelcdf</a>, + <a href="hncdf.html">hncdf</a>, + <a href="hygecdf.html">hygecdf</a>, + <a href="invgcdf.html">invgcdf</a>, + <a href="laplacecdf.html">laplacecdf</a>, + <a href="logicdf.html">logicdf</a>, + <a href="loglcdf.html">loglcdf</a>, <a href="logncdf.html">logncdf</a>, - <a href="logninv.html">logninv</a>, - <a href="lognpdf.html">lognpdf</a>, - <a href="lognrnd.html">lognrnd</a>, - <a href="lognfit.html">lognfit</a>, - <a href="lognlike.html">lognlike</a>, - <a href="lognstat.html">lognstat</a> + <a href="nakacdf.html">nakacdf</a>, + <a href="nbincdf.html">nbincdf</a>, + <a href="ncfcdf.html">ncfcdf</a>, + <a href="nctcdf.html">nctcdf</a>, + <a href="ncx2cdf.html">ncx2cdf</a>, + <a href="normcdf.html">normcdf</a>, + <a href="poisscdf.html">poisscdf</a>, + <a href="raylcdf.html">raylcdf</a>, + <a href="ricecdf.html">ricecdf</a>, + <a href="tcdf.html">tcdf</a>, + <a href="tlscdf.html">tlscdf</a>, + <a href="tricdf.html">tricdf</a>, + <a href="unidcdf.html">unidcdf</a>, + <a href="unifcdf.html">unifcdf</a>, + <a href="vmcdf.html">vmcdf</a>, + <a href="wblcdf.html">wblcdf</a> </p> <p><strong>Source Code: </strong> <a href="https://github.com/gnu-octave/statistics/tree/main/inst/dist_obj/LognormalDistribution.m">LognormalDistribution</a> @@ -141,39 +201,6 @@ <div class="row d-flex flex-wrap align-items-center"> <div class="col-sm-3 col-md-5 mb-2 mb-sm-0"> <h3 class="d-inline-block mr-2"> - Method: <b><code>cdf</code></b> - </h3> - </div> - </div> - </div> - <div class="card-body"> -<dl> -<dt><u>LognormalDistribution:</u> <var>p</var> = <b>icdf</b><i> (<var>pd</var>, <var>p</var>)</i></dt> -</dl> - -<p> Compute the cumulative distribution function (CDF). -</p> -<div class="ms-5"> -<p> <code><var>p</var> = icdf (<var>pd</var>, <var>x</var>)</code> computes the quantile (the - inverse of the CDF) of the probability distribution object, <var>pd</var>, - evaluated at the values in <var>x</var>. -</p> - -</div> - - </div> - </div> - </div> - - - - - <div class="container-xl my-4"> - <div class="card rounded"> - <div class="card-header card-header-mod"> - <div class="row d-flex flex-wrap align-items-center"> - <div class="col-sm-3 col-md-5 mb-2 mb-sm-0"> - <h3 class="d-inline-block mr-2"> Method: <b><code>icdf</code></b> </h3> </div> @@ -227,7 +254,6 @@ </div> </div> - <div class="container-xl my-4"> <div class="card rounded"> <div class="card-header card-header-mod"> diff --git a/docs/LoguniformDistribution.html b/docs/LoguniformDistribution.html index 1153a4e..ec93bc9 100644 --- a/docs/LoguniformDistribution.html +++ b/docs/LoguniformDistribution.html @@ -71,54 +71,126 @@ </div> <div class="card-body"> <dl> -<dt><u>statistics:</u> LoguniformDistribution</dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>, <var>C</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (…, <code>"upper"</code>)</i></dt> </dl> -<p> Loguniform probability distribution object. +<p> Return the CDF of a univariate distribution evaluated at <var>x</var>. </p> <div class="ms-5"> -<p> A <code>LoguniformDistribution</code> object consists of parameters, a model - description, and sample data for a loguniform probability distribution. +<p> <code>cdf</code> is a wrapper for the univariate cumulative distribution functions + available in the statistics package. See the corresponding functions’ help + to learn the signification of the parameters after <var>x</var>. </p> -<p> The loguniform distribution uses the following parameters. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>)</code> returns the CDF for the + one-parameter distribution family specified by <var>name</var> and the + distribution parameter <var>A</var>, evaluated at the values in <var>x</var>. </p> - <table> -<thead><tr><th width="25%"><var>Parameter</var></th><th width="48%"><var>Description</var></th><th width="27%"><var>Support</var></th></tr></thead> -<tr><td width="25%"><code>Lower</code></td><td width="48%">Lower limit</td><td width="27%"><math>0 < Lower < Upper</math></td></tr> -<tr><td width="25%"><code>Upper</code></td><td width="48%">Upper limit</td><td width="27%"><math>Lower < Upper < Inf</math></td></tr> -</table> - -<p> There are several ways to create a <code>LoguniformDistribution</code> object. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>)</code> returns the CDF + for the two-parameter distribution family specified by <var>name</var> and the + distribution parameters <var>A</var> and <var>B</var>, evaluated at the values in + <var>x</var>. +</p> +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>, <var>C</var>)</code> returns + the CDF for the three-parameter distribution family specified by <var>name</var> + and the distribution parameters <var>A</var>, <var>B</var>, and <var>C</var>, evaluated at + the values in <var>x</var>. </p> - <ul> -<li> Create a distribution with specified parameter values using the - <code>makedist</code> function. - </li><li> Use the constructor <code>LoguniformDistribution (<var>Lower</var>)</code> - to create a loguniform distribution with specified parameter values. - </li></ul> - -<p> It is highly recommended to use the <code>makedist</code> function to create - probability distribution objects, instead of the constructor. +<p> <code><var>p</var> = cdf (…, <code>"upper"</code>)</code> returns the complement of the + CDF using an algorithm that more accurately computes the extreme upper-tail + probabilities. <code>"upper"</code> can follow any of the input arguments in the + previous syntaxes. </p> -<p> A <code>LoguniformDistribution</code> object contains the following properties, - which can be accessed using dot notation. +<p> <var>name</var> must be a char string of the name or the abbreviation of the + desired cumulative distribution function as listed in the followng table. + The last column shows the number of required parameters that should be parsed + after <var>x</var> to the desired CDF. The optional input argument + <code>"upper"</code> does not count in the required number of parameters. </p> <table> -<tr><td width="25%"><code>DistributionName</code></td><td width="25%"><code>DistributionCode</code></td><td width="25%"><code>NumParameters</code></td><td width="25%"><code>ParameterNames</code></td></tr> -<tr><td width="25%"><code>ParameterDescription</code></td><td width="25%"><code>ParameterValues</code></td><td width="25%"><code>Truncation</code></td><td width="25%"><code>IsTruncated</code></td></tr> +<thead><tr><th width="40%">Distribution Name</th><th width="5%"></th><th width="20%">Abbreviation</th><th width="5%"></th><th width="30%">Input Parameters</th></tr></thead> +<tr><td width="40%"><code>"Beta"</code></td><td width="5%"></td><td width="20%"><code>"beta"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Binomial"</code></td><td width="5%"></td><td width="20%"><code>"bino"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Birnbaum-Saunders"</code></td><td width="5%"></td><td width="20%"><code>"bisa"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Burr"</code></td><td width="5%"></td><td width="20%"><code>"burr"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Cauchy"</code></td><td width="5%"></td><td width="20%"><code>"cauchy"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Chi-squared"</code></td><td width="5%"></td><td width="20%"><code>"chi2"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Extreme Value"</code></td><td width="5%"></td><td width="20%"><code>"ev"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Exponential"</code></td><td width="5%"></td><td width="20%"><code>"exp"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"F-Distribution"</code></td><td width="5%"></td><td width="20%"><code>"f"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Gamma"</code></td><td width="5%"></td><td width="20%"><code>"gam"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Geometric"</code></td><td width="5%"></td><td width="20%"><code>"geo"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Generalized Extreme Value"</code></td><td width="5%"></td><td width="20%"><code>"gev"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Generalized Pareto"</code></td><td width="5%"></td><td width="20%"><code>"gp"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Gumbel"</code></td><td width="5%"></td><td width="20%"><code>"gumbel"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Half-normal"</code></td><td width="5%"></td><td width="20%"><code>"hn"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Hypergeometric"</code></td><td width="5%"></td><td width="20%"><code>"hyge"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Inverse Gaussian"</code></td><td width="5%"></td><td width="20%"><code>"invg"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Laplace"</code></td><td width="5%"></td><td width="20%"><code>"laplace"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Logistic"</code></td><td width="5%"></td><td width="20%"><code>"logi"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Log-Logistic"</code></td><td width="5%"></td><td width="20%"><code>"logl"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Lognormal"</code></td><td width="5%"></td><td width="20%"><code>"logn"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Nakagami"</code></td><td width="5%"></td><td width="20%"><code>"naka"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Negative Binomial"</code></td><td width="5%"></td><td width="20%"><code>"nbin"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Noncentral F-Distribution"</code></td><td width="5%"></td><td width="20%"><code>"ncf"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Noncentral Student T"</code></td><td width="5%"></td><td width="20%"><code>"nct"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Noncentral Chi-Squared"</code></td><td width="5%"></td><td width="20%"><code>"ncx2"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Normal"</code></td><td width="5%"></td><td width="20%"><code>"norm"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Poisson"</code></td><td width="5%"></td><td width="20%"><code>"poiss"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Rayleigh"</code></td><td width="5%"></td><td width="20%"><code>"rayl"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Rician"</code></td><td width="5%"></td><td width="20%"><code>"rice"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Student T"</code></td><td width="5%"></td><td width="20%"><code>"t"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"location-scale T"</code></td><td width="5%"></td><td width="20%"><code>"tls"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Triangular"</code></td><td width="5%"></td><td width="20%"><code>"tri"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Discrete Uniform"</code></td><td width="5%"></td><td width="20%"><code>"unid"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Uniform"</code></td><td width="5%"></td><td width="20%"><code>"unif"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Von Mises"</code></td><td width="5%"></td><td width="20%"><code>"vm"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Weibull"</code></td><td width="5%"></td><td width="20%"><code>"wbl"</code></td><td width="5%"></td><td width="30%">2</td></tr> </table> -<p> A <code>LoguniformDistribution</code> object contains the following methods: - <code>cdf</code>, <code>icdf</code>, <code>iqr</code>, <code>mean</code>, <code>median</code>, - <code>pdf</code>, <code>plot</code>, <code>random</code>, <code>std</code>, <code>truncate</code>, - <code>var</code>. -</p> -<p> Further information about the loguniform distribution can be found at - <a href="https://en.wikipedia.org/wiki/Reciprocal_distribution">https://en.wikipedia.org/wiki/Reciprocal_distribution</a> -</p> <p> <strong>See also: </strong> - <a href="fitdist.html">fitdist</a>, - <a href="makedist.html">makedist</a> + <a href="icdf.html">icdf</a>, + <a href="pdf.html">pdf</a>, + <a href="cdf.html">cdf</a>, + <a href="betacdf.html">betacdf</a>, + <a href="binocdf.html">binocdf</a>, + <a href="bisacdf.html">bisacdf</a>, + <a href="burrcdf.html">burrcdf</a>, + <a href="cauchycdf.html">cauchycdf</a>, + <a href="chi2cdf.html">chi2cdf</a>, + <a href="evcdf.html">evcdf</a>, + <a href="expcdf.html">expcdf</a>, + <a href="fcdf.html">fcdf</a>, + <a href="gamcdf.html">gamcdf</a>, + <a href="geocdf.html">geocdf</a>, + <a href="gevcdf.html">gevcdf</a>, + <a href="gpcdf.html">gpcdf</a>, + <a href="gumbelcdf.html">gumbelcdf</a>, + <a href="hncdf.html">hncdf</a>, + <a href="hygecdf.html">hygecdf</a>, + <a href="invgcdf.html">invgcdf</a>, + <a href="laplacecdf.html">laplacecdf</a>, + <a href="logicdf.html">logicdf</a>, + <a href="loglcdf.html">loglcdf</a>, + <a href="logncdf.html">logncdf</a>, + <a href="nakacdf.html">nakacdf</a>, + <a href="nbincdf.html">nbincdf</a>, + <a href="ncfcdf.html">ncfcdf</a>, + <a href="nctcdf.html">nctcdf</a>, + <a href="ncx2cdf.html">ncx2cdf</a>, + <a href="normcdf.html">normcdf</a>, + <a href="poisscdf.html">poisscdf</a>, + <a href="raylcdf.html">raylcdf</a>, + <a href="ricecdf.html">ricecdf</a>, + <a href="tcdf.html">tcdf</a>, + <a href="tlscdf.html">tlscdf</a>, + <a href="tricdf.html">tricdf</a>, + <a href="unidcdf.html">unidcdf</a>, + <a href="unifcdf.html">unifcdf</a>, + <a href="vmcdf.html">vmcdf</a>, + <a href="wblcdf.html">wblcdf</a> </p> <p><strong>Source Code: </strong> <a href="https://github.com/gnu-octave/statistics/tree/main/inst/dist_obj/LoguniformDistribution.m">LoguniformDistribution</a> @@ -129,38 +201,6 @@ <div class="row d-flex flex-wrap align-items-center"> <div class="col-sm-3 col-md-5 mb-2 mb-sm-0"> <h3 class="d-inline-block mr-2"> - Method: <b><code>cdf</code></b> - </h3> - </div> - </div> - </div> - <div class="card-body"> -<dl> -<dt><u>LoguniformDistribution:</u> <var>p</var> = <b>icdf</b><i> (<var>pd</var>, <var>p</var>)</i></dt> -</dl> - -<p> Compute the cumulative distribution function (CDF). -</p> -<div class="ms-5"> -<p> <code><var>p</var> = icdf (<var>pd</var>, <var>x</var>)</code> computes the quantile (the - inverse of the CDF) of the probability distribution object, <var>pd</var>, - evaluated at the values in <var>x</var>. -</p> - -</div> - - </div> - </div> - </div> - - - - <div class="container-xl my-4"> - <div class="card rounded"> - <div class="card-header card-header-mod"> - <div class="row d-flex flex-wrap align-items-center"> - <div class="col-sm-3 col-md-5 mb-2 mb-sm-0"> - <h3 class="d-inline-block mr-2"> Method: <b><code>icdf</code></b> </h3> </div> diff --git a/docs/MultinomialDistribution.html b/docs/MultinomialDistribution.html index 2ed36ea..4a937e8 100644 --- a/docs/MultinomialDistribution.html +++ b/docs/MultinomialDistribution.html @@ -71,55 +71,126 @@ </div> <div class="card-body"> <dl> -<dt><u>statistics:</u> MultinomialDistribution</dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>, <var>C</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (…, <code>"upper"</code>)</i></dt> </dl> -<p> Multinomial probability distribution object. +<p> Return the CDF of a univariate distribution evaluated at <var>x</var>. </p> <div class="ms-5"> -<p> A <code>MultinomialDistribution</code> object consists of parameters, a model - description, and sample data for a multinomial probability distribution. +<p> <code>cdf</code> is a wrapper for the univariate cumulative distribution functions + available in the statistics package. See the corresponding functions’ help + to learn the signification of the parameters after <var>x</var>. </p> -<p> The multinomial distribution uses the following parameters. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>)</code> returns the CDF for the + one-parameter distribution family specified by <var>name</var> and the + distribution parameter <var>A</var>, evaluated at the values in <var>x</var>. </p> - <table> -<thead><tr><th width="25%"><var>Parameter</var></th><th width="48%"><var>Description</var></th><th width="27%"><var>Support</var></th></tr></thead> -<tr><td width="25%"><code>Probabilities</code></td><td width="48%">Outcome probabilities</td><td width="27%"><math>0 <= Probabilities(i) <= 1; sum_i (Probabilities) = 1</math></td></tr> -</table> - -<p> There are several ways to create a <code>MultinomialDistribution</code> object. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>)</code> returns the CDF + for the two-parameter distribution family specified by <var>name</var> and the + distribution parameters <var>A</var> and <var>B</var>, evaluated at the values in + <var>x</var>. +</p> +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>, <var>C</var>)</code> returns + the CDF for the three-parameter distribution family specified by <var>name</var> + and the distribution parameters <var>A</var>, <var>B</var>, and <var>C</var>, evaluated at + the values in <var>x</var>. </p> - <ul> -<li> Create a distribution with specified parameter values using the - <code>makedist</code> function. - </li><li> Use the constructor <code>MultinomialDistribution (<var>Probabilities</var>)</code> - to create a multinomial distribution with specified parameter values. - </li></ul> - -<p> It is highly recommended to use the <code>makedist</code> function to create - probability distribution objects, instead of the constructor. +<p> <code><var>p</var> = cdf (…, <code>"upper"</code>)</code> returns the complement of the + CDF using an algorithm that more accurately computes the extreme upper-tail + probabilities. <code>"upper"</code> can follow any of the input arguments in the + previous syntaxes. </p> -<p> A <code>MultinomialDistribution</code> object contains the following properties, - which can be accessed using dot notation. +<p> <var>name</var> must be a char string of the name or the abbreviation of the + desired cumulative distribution function as listed in the followng table. + The last column shows the number of required parameters that should be parsed + after <var>x</var> to the desired CDF. The optional input argument + <code>"upper"</code> does not count in the required number of parameters. </p> <table> -<tr><td width="25%"><code>DistributionName</code></td><td width="25%"><code>DistributionCode</code></td><td width="25%"><code>NumParameters</code></td><td width="25%"><code>ParameterNames</code></td></tr> -<tr><td width="25%"><code>ParameterDescription</code></td><td width="25%"><code>ParameterValues</code></td><td width="25%"><code>Truncation</code></td><td width="25%"><code>IsTruncated</code></td></tr> +<thead><tr><th width="40%">Distribution Name</th><th width="5%"></th><th width="20%">Abbreviation</th><th width="5%"></th><th width="30%">Input Parameters</th></tr></thead> +<tr><td width="40%"><code>"Beta"</code></td><td width="5%"></td><td width="20%"><code>"beta"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Binomial"</code></td><td width="5%"></td><td width="20%"><code>"bino"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Birnbaum-Saunders"</code></td><td width="5%"></td><td width="20%"><code>"bisa"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Burr"</code></td><td width="5%"></td><td width="20%"><code>"burr"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Cauchy"</code></td><td width="5%"></td><td width="20%"><code>"cauchy"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Chi-squared"</code></td><td width="5%"></td><td width="20%"><code>"chi2"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Extreme Value"</code></td><td width="5%"></td><td width="20%"><code>"ev"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Exponential"</code></td><td width="5%"></td><td width="20%"><code>"exp"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"F-Distribution"</code></td><td width="5%"></td><td width="20%"><code>"f"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Gamma"</code></td><td width="5%"></td><td width="20%"><code>"gam"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Geometric"</code></td><td width="5%"></td><td width="20%"><code>"geo"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Generalized Extreme Value"</code></td><td width="5%"></td><td width="20%"><code>"gev"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Generalized Pareto"</code></td><td width="5%"></td><td width="20%"><code>"gp"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Gumbel"</code></td><td width="5%"></td><td width="20%"><code>"gumbel"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Half-normal"</code></td><td width="5%"></td><td width="20%"><code>"hn"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Hypergeometric"</code></td><td width="5%"></td><td width="20%"><code>"hyge"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Inverse Gaussian"</code></td><td width="5%"></td><td width="20%"><code>"invg"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Laplace"</code></td><td width="5%"></td><td width="20%"><code>"laplace"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Logistic"</code></td><td width="5%"></td><td width="20%"><code>"logi"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Log-Logistic"</code></td><td width="5%"></td><td width="20%"><code>"logl"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Lognormal"</code></td><td width="5%"></td><td width="20%"><code>"logn"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Nakagami"</code></td><td width="5%"></td><td width="20%"><code>"naka"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Negative Binomial"</code></td><td width="5%"></td><td width="20%"><code>"nbin"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Noncentral F-Distribution"</code></td><td width="5%"></td><td width="20%"><code>"ncf"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Noncentral Student T"</code></td><td width="5%"></td><td width="20%"><code>"nct"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Noncentral Chi-Squared"</code></td><td width="5%"></td><td width="20%"><code>"ncx2"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Normal"</code></td><td width="5%"></td><td width="20%"><code>"norm"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Poisson"</code></td><td width="5%"></td><td width="20%"><code>"poiss"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Rayleigh"</code></td><td width="5%"></td><td width="20%"><code>"rayl"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Rician"</code></td><td width="5%"></td><td width="20%"><code>"rice"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Student T"</code></td><td width="5%"></td><td width="20%"><code>"t"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"location-scale T"</code></td><td width="5%"></td><td width="20%"><code>"tls"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Triangular"</code></td><td width="5%"></td><td width="20%"><code>"tri"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Discrete Uniform"</code></td><td width="5%"></td><td width="20%"><code>"unid"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Uniform"</code></td><td width="5%"></td><td width="20%"><code>"unif"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Von Mises"</code></td><td width="5%"></td><td width="20%"><code>"vm"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Weibull"</code></td><td width="5%"></td><td width="20%"><code>"wbl"</code></td><td width="5%"></td><td width="30%">2</td></tr> </table> -<p> A <code>MultinomialDistribution</code> object contains the following methods: - <code>cdf</code>, <code>icdf</code>, <code>iqr</code>, <code>mean</code>, <code>median</code>, - <code>pdf</code>, <code>plot</code>, <code>random</code>, <code>std</code>, <code>truncate</code>, - <code>var</code>. -</p> -<p> Further information about the multinomial distribution can be found at - <a href="https://en.wikipedia.org/wiki/Multinomial_distribution">https://en.wikipedia.org/wiki/Multinomial_distribution</a> -</p> <p> <strong>See also: </strong> - <a href="fitdist.html">fitdist</a>, - <a href="makedist.html">makedist</a>, - <a href="mnpdf.html">mnpdf</a>, - <a href="mnrnd.html">mnrnd</a> + <a href="icdf.html">icdf</a>, + <a href="pdf.html">pdf</a>, + <a href="cdf.html">cdf</a>, + <a href="betacdf.html">betacdf</a>, + <a href="binocdf.html">binocdf</a>, + <a href="bisacdf.html">bisacdf</a>, + <a href="burrcdf.html">burrcdf</a>, + <a href="cauchycdf.html">cauchycdf</a>, + <a href="chi2cdf.html">chi2cdf</a>, + <a href="evcdf.html">evcdf</a>, + <a href="expcdf.html">expcdf</a>, + <a href="fcdf.html">fcdf</a>, + <a href="gamcdf.html">gamcdf</a>, + <a href="geocdf.html">geocdf</a>, + <a href="gevcdf.html">gevcdf</a>, + <a href="gpcdf.html">gpcdf</a>, + <a href="gumbelcdf.html">gumbelcdf</a>, + <a href="hncdf.html">hncdf</a>, + <a href="hygecdf.html">hygecdf</a>, + <a href="invgcdf.html">invgcdf</a>, + <a href="laplacecdf.html">laplacecdf</a>, + <a href="logicdf.html">logicdf</a>, + <a href="loglcdf.html">loglcdf</a>, + <a href="logncdf.html">logncdf</a>, + <a href="nakacdf.html">nakacdf</a>, + <a href="nbincdf.html">nbincdf</a>, + <a href="ncfcdf.html">ncfcdf</a>, + <a href="nctcdf.html">nctcdf</a>, + <a href="ncx2cdf.html">ncx2cdf</a>, + <a href="normcdf.html">normcdf</a>, + <a href="poisscdf.html">poisscdf</a>, + <a href="raylcdf.html">raylcdf</a>, + <a href="ricecdf.html">ricecdf</a>, + <a href="tcdf.html">tcdf</a>, + <a href="tlscdf.html">tlscdf</a>, + <a href="tricdf.html">tricdf</a>, + <a href="unidcdf.html">unidcdf</a>, + <a href="unifcdf.html">unifcdf</a>, + <a href="vmcdf.html">vmcdf</a>, + <a href="wblcdf.html">wblcdf</a> </p> <p><strong>Source Code: </strong> <a href="https://github.com/gnu-octave/statistics/tree/main/inst/dist_obj/MultinomialDistribution.m">MultinomialDistribution</a> @@ -130,38 +201,6 @@ <div class="row d-flex flex-wrap align-items-center"> <div class="col-sm-3 col-md-5 mb-2 mb-sm-0"> <h3 class="d-inline-block mr-2"> - Method: <b><code>cdf</code></b> - </h3> - </div> - </div> - </div> - <div class="card-body"> -<dl> -<dt><u>MultinomialDistribution:</u> <var>p</var> = <b>icdf</b><i> (<var>pd</var>, <var>p</var>)</i></dt> -</dl> - -<p> Compute the cumulative distribution function (CDF). -</p> -<div class="ms-5"> -<p> <code><var>p</var> = icdf (<var>pd</var>, <var>x</var>)</code> computes the quantile (the - inverse of the CDF) of the probability distribution object, <var>pd</var>, - evaluated at the values in <var>x</var>. -</p> - -</div> - - </div> - </div> - </div> - - - - <div class="container-xl my-4"> - <div class="card rounded"> - <div class="card-header card-header-mod"> - <div class="row d-flex flex-wrap align-items-center"> - <div class="col-sm-3 col-md-5 mb-2 mb-sm-0"> - <h3 class="d-inline-block mr-2"> Method: <b><code>icdf</code></b> </h3> </div> diff --git a/docs/NakagamiDistribution.html b/docs/NakagamiDistribution.html index 643230b..49d231f 100644 --- a/docs/NakagamiDistribution.html +++ b/docs/NakagamiDistribution.html @@ -71,66 +71,126 @@ </div> <div class="card-body"> <dl> -<dt><u>statistics:</u> NakagamiDistribution</dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>, <var>C</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (…, <code>"upper"</code>)</i></dt> </dl> -<p> Normal probability distribution object. +<p> Return the CDF of a univariate distribution evaluated at <var>x</var>. </p> <div class="ms-5"> -<p> A <code>NakagamiDistribution</code> object consists of parameters, a model - description, and sample data for a normal probability distribution. +<p> <code>cdf</code> is a wrapper for the univariate cumulative distribution functions + available in the statistics package. See the corresponding functions’ help + to learn the signification of the parameters after <var>x</var>. </p> -<p> The normal distribution uses the following parameters. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>)</code> returns the CDF for the + one-parameter distribution family specified by <var>name</var> and the + distribution parameter <var>A</var>, evaluated at the values in <var>x</var>. </p> - <table> -<thead><tr><th width="25%"><var>Parameter</var></th><th width="48%"><var>Description</var></th><th width="27%"><var>Support</var></th></tr></thead> -<tr><td width="25%"><code>mu</code></td><td width="48%">Number of successes</td><td width="27%"><math>mu > 0</math></td></tr> -<tr><td width="25%"><code>omega</code></td><td width="48%">Probability of success</td><td width="27%"><math>omega > 0</math></td></tr> -</table> - -<p> There are several ways to create a <code>NakagamiDistribution</code> object. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>)</code> returns the CDF + for the two-parameter distribution family specified by <var>name</var> and the + distribution parameters <var>A</var> and <var>B</var>, evaluated at the values in + <var>x</var>. </p> - <ul> -<li> Fit a distribution to data using the <code>fitdist</code> function. - </li><li> Create a distribution with specified parameter values using the - <code>makedist</code> function. - </li><li> Use the constructor <code>NakagamiDistribution (<var>mu</var>, <var>omega</var>)</code> - to create a normal distribution with specified parameter values. - </li><li> Use the static method <code>NakagamiDistribution.fit (<var>x</var>, - <var>censor</var>, <var>freq</var>, <var>options</var>)</code> to a distribution to data <var>x</var>. - </li></ul> - -<p> It is highly recommended to use <code>fitdist</code> and <code>makedist</code> - functions to create probability distribution objects, instead of the - constructor and the aforementioned static method. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>, <var>C</var>)</code> returns + the CDF for the three-parameter distribution family specified by <var>name</var> + and the distribution parameters <var>A</var>, <var>B</var>, and <var>C</var>, evaluated at + the values in <var>x</var>. +</p> +<p> <code><var>p</var> = cdf (…, <code>"upper"</code>)</code> returns the complement of the + CDF using an algorithm that more accurately computes the extreme upper-tail + probabilities. <code>"upper"</code> can follow any of the input arguments in the + previous syntaxes. </p> -<p> A <code>NakagamiDistribution</code> object contains the following properties, - which can be accessed using dot notation. +<p> <var>name</var> must be a char string of the name or the abbreviation of the + desired cumulative distribution function as listed in the followng table. + The last column shows the number of required parameters that should be parsed + after <var>x</var> to the desired CDF. The optional input argument + <code>"upper"</code> does not count in the required number of parameters. </p> <table> -<tr><td width="25%"><code>DistributionName</code></td><td width="25%"><code>DistributionCode</code></td><td width="25%"><code>NumParameters</code></td><td width="25%"><code>ParameterNames</code></td></tr> -<tr><td width="25%"><code>ParameterDescription</code></td><td width="25%"><code>ParameterValues</code></td><td width="25%"><code>ParameterValues</code></td><td width="25%"><code>ParameterCI</code></td></tr> -<tr><td width="25%"><code>ParameterIsFixed</code></td><td width="25%"><code>Truncation</code></td><td width="25%"><code>IsTruncated</code></td><td width="25%"><code>InputData</code></td></tr> +<thead><tr><th width="40%">Distribution Name</th><th width="5%"></th><th width="20%">Abbreviation</th><th width="5%"></th><th width="30%">Input Parameters</th></tr></thead> +<tr><td width="40%"><code>"Beta"</code></td><td width="5%"></td><td width="20%"><code>"beta"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Binomial"</code></td><td width="5%"></td><td width="20%"><code>"bino"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Birnbaum-Saunders"</code></td><td width="5%"></td><td width="20%"><code>"bisa"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Burr"</code></td><td width="5%"></td><td width="20%"><code>"burr"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Cauchy"</code></td><td width="5%"></td><td width="20%"><code>"cauchy"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Chi-squared"</code></td><td width="5%"></td><td width="20%"><code>"chi2"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Extreme Value"</code></td><td width="5%"></td><td width="20%"><code>"ev"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Exponential"</code></td><td width="5%"></td><td width="20%"><code>"exp"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"F-Distribution"</code></td><td width="5%"></td><td width="20%"><code>"f"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Gamma"</code></td><td width="5%"></td><td width="20%"><code>"gam"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Geometric"</code></td><td width="5%"></td><td width="20%"><code>"geo"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Generalized Extreme Value"</code></td><td width="5%"></td><td width="20%"><code>"gev"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Generalized Pareto"</code></td><td width="5%"></td><td width="20%"><code>"gp"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Gumbel"</code></td><td width="5%"></td><td width="20%"><code>"gumbel"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Half-normal"</code></td><td width="5%"></td><td width="20%"><code>"hn"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Hypergeometric"</code></td><td width="5%"></td><td width="20%"><code>"hyge"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Inverse Gaussian"</code></td><td width="5%"></td><td width="20%"><code>"invg"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Laplace"</code></td><td width="5%"></td><td width="20%"><code>"laplace"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Logistic"</code></td><td width="5%"></td><td width="20%"><code>"logi"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Log-Logistic"</code></td><td width="5%"></td><td width="20%"><code>"logl"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Lognormal"</code></td><td width="5%"></td><td width="20%"><code>"logn"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Nakagami"</code></td><td width="5%"></td><td width="20%"><code>"naka"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Negative Binomial"</code></td><td width="5%"></td><td width="20%"><code>"nbin"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Noncentral F-Distribution"</code></td><td width="5%"></td><td width="20%"><code>"ncf"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Noncentral Student T"</code></td><td width="5%"></td><td width="20%"><code>"nct"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Noncentral Chi-Squared"</code></td><td width="5%"></td><td width="20%"><code>"ncx2"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Normal"</code></td><td width="5%"></td><td width="20%"><code>"norm"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Poisson"</code></td><td width="5%"></td><td width="20%"><code>"poiss"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Rayleigh"</code></td><td width="5%"></td><td width="20%"><code>"rayl"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Rician"</code></td><td width="5%"></td><td width="20%"><code>"rice"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Student T"</code></td><td width="5%"></td><td width="20%"><code>"t"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"location-scale T"</code></td><td width="5%"></td><td width="20%"><code>"tls"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Triangular"</code></td><td width="5%"></td><td width="20%"><code>"tri"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Discrete Uniform"</code></td><td width="5%"></td><td width="20%"><code>"unid"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Uniform"</code></td><td width="5%"></td><td width="20%"><code>"unif"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Von Mises"</code></td><td width="5%"></td><td width="20%"><code>"vm"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Weibull"</code></td><td width="5%"></td><td width="20%"><code>"wbl"</code></td><td width="5%"></td><td width="30%">2</td></tr> </table> -<p> A <code>NakagamiDistribution</code> object contains the following methods: - <code>cdf</code>, <code>icdf</code>, <code>iqr</code>, <code>mean</code>, <code>median</code>, - <code>negloglik</code>, <code>paramci</code>, <code>pdf</code>, <code>plot</code>, <code>proflik</code>, - <code>random</code>, <code>std</code>, <code>truncate</code>, <code>var</code>. -</p> -<p> Further information about the Nakagami distribution can be found at - <a href="https://en.wikipedia.org/wiki/Nakagami_distribution">https://en.wikipedia.org/wiki/Nakagami_distribution</a> -</p> <p> <strong>See also: </strong> - <a href="fitdist.html">fitdist</a>, - <a href="makedist.html">makedist</a>, + <a href="icdf.html">icdf</a>, + <a href="pdf.html">pdf</a>, + <a href="cdf.html">cdf</a>, + <a href="betacdf.html">betacdf</a>, + <a href="binocdf.html">binocdf</a>, + <a href="bisacdf.html">bisacdf</a>, + <a href="burrcdf.html">burrcdf</a>, + <a href="cauchycdf.html">cauchycdf</a>, + <a href="chi2cdf.html">chi2cdf</a>, + <a href="evcdf.html">evcdf</a>, + <a href="expcdf.html">expcdf</a>, + <a href="fcdf.html">fcdf</a>, + <a href="gamcdf.html">gamcdf</a>, + <a href="geocdf.html">geocdf</a>, + <a href="gevcdf.html">gevcdf</a>, + <a href="gpcdf.html">gpcdf</a>, + <a href="gumbelcdf.html">gumbelcdf</a>, + <a href="hncdf.html">hncdf</a>, + <a href="hygecdf.html">hygecdf</a>, + <a href="invgcdf.html">invgcdf</a>, + <a href="laplacecdf.html">laplacecdf</a>, + <a href="logicdf.html">logicdf</a>, + <a href="loglcdf.html">loglcdf</a>, + <a href="logncdf.html">logncdf</a>, <a href="nakacdf.html">nakacdf</a>, - <a href="nakainv.html">nakainv</a>, - <a href="nakapdf.html">nakapdf</a>, - <a href="nakarnd.html">nakarnd</a>, - <a href="nakafit.html">nakafit</a>, - <a href="nakalike.html">nakalike</a>, - <a href="nakastat.html">nakastat</a> + <a href="nbincdf.html">nbincdf</a>, + <a href="ncfcdf.html">ncfcdf</a>, + <a href="nctcdf.html">nctcdf</a>, + <a href="ncx2cdf.html">ncx2cdf</a>, + <a href="normcdf.html">normcdf</a>, + <a href="poisscdf.html">poisscdf</a>, + <a href="raylcdf.html">raylcdf</a>, + <a href="ricecdf.html">ricecdf</a>, + <a href="tcdf.html">tcdf</a>, + <a href="tlscdf.html">tlscdf</a>, + <a href="tricdf.html">tricdf</a>, + <a href="unidcdf.html">unidcdf</a>, + <a href="unifcdf.html">unifcdf</a>, + <a href="vmcdf.html">vmcdf</a>, + <a href="wblcdf.html">wblcdf</a> </p> <p><strong>Source Code: </strong> <a href="https://github.com/gnu-octave/statistics/tree/main/inst/dist_obj/NakagamiDistribution.m">NakagamiDistribution</a> @@ -141,39 +201,6 @@ <div class="row d-flex flex-wrap align-items-center"> <div class="col-sm-3 col-md-5 mb-2 mb-sm-0"> <h3 class="d-inline-block mr-2"> - Method: <b><code>cdf</code></b> - </h3> - </div> - </div> - </div> - <div class="card-body"> -<dl> -<dt><u>NakagamiDistribution:</u> <var>p</var> = <b>icdf</b><i> (<var>pd</var>, <var>p</var>)</i></dt> -</dl> - -<p> Compute the cumulative distribution function (CDF). -</p> -<div class="ms-5"> -<p> <code><var>p</var> = icdf (<var>pd</var>, <var>x</var>)</code> computes the quantile (the - inverse of the CDF) of the probability distribution object, <var>pd</var>, - evaluated at the values in <var>x</var>. -</p> - -</div> - - </div> - </div> - </div> - - - - - <div class="container-xl my-4"> - <div class="card rounded"> - <div class="card-header card-header-mod"> - <div class="row d-flex flex-wrap align-items-center"> - <div class="col-sm-3 col-md-5 mb-2 mb-sm-0"> - <h3 class="d-inline-block mr-2"> Method: <b><code>icdf</code></b> </h3> </div> @@ -227,7 +254,6 @@ </div> </div> - <div class="container-xl my-4"> <div class="card rounded"> <div class="card-header card-header-mod"> diff --git a/docs/NegativeBinomialDistribution.html b/docs/NegativeBinomialDistribution.html index e52f8d6..650045c 100644 --- a/docs/NegativeBinomialDistribution.html +++ b/docs/NegativeBinomialDistribution.html @@ -71,70 +71,126 @@ </div> <div class="card-body"> <dl> -<dt><u>statistics:</u> NegativeBinomialDistribution</dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>, <var>C</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (…, <code>"upper"</code>)</i></dt> </dl> -<p> Negative binomial probability distribution object. +<p> Return the CDF of a univariate distribution evaluated at <var>x</var>. </p> <div class="ms-5"> -<p> A <code>NegativeBinomialDistribution</code> object consists of parameters, a - model description, and sample data for a negative binomial probability - distribution. +<p> <code>cdf</code> is a wrapper for the univariate cumulative distribution functions + available in the statistics package. See the corresponding functions’ help + to learn the signification of the parameters after <var>x</var>. </p> -<p> The negative binomial distribution uses the following parameters. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>)</code> returns the CDF for the + one-parameter distribution family specified by <var>name</var> and the + distribution parameter <var>A</var>, evaluated at the values in <var>x</var>. </p> - <table> -<thead><tr><th width="25%"><var>Parameter</var></th><th width="48%"><var>Description</var></th><th width="27%"><var>Support</var></th></tr></thead> -<tr><td width="25%"><code>R</code></td><td width="48%">Number of successes</td><td width="27%"><math>R > 0</math></td></tr> -<tr><td width="25%"><code>P</code></td><td width="48%">Probability of success</td><td width="27%"><math>0 < P <= 1</math></td></tr> -</table> - -<p> There are several ways to create a <code>NegativeBinomialDistribution</code> - object. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>)</code> returns the CDF + for the two-parameter distribution family specified by <var>name</var> and the + distribution parameters <var>A</var> and <var>B</var>, evaluated at the values in + <var>x</var>. </p> - <ul> -<li> Fit a distribution to data using the <code>fitdist</code> function. - </li><li> Create a distribution with specified parameter values using the - <code>makedist</code> function. - </li><li> Use the constructor <code>NegativeBinomialDistribution (<var>R</var>, - <var>P</var>)</code> to create a negative binomial distribution with specified - parameter values. - </li><li> Use the static method <code>NegativeBinomialDistribution.fit - (<var>x</var>, <var>censor</var>, <var>freq</var>, <var>options</var>)</code> to a distribution to - data <var>x</var>. - </li></ul> - -<p> It is highly recommended to use <code>fitdist</code> and <code>makedist</code> - functions to create probability distribution objects, instead of the - constructor and the aforementioned static method. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>, <var>C</var>)</code> returns + the CDF for the three-parameter distribution family specified by <var>name</var> + and the distribution parameters <var>A</var>, <var>B</var>, and <var>C</var>, evaluated at + the values in <var>x</var>. +</p> +<p> <code><var>p</var> = cdf (…, <code>"upper"</code>)</code> returns the complement of the + CDF using an algorithm that more accurately computes the extreme upper-tail + probabilities. <code>"upper"</code> can follow any of the input arguments in the + previous syntaxes. </p> -<p> A <code>NegativeBinomialDistribution</code> object contains the following - properties, which can be accessed using dot notation. +<p> <var>name</var> must be a char string of the name or the abbreviation of the + desired cumulative distribution function as listed in the followng table. + The last column shows the number of required parameters that should be parsed + after <var>x</var> to the desired CDF. The optional input argument + <code>"upper"</code> does not count in the required number of parameters. </p> <table> -<tr><td width="25%"><code>DistributionName</code></td><td width="25%"><code>DistributionCode</code></td><td width="25%"><code>NumParameters</code></td><td width="25%"><code>ParameterNames</code></td></tr> -<tr><td width="25%"><code>ParameterDescription</code></td><td width="25%"><code>ParameterValues</code></td><td width="25%"><code>ParameterValues</code></td><td width="25%"><code>ParameterCI</code></td></tr> -<tr><td width="25%"><code>ParameterIsFixed</code></td><td width="25%"><code>Truncation</code></td><td width="25%"><code>IsTruncated</code></td><td width="25%"><code>InputData</code></td></tr> +<thead><tr><th width="40%">Distribution Name</th><th width="5%"></th><th width="20%">Abbreviation</th><th width="5%"></th><th width="30%">Input Parameters</th></tr></thead> +<tr><td width="40%"><code>"Beta"</code></td><td width="5%"></td><td width="20%"><code>"beta"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Binomial"</code></td><td width="5%"></td><td width="20%"><code>"bino"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Birnbaum-Saunders"</code></td><td width="5%"></td><td width="20%"><code>"bisa"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Burr"</code></td><td width="5%"></td><td width="20%"><code>"burr"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Cauchy"</code></td><td width="5%"></td><td width="20%"><code>"cauchy"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Chi-squared"</code></td><td width="5%"></td><td width="20%"><code>"chi2"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Extreme Value"</code></td><td width="5%"></td><td width="20%"><code>"ev"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Exponential"</code></td><td width="5%"></td><td width="20%"><code>"exp"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"F-Distribution"</code></td><td width="5%"></td><td width="20%"><code>"f"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Gamma"</code></td><td width="5%"></td><td width="20%"><code>"gam"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Geometric"</code></td><td width="5%"></td><td width="20%"><code>"geo"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Generalized Extreme Value"</code></td><td width="5%"></td><td width="20%"><code>"gev"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Generalized Pareto"</code></td><td width="5%"></td><td width="20%"><code>"gp"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Gumbel"</code></td><td width="5%"></td><td width="20%"><code>"gumbel"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Half-normal"</code></td><td width="5%"></td><td width="20%"><code>"hn"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Hypergeometric"</code></td><td width="5%"></td><td width="20%"><code>"hyge"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Inverse Gaussian"</code></td><td width="5%"></td><td width="20%"><code>"invg"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Laplace"</code></td><td width="5%"></td><td width="20%"><code>"laplace"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Logistic"</code></td><td width="5%"></td><td width="20%"><code>"logi"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Log-Logistic"</code></td><td width="5%"></td><td width="20%"><code>"logl"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Lognormal"</code></td><td width="5%"></td><td width="20%"><code>"logn"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Nakagami"</code></td><td width="5%"></td><td width="20%"><code>"naka"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Negative Binomial"</code></td><td width="5%"></td><td width="20%"><code>"nbin"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Noncentral F-Distribution"</code></td><td width="5%"></td><td width="20%"><code>"ncf"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Noncentral Student T"</code></td><td width="5%"></td><td width="20%"><code>"nct"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Noncentral Chi-Squared"</code></td><td width="5%"></td><td width="20%"><code>"ncx2"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Normal"</code></td><td width="5%"></td><td width="20%"><code>"norm"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Poisson"</code></td><td width="5%"></td><td width="20%"><code>"poiss"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Rayleigh"</code></td><td width="5%"></td><td width="20%"><code>"rayl"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Rician"</code></td><td width="5%"></td><td width="20%"><code>"rice"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Student T"</code></td><td width="5%"></td><td width="20%"><code>"t"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"location-scale T"</code></td><td width="5%"></td><td width="20%"><code>"tls"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Triangular"</code></td><td width="5%"></td><td width="20%"><code>"tri"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Discrete Uniform"</code></td><td width="5%"></td><td width="20%"><code>"unid"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Uniform"</code></td><td width="5%"></td><td width="20%"><code>"unif"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Von Mises"</code></td><td width="5%"></td><td width="20%"><code>"vm"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Weibull"</code></td><td width="5%"></td><td width="20%"><code>"wbl"</code></td><td width="5%"></td><td width="30%">2</td></tr> </table> -<p> A <code>NegativeBinomialDistribution</code> object contains the following methods: - <code>cdf</code>, <code>icdf</code>, <code>iqr</code>, <code>mean</code>, <code>median</code>, - <code>negloglik</code>, <code>paramci</code>, <code>pdf</code>, <code>plot</code>, <code>proflik</code>, - <code>random</code>, <code>std</code>, <code>truncate</code>, <code>var</code>. -</p> -<p> Further information about the negative binomial distribution can be found - at <a href="https://en.wikipedia.org/wiki/Negative_binomial_distribution">https://en.wikipedia.org/wiki/Negative_binomial_distribution</a> -</p> <p> <strong>See also: </strong> - <a href="fitdist.html">fitdist</a>, - <a href="makedist.html">makedist</a>, + <a href="icdf.html">icdf</a>, + <a href="pdf.html">pdf</a>, + <a href="cdf.html">cdf</a>, + <a href="betacdf.html">betacdf</a>, + <a href="binocdf.html">binocdf</a>, + <a href="bisacdf.html">bisacdf</a>, + <a href="burrcdf.html">burrcdf</a>, + <a href="cauchycdf.html">cauchycdf</a>, + <a href="chi2cdf.html">chi2cdf</a>, + <a href="evcdf.html">evcdf</a>, + <a href="expcdf.html">expcdf</a>, + <a href="fcdf.html">fcdf</a>, + <a href="gamcdf.html">gamcdf</a>, + <a href="geocdf.html">geocdf</a>, + <a href="gevcdf.html">gevcdf</a>, + <a href="gpcdf.html">gpcdf</a>, + <a href="gumbelcdf.html">gumbelcdf</a>, + <a href="hncdf.html">hncdf</a>, + <a href="hygecdf.html">hygecdf</a>, + <a href="invgcdf.html">invgcdf</a>, + <a href="laplacecdf.html">laplacecdf</a>, + <a href="logicdf.html">logicdf</a>, + <a href="loglcdf.html">loglcdf</a>, + <a href="logncdf.html">logncdf</a>, + <a href="nakacdf.html">nakacdf</a>, <a href="nbincdf.html">nbincdf</a>, - <a href="nbininv.html">nbininv</a>, - <a href="nbinpdf.html">nbinpdf</a>, - <a href="nbinrnd.html">nbinrnd</a>, - <a href="nbinfit.html">nbinfit</a>, - <a href="nbinlike.html">nbinlike</a>, - <a href="nbinstat.html">nbinstat</a> + <a href="ncfcdf.html">ncfcdf</a>, + <a href="nctcdf.html">nctcdf</a>, + <a href="ncx2cdf.html">ncx2cdf</a>, + <a href="normcdf.html">normcdf</a>, + <a href="poisscdf.html">poisscdf</a>, + <a href="raylcdf.html">raylcdf</a>, + <a href="ricecdf.html">ricecdf</a>, + <a href="tcdf.html">tcdf</a>, + <a href="tlscdf.html">tlscdf</a>, + <a href="tricdf.html">tricdf</a>, + <a href="unidcdf.html">unidcdf</a>, + <a href="unifcdf.html">unifcdf</a>, + <a href="vmcdf.html">vmcdf</a>, + <a href="wblcdf.html">wblcdf</a> </p> <p><strong>Source Code: </strong> <a href="https://github.com/gnu-octave/statistics/tree/main/inst/dist_obj/NegativeBinomialDistribution.m">NegativeBinomialDistribution</a> @@ -145,39 +201,6 @@ <div class="row d-flex flex-wrap align-items-center"> <div class="col-sm-3 col-md-5 mb-2 mb-sm-0"> <h3 class="d-inline-block mr-2"> - Method: <b><code>cdf</code></b> - </h3> - </div> - </div> - </div> - <div class="card-body"> -<dl> -<dt><u>NegativeBinomialDistribution:</u> <var>p</var> = <b>icdf</b><i> (<var>pd</var>, <var>p</var>)</i></dt> -</dl> - -<p> Compute the cumulative distribution function (CDF). -</p> -<div class="ms-5"> -<p> <code><var>p</var> = icdf (<var>pd</var>, <var>x</var>)</code> computes the quantile (the - inverse of the CDF) of the probability distribution object, <var>pd</var>, - evaluated at the values in <var>x</var>. -</p> - -</div> - - </div> - </div> - </div> - - - - - <div class="container-xl my-4"> - <div class="card rounded"> - <div class="card-header card-header-mod"> - <div class="row d-flex flex-wrap align-items-center"> - <div class="col-sm-3 col-md-5 mb-2 mb-sm-0"> - <h3 class="d-inline-block mr-2"> Method: <b><code>icdf</code></b> </h3> </div> @@ -231,7 +254,6 @@ </div> </div> - <div class="container-xl my-4"> <div class="card rounded"> <div class="card-header card-header-mod"> diff --git a/docs/NormalDistribution.html b/docs/NormalDistribution.html index 98a51f4..b04831a 100644 --- a/docs/NormalDistribution.html +++ b/docs/NormalDistribution.html @@ -71,66 +71,126 @@ </div> <div class="card-body"> <dl> -<dt><u>statistics:</u> NormalDistribution</dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>, <var>C</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (…, <code>"upper"</code>)</i></dt> </dl> -<p> Normal probability distribution object. +<p> Return the CDF of a univariate distribution evaluated at <var>x</var>. </p> <div class="ms-5"> -<p> A <code>NormalDistribution</code> object consists of parameters, a model - description, and sample data for a normal probability distribution. +<p> <code>cdf</code> is a wrapper for the univariate cumulative distribution functions + available in the statistics package. See the corresponding functions’ help + to learn the signification of the parameters after <var>x</var>. </p> -<p> The normal distribution uses the following parameters. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>)</code> returns the CDF for the + one-parameter distribution family specified by <var>name</var> and the + distribution parameter <var>A</var>, evaluated at the values in <var>x</var>. </p> - <table> -<thead><tr><th width="25%"><var>Parameter</var></th><th width="48%"><var>Description</var></th><th width="27%"><var>Support</var></th></tr></thead> -<tr><td width="25%"><code>mu</code></td><td width="48%">Mean</td><td width="27%"><math>-Inf < mu < Inf</math></td></tr> -<tr><td width="25%"><code>sigma</code></td><td width="48%">Standard deviation</td><td width="27%"><math>sigma > 0</math></td></tr> -</table> - -<p> There are several ways to create a <code>NormalDistribution</code> object. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>)</code> returns the CDF + for the two-parameter distribution family specified by <var>name</var> and the + distribution parameters <var>A</var> and <var>B</var>, evaluated at the values in + <var>x</var>. </p> - <ul> -<li> Fit a distribution to data using the <code>fitdist</code> function. - </li><li> Create a distribution with specified parameter values using the - <code>makedist</code> function. - </li><li> Use the constructor <code>NormalDistribution (<var>mu</var>, <var>sigma</var>)</code> - to create a normal distribution with specified parameter values. - </li><li> Use the static method <code>NormalDistribution.fit (<var>x</var>, - <var>censor</var>, <var>freq</var>, <var>options</var>)</code> to a distribution to data <var>x</var>. - </li></ul> - -<p> It is highly recommended to use <code>fitdist</code> and <code>makedist</code> - functions to create probability distribution objects, instead of the - constructor and the aforementioned static method. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>, <var>C</var>)</code> returns + the CDF for the three-parameter distribution family specified by <var>name</var> + and the distribution parameters <var>A</var>, <var>B</var>, and <var>C</var>, evaluated at + the values in <var>x</var>. +</p> +<p> <code><var>p</var> = cdf (…, <code>"upper"</code>)</code> returns the complement of the + CDF using an algorithm that more accurately computes the extreme upper-tail + probabilities. <code>"upper"</code> can follow any of the input arguments in the + previous syntaxes. </p> -<p> A <code>NormalDistribution</code> object contains the following properties, - which can be accessed using dot notation. +<p> <var>name</var> must be a char string of the name or the abbreviation of the + desired cumulative distribution function as listed in the followng table. + The last column shows the number of required parameters that should be parsed + after <var>x</var> to the desired CDF. The optional input argument + <code>"upper"</code> does not count in the required number of parameters. </p> <table> -<tr><td width="25%"><code>DistributionName</code></td><td width="25%"><code>DistributionCode</code></td><td width="25%"><code>NumParameters</code></td><td width="25%"><code>ParameterNames</code></td></tr> -<tr><td width="25%"><code>ParameterDescription</code></td><td width="25%"><code>ParameterValues</code></td><td width="25%"><code>ParameterValues</code></td><td width="25%"><code>ParameterCI</code></td></tr> -<tr><td width="25%"><code>ParameterIsFixed</code></td><td width="25%"><code>Truncation</code></td><td width="25%"><code>IsTruncated</code></td><td width="25%"><code>InputData</code></td></tr> +<thead><tr><th width="40%">Distribution Name</th><th width="5%"></th><th width="20%">Abbreviation</th><th width="5%"></th><th width="30%">Input Parameters</th></tr></thead> +<tr><td width="40%"><code>"Beta"</code></td><td width="5%"></td><td width="20%"><code>"beta"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Binomial"</code></td><td width="5%"></td><td width="20%"><code>"bino"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Birnbaum-Saunders"</code></td><td width="5%"></td><td width="20%"><code>"bisa"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Burr"</code></td><td width="5%"></td><td width="20%"><code>"burr"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Cauchy"</code></td><td width="5%"></td><td width="20%"><code>"cauchy"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Chi-squared"</code></td><td width="5%"></td><td width="20%"><code>"chi2"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Extreme Value"</code></td><td width="5%"></td><td width="20%"><code>"ev"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Exponential"</code></td><td width="5%"></td><td width="20%"><code>"exp"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"F-Distribution"</code></td><td width="5%"></td><td width="20%"><code>"f"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Gamma"</code></td><td width="5%"></td><td width="20%"><code>"gam"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Geometric"</code></td><td width="5%"></td><td width="20%"><code>"geo"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Generalized Extreme Value"</code></td><td width="5%"></td><td width="20%"><code>"gev"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Generalized Pareto"</code></td><td width="5%"></td><td width="20%"><code>"gp"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Gumbel"</code></td><td width="5%"></td><td width="20%"><code>"gumbel"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Half-normal"</code></td><td width="5%"></td><td width="20%"><code>"hn"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Hypergeometric"</code></td><td width="5%"></td><td width="20%"><code>"hyge"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Inverse Gaussian"</code></td><td width="5%"></td><td width="20%"><code>"invg"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Laplace"</code></td><td width="5%"></td><td width="20%"><code>"laplace"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Logistic"</code></td><td width="5%"></td><td width="20%"><code>"logi"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Log-Logistic"</code></td><td width="5%"></td><td width="20%"><code>"logl"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Lognormal"</code></td><td width="5%"></td><td width="20%"><code>"logn"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Nakagami"</code></td><td width="5%"></td><td width="20%"><code>"naka"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Negative Binomial"</code></td><td width="5%"></td><td width="20%"><code>"nbin"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Noncentral F-Distribution"</code></td><td width="5%"></td><td width="20%"><code>"ncf"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Noncentral Student T"</code></td><td width="5%"></td><td width="20%"><code>"nct"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Noncentral Chi-Squared"</code></td><td width="5%"></td><td width="20%"><code>"ncx2"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Normal"</code></td><td width="5%"></td><td width="20%"><code>"norm"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Poisson"</code></td><td width="5%"></td><td width="20%"><code>"poiss"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Rayleigh"</code></td><td width="5%"></td><td width="20%"><code>"rayl"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Rician"</code></td><td width="5%"></td><td width="20%"><code>"rice"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Student T"</code></td><td width="5%"></td><td width="20%"><code>"t"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"location-scale T"</code></td><td width="5%"></td><td width="20%"><code>"tls"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Triangular"</code></td><td width="5%"></td><td width="20%"><code>"tri"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Discrete Uniform"</code></td><td width="5%"></td><td width="20%"><code>"unid"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Uniform"</code></td><td width="5%"></td><td width="20%"><code>"unif"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Von Mises"</code></td><td width="5%"></td><td width="20%"><code>"vm"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Weibull"</code></td><td width="5%"></td><td width="20%"><code>"wbl"</code></td><td width="5%"></td><td width="30%">2</td></tr> </table> -<p> A <code>NormalDistribution</code> object contains the following methods: - <code>cdf</code>, <code>icdf</code>, <code>iqr</code>, <code>mean</code>, <code>median</code>, - <code>negloglik</code>, <code>paramci</code>, <code>pdf</code>, <code>plot</code>, <code>proflik</code>, - <code>random</code>, <code>std</code>, <code>truncate</code>, <code>var</code>. -</p> -<p> Further information about the normal distribution can be found at - <a href="https://en.wikipedia.org/wiki/Normal_distribution">https://en.wikipedia.org/wiki/Normal_distribution</a> -</p> <p> <strong>See also: </strong> - <a href="fitdist.html">fitdist</a>, - <a href="makedist.html">makedist</a>, + <a href="icdf.html">icdf</a>, + <a href="pdf.html">pdf</a>, + <a href="cdf.html">cdf</a>, + <a href="betacdf.html">betacdf</a>, + <a href="binocdf.html">binocdf</a>, + <a href="bisacdf.html">bisacdf</a>, + <a href="burrcdf.html">burrcdf</a>, + <a href="cauchycdf.html">cauchycdf</a>, + <a href="chi2cdf.html">chi2cdf</a>, + <a href="evcdf.html">evcdf</a>, + <a href="expcdf.html">expcdf</a>, + <a href="fcdf.html">fcdf</a>, + <a href="gamcdf.html">gamcdf</a>, + <a href="geocdf.html">geocdf</a>, + <a href="gevcdf.html">gevcdf</a>, + <a href="gpcdf.html">gpcdf</a>, + <a href="gumbelcdf.html">gumbelcdf</a>, + <a href="hncdf.html">hncdf</a>, + <a href="hygecdf.html">hygecdf</a>, + <a href="invgcdf.html">invgcdf</a>, + <a href="laplacecdf.html">laplacecdf</a>, + <a href="logicdf.html">logicdf</a>, + <a href="loglcdf.html">loglcdf</a>, + <a href="logncdf.html">logncdf</a>, + <a href="nakacdf.html">nakacdf</a>, + <a href="nbincdf.html">nbincdf</a>, + <a href="ncfcdf.html">ncfcdf</a>, + <a href="nctcdf.html">nctcdf</a>, + <a href="ncx2cdf.html">ncx2cdf</a>, <a href="normcdf.html">normcdf</a>, - <a href="norminv.html">norminv</a>, - <a href="normpdf.html">normpdf</a>, - <a href="normrnd.html">normrnd</a>, - <a href="normfit.html">normfit</a>, - <a href="normlike.html">normlike</a>, - <a href="normstat.html">normstat</a> + <a href="poisscdf.html">poisscdf</a>, + <a href="raylcdf.html">raylcdf</a>, + <a href="ricecdf.html">ricecdf</a>, + <a href="tcdf.html">tcdf</a>, + <a href="tlscdf.html">tlscdf</a>, + <a href="tricdf.html">tricdf</a>, + <a href="unidcdf.html">unidcdf</a>, + <a href="unifcdf.html">unifcdf</a>, + <a href="vmcdf.html">vmcdf</a>, + <a href="wblcdf.html">wblcdf</a> </p> <p><strong>Source Code: </strong> <a href="https://github.com/gnu-octave/statistics/tree/main/inst/dist_obj/NormalDistribution.m">NormalDistribution</a> @@ -141,39 +201,6 @@ <div class="row d-flex flex-wrap align-items-center"> <div class="col-sm-3 col-md-5 mb-2 mb-sm-0"> <h3 class="d-inline-block mr-2"> - Method: <b><code>cdf</code></b> - </h3> - </div> - </div> - </div> - <div class="card-body"> -<dl> -<dt><u>NormalDistribution:</u> <var>p</var> = <b>icdf</b><i> (<var>pd</var>, <var>p</var>)</i></dt> -</dl> - -<p> Compute the cumulative distribution function (CDF). -</p> -<div class="ms-5"> -<p> <code><var>p</var> = icdf (<var>pd</var>, <var>x</var>)</code> computes the quantile (the - inverse of the CDF) of the probability distribution object, <var>pd</var>, - evaluated at the values in <var>x</var>. -</p> - -</div> - - </div> - </div> - </div> - - - - - <div class="container-xl my-4"> - <div class="card rounded"> - <div class="card-header card-header-mod"> - <div class="row d-flex flex-wrap align-items-center"> - <div class="col-sm-3 col-md-5 mb-2 mb-sm-0"> - <h3 class="d-inline-block mr-2"> Method: <b><code>icdf</code></b> </h3> </div> @@ -227,7 +254,6 @@ </div> </div> - <div class="container-xl my-4"> <div class="card rounded"> <div class="card-header card-header-mod"> diff --git a/docs/PiecewiseLinearDistribution.html b/docs/PiecewiseLinearDistribution.html index 7a01fa9..0e2c7d5 100644 --- a/docs/PiecewiseLinearDistribution.html +++ b/docs/PiecewiseLinearDistribution.html @@ -71,61 +71,126 @@ </div> <div class="card-body"> <dl> -<dt><u>statistics:</u> PiecewiseLinearDistribution</dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>, <var>C</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (…, <code>"upper"</code>)</i></dt> </dl> -<p> Continuous uniform probability distribution object. +<p> Return the CDF of a univariate distribution evaluated at <var>x</var>. </p> <div class="ms-5"> -<p> A <code>PiecewiseLinearDistribution</code> object consists of parameters, a model - description, and sample data for a uniform probability distribution. +<p> <code>cdf</code> is a wrapper for the univariate cumulative distribution functions + available in the statistics package. See the corresponding functions’ help + to learn the signification of the parameters after <var>x</var>. </p> -<p> The uniform distribution uses the following parameters. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>)</code> returns the CDF for the + one-parameter distribution family specified by <var>name</var> and the + distribution parameter <var>A</var>, evaluated at the values in <var>x</var>. </p> - <table> -<thead><tr><th width="25%"><var>Parameter</var></th><th width="48%"><var>Description</var></th><th width="27%"><var>Support</var></th></tr></thead> -<tr><td width="25%"><code>x</code></td><td width="48%">Vector of <math>×</math> values at which the cdf changes - slope</td><td width="27%"><math>-Inf <× < F×</math></td></tr> -<tr><td width="25%"><code>Fx</code></td><td width="48%">Vector of CDF values that correspond to each value in - <math>×</math></td><td width="27%"><math>0 <= F× <= 1</math></td></tr> -</table> - -<p> There are several ways to create a <code>PiecewiseLinearDistribution</code> object. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>)</code> returns the CDF + for the two-parameter distribution family specified by <var>name</var> and the + distribution parameters <var>A</var> and <var>B</var>, evaluated at the values in + <var>x</var>. +</p> +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>, <var>C</var>)</code> returns + the CDF for the three-parameter distribution family specified by <var>name</var> + and the distribution parameters <var>A</var>, <var>B</var>, and <var>C</var>, evaluated at + the values in <var>x</var>. </p> - <ul> -<li> Create a distribution with specified parameter values using the - <code>makedist</code> function. - </li><li> Use the constructor <code>PiecewiseLinearDistribution (<var>x</var>, - <var>Fx</var>)</code> to create a uniform distribution with specified parameter - values. - </li></ul> - -<p> It is highly recommended to use <code>makedist</code> function to create - probability distribution objects, instead of the constructor. +<p> <code><var>p</var> = cdf (…, <code>"upper"</code>)</code> returns the complement of the + CDF using an algorithm that more accurately computes the extreme upper-tail + probabilities. <code>"upper"</code> can follow any of the input arguments in the + previous syntaxes. </p> -<p> A <code>PiecewiseLinearDistribution</code> object contains the following - properties, which can be accessed using dot notation. +<p> <var>name</var> must be a char string of the name or the abbreviation of the + desired cumulative distribution function as listed in the followng table. + The last column shows the number of required parameters that should be parsed + after <var>x</var> to the desired CDF. The optional input argument + <code>"upper"</code> does not count in the required number of parameters. </p> <table> -<tr><td width="25%"><code>DistributionName</code></td><td width="25%"><code>DistributionCode</code></td><td width="25%"><code>NumParameters</code></td><td width="25%"><code>ParameterNames</code></td></tr> -<tr><td width="25%"><code>ParameterDescription</code></td><td width="25%"><code>ParameterValues</code></td><td width="25%"><code>Truncation</code></td><td width="25%"><code>IsTruncated</code></td></tr> +<thead><tr><th width="40%">Distribution Name</th><th width="5%"></th><th width="20%">Abbreviation</th><th width="5%"></th><th width="30%">Input Parameters</th></tr></thead> +<tr><td width="40%"><code>"Beta"</code></td><td width="5%"></td><td width="20%"><code>"beta"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Binomial"</code></td><td width="5%"></td><td width="20%"><code>"bino"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Birnbaum-Saunders"</code></td><td width="5%"></td><td width="20%"><code>"bisa"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Burr"</code></td><td width="5%"></td><td width="20%"><code>"burr"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Cauchy"</code></td><td width="5%"></td><td width="20%"><code>"cauchy"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Chi-squared"</code></td><td width="5%"></td><td width="20%"><code>"chi2"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Extreme Value"</code></td><td width="5%"></td><td width="20%"><code>"ev"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Exponential"</code></td><td width="5%"></td><td width="20%"><code>"exp"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"F-Distribution"</code></td><td width="5%"></td><td width="20%"><code>"f"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Gamma"</code></td><td width="5%"></td><td width="20%"><code>"gam"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Geometric"</code></td><td width="5%"></td><td width="20%"><code>"geo"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Generalized Extreme Value"</code></td><td width="5%"></td><td width="20%"><code>"gev"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Generalized Pareto"</code></td><td width="5%"></td><td width="20%"><code>"gp"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Gumbel"</code></td><td width="5%"></td><td width="20%"><code>"gumbel"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Half-normal"</code></td><td width="5%"></td><td width="20%"><code>"hn"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Hypergeometric"</code></td><td width="5%"></td><td width="20%"><code>"hyge"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Inverse Gaussian"</code></td><td width="5%"></td><td width="20%"><code>"invg"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Laplace"</code></td><td width="5%"></td><td width="20%"><code>"laplace"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Logistic"</code></td><td width="5%"></td><td width="20%"><code>"logi"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Log-Logistic"</code></td><td width="5%"></td><td width="20%"><code>"logl"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Lognormal"</code></td><td width="5%"></td><td width="20%"><code>"logn"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Nakagami"</code></td><td width="5%"></td><td width="20%"><code>"naka"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Negative Binomial"</code></td><td width="5%"></td><td width="20%"><code>"nbin"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Noncentral F-Distribution"</code></td><td width="5%"></td><td width="20%"><code>"ncf"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Noncentral Student T"</code></td><td width="5%"></td><td width="20%"><code>"nct"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Noncentral Chi-Squared"</code></td><td width="5%"></td><td width="20%"><code>"ncx2"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Normal"</code></td><td width="5%"></td><td width="20%"><code>"norm"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Poisson"</code></td><td width="5%"></td><td width="20%"><code>"poiss"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Rayleigh"</code></td><td width="5%"></td><td width="20%"><code>"rayl"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Rician"</code></td><td width="5%"></td><td width="20%"><code>"rice"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Student T"</code></td><td width="5%"></td><td width="20%"><code>"t"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"location-scale T"</code></td><td width="5%"></td><td width="20%"><code>"tls"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Triangular"</code></td><td width="5%"></td><td width="20%"><code>"tri"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Discrete Uniform"</code></td><td width="5%"></td><td width="20%"><code>"unid"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Uniform"</code></td><td width="5%"></td><td width="20%"><code>"unif"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Von Mises"</code></td><td width="5%"></td><td width="20%"><code>"vm"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Weibull"</code></td><td width="5%"></td><td width="20%"><code>"wbl"</code></td><td width="5%"></td><td width="30%">2</td></tr> </table> -<p> A <code>PiecewiseLinearDistribution</code> object contains the following methods: - <code>cdf</code>, <code>icdf</code>, <code>iqr</code>, <code>mean</code>, <code>median</code>, - <code>pdf</code>, <code>plot</code>, <code>random</code>, <code>std</code>, <code>truncate</code>, - <code>var</code>. -</p> -<p> Further information about the piecewise linear distribution can be found at - <a href="https://en.wikipedia.org/wiki/Piecewise_linear_function">https://en.wikipedia.org/wiki/Piecewise_linear_function</a> -</p> <p> <strong>See also: </strong> - <a href="makedist.html">makedist</a>, - <a href="plcdf.html">plcdf</a>, - <a href="plinv.html">plinv</a>, - <a href="plpdf.html">plpdf</a>, - <a href="plrnd.html">plrnd</a>, - <a href="plstat.html">plstat</a> + <a href="icdf.html">icdf</a>, + <a href="pdf.html">pdf</a>, + <a href="cdf.html">cdf</a>, + <a href="betacdf.html">betacdf</a>, + <a href="binocdf.html">binocdf</a>, + <a href="bisacdf.html">bisacdf</a>, + <a href="burrcdf.html">burrcdf</a>, + <a href="cauchycdf.html">cauchycdf</a>, + <a href="chi2cdf.html">chi2cdf</a>, + <a href="evcdf.html">evcdf</a>, + <a href="expcdf.html">expcdf</a>, + <a href="fcdf.html">fcdf</a>, + <a href="gamcdf.html">gamcdf</a>, + <a href="geocdf.html">geocdf</a>, + <a href="gevcdf.html">gevcdf</a>, + <a href="gpcdf.html">gpcdf</a>, + <a href="gumbelcdf.html">gumbelcdf</a>, + <a href="hncdf.html">hncdf</a>, + <a href="hygecdf.html">hygecdf</a>, + <a href="invgcdf.html">invgcdf</a>, + <a href="laplacecdf.html">laplacecdf</a>, + <a href="logicdf.html">logicdf</a>, + <a href="loglcdf.html">loglcdf</a>, + <a href="logncdf.html">logncdf</a>, + <a href="nakacdf.html">nakacdf</a>, + <a href="nbincdf.html">nbincdf</a>, + <a href="ncfcdf.html">ncfcdf</a>, + <a href="nctcdf.html">nctcdf</a>, + <a href="ncx2cdf.html">ncx2cdf</a>, + <a href="normcdf.html">normcdf</a>, + <a href="poisscdf.html">poisscdf</a>, + <a href="raylcdf.html">raylcdf</a>, + <a href="ricecdf.html">ricecdf</a>, + <a href="tcdf.html">tcdf</a>, + <a href="tlscdf.html">tlscdf</a>, + <a href="tricdf.html">tricdf</a>, + <a href="unidcdf.html">unidcdf</a>, + <a href="unifcdf.html">unifcdf</a>, + <a href="vmcdf.html">vmcdf</a>, + <a href="wblcdf.html">wblcdf</a> </p> <p><strong>Source Code: </strong> <a href="https://github.com/gnu-octave/statistics/tree/main/inst/dist_obj/PiecewiseLinearDistribution.m">PiecewiseLinearDistribution</a> @@ -136,38 +201,6 @@ <div class="row d-flex flex-wrap align-items-center"> <div class="col-sm-3 col-md-5 mb-2 mb-sm-0"> <h3 class="d-inline-block mr-2"> - Method: <b><code>cdf</code></b> - </h3> - </div> - </div> - </div> - <div class="card-body"> -<dl> -<dt><u>PiecewiseLinearDistribution:</u> <var>p</var> = <b>icdf</b><i> (<var>pd</var>, <var>p</var>)</i></dt> -</dl> - -<p> Compute the cumulative distribution function (CDF). -</p> -<div class="ms-5"> -<p> <code><var>p</var> = icdf (<var>pd</var>, <var>x</var>)</code> computes the quantile (the - inverse of the CDF) of the probability distribution object, <var>pd</var>, - evaluated at the values in <var>x</var>. -</p> - -</div> - - </div> - </div> - </div> - - - - <div class="container-xl my-4"> - <div class="card rounded"> - <div class="card-header card-header-mod"> - <div class="row d-flex flex-wrap align-items-center"> - <div class="col-sm-3 col-md-5 mb-2 mb-sm-0"> - <h3 class="d-inline-block mr-2"> Method: <b><code>icdf</code></b> </h3> </div> diff --git a/docs/PoissonDistribution.html b/docs/PoissonDistribution.html index bc3b937..65cb232 100644 --- a/docs/PoissonDistribution.html +++ b/docs/PoissonDistribution.html @@ -71,65 +71,126 @@ </div> <div class="card-body"> <dl> -<dt><u>statistics:</u> PoissonDistribution</dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>, <var>C</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (…, <code>"upper"</code>)</i></dt> </dl> -<p> Poisson probability distribution object. +<p> Return the CDF of a univariate distribution evaluated at <var>x</var>. </p> <div class="ms-5"> -<p> A <code>PoissonDistribution</code> object consists of parameters, a model - description, and sample data for a Poisson probability distribution. +<p> <code>cdf</code> is a wrapper for the univariate cumulative distribution functions + available in the statistics package. See the corresponding functions’ help + to learn the signification of the parameters after <var>x</var>. </p> -<p> The Poisson distribution uses the following parameters. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>)</code> returns the CDF for the + one-parameter distribution family specified by <var>name</var> and the + distribution parameter <var>A</var>, evaluated at the values in <var>x</var>. </p> - <table> -<thead><tr><th width="25%"><var>Parameter</var></th><th width="48%"><var>Description</var></th><th width="27%"><var>Support</var></th></tr></thead> -<tr><td width="25%"><code>lambda</code></td><td width="48%">Rate parameter</td><td width="27%"><math>lambda > 0</math></td></tr> -</table> - -<p> There are several ways to create a <code>PoissonDistribution</code> object. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>)</code> returns the CDF + for the two-parameter distribution family specified by <var>name</var> and the + distribution parameters <var>A</var> and <var>B</var>, evaluated at the values in + <var>x</var>. </p> - <ul> -<li> Fit a distribution to data using the <code>fitdist</code> function. - </li><li> Create a distribution with specified parameter values using the - <code>makedist</code> function. - </li><li> Use the constructor <code>PoissonDistribution (<var>lambda</var>)</code> - to create a Poisson distribution with specified parameter values. - </li><li> Use the static method <code>PoissonDistribution.fit (<var>x</var>, - <var>censor</var>, <var>freq</var>, <var>options</var>)</code> to a distribution to data <var>x</var>. - </li></ul> - -<p> It is highly recommended to use <code>fitdist</code> and <code>makedist</code> - functions to create probability distribution objects, instead of the - constructor and the aforementioned static method. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>, <var>C</var>)</code> returns + the CDF for the three-parameter distribution family specified by <var>name</var> + and the distribution parameters <var>A</var>, <var>B</var>, and <var>C</var>, evaluated at + the values in <var>x</var>. +</p> +<p> <code><var>p</var> = cdf (…, <code>"upper"</code>)</code> returns the complement of the + CDF using an algorithm that more accurately computes the extreme upper-tail + probabilities. <code>"upper"</code> can follow any of the input arguments in the + previous syntaxes. </p> -<p> A <code>PoissonDistribution</code> object contains the following properties, - which can be accessed using dot notation. +<p> <var>name</var> must be a char string of the name or the abbreviation of the + desired cumulative distribution function as listed in the followng table. + The last column shows the number of required parameters that should be parsed + after <var>x</var> to the desired CDF. The optional input argument + <code>"upper"</code> does not count in the required number of parameters. </p> <table> -<tr><td width="25%"><code>DistributionName</code></td><td width="25%"><code>DistributionCode</code></td><td width="25%"><code>NumParameters</code></td><td width="25%"><code>ParameterNames</code></td></tr> -<tr><td width="25%"><code>ParameterDescription</code></td><td width="25%"><code>ParameterValues</code></td><td width="25%"><code>ParameterValues</code></td><td width="25%"><code>ParameterCI</code></td></tr> -<tr><td width="25%"><code>ParameterIsFixed</code></td><td width="25%"><code>Truncation</code></td><td width="25%"><code>IsTruncated</code></td><td width="25%"><code>InputData</code></td></tr> +<thead><tr><th width="40%">Distribution Name</th><th width="5%"></th><th width="20%">Abbreviation</th><th width="5%"></th><th width="30%">Input Parameters</th></tr></thead> +<tr><td width="40%"><code>"Beta"</code></td><td width="5%"></td><td width="20%"><code>"beta"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Binomial"</code></td><td width="5%"></td><td width="20%"><code>"bino"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Birnbaum-Saunders"</code></td><td width="5%"></td><td width="20%"><code>"bisa"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Burr"</code></td><td width="5%"></td><td width="20%"><code>"burr"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Cauchy"</code></td><td width="5%"></td><td width="20%"><code>"cauchy"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Chi-squared"</code></td><td width="5%"></td><td width="20%"><code>"chi2"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Extreme Value"</code></td><td width="5%"></td><td width="20%"><code>"ev"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Exponential"</code></td><td width="5%"></td><td width="20%"><code>"exp"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"F-Distribution"</code></td><td width="5%"></td><td width="20%"><code>"f"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Gamma"</code></td><td width="5%"></td><td width="20%"><code>"gam"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Geometric"</code></td><td width="5%"></td><td width="20%"><code>"geo"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Generalized Extreme Value"</code></td><td width="5%"></td><td width="20%"><code>"gev"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Generalized Pareto"</code></td><td width="5%"></td><td width="20%"><code>"gp"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Gumbel"</code></td><td width="5%"></td><td width="20%"><code>"gumbel"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Half-normal"</code></td><td width="5%"></td><td width="20%"><code>"hn"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Hypergeometric"</code></td><td width="5%"></td><td width="20%"><code>"hyge"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Inverse Gaussian"</code></td><td width="5%"></td><td width="20%"><code>"invg"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Laplace"</code></td><td width="5%"></td><td width="20%"><code>"laplace"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Logistic"</code></td><td width="5%"></td><td width="20%"><code>"logi"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Log-Logistic"</code></td><td width="5%"></td><td width="20%"><code>"logl"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Lognormal"</code></td><td width="5%"></td><td width="20%"><code>"logn"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Nakagami"</code></td><td width="5%"></td><td width="20%"><code>"naka"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Negative Binomial"</code></td><td width="5%"></td><td width="20%"><code>"nbin"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Noncentral F-Distribution"</code></td><td width="5%"></td><td width="20%"><code>"ncf"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Noncentral Student T"</code></td><td width="5%"></td><td width="20%"><code>"nct"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Noncentral Chi-Squared"</code></td><td width="5%"></td><td width="20%"><code>"ncx2"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Normal"</code></td><td width="5%"></td><td width="20%"><code>"norm"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Poisson"</code></td><td width="5%"></td><td width="20%"><code>"poiss"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Rayleigh"</code></td><td width="5%"></td><td width="20%"><code>"rayl"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Rician"</code></td><td width="5%"></td><td width="20%"><code>"rice"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Student T"</code></td><td width="5%"></td><td width="20%"><code>"t"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"location-scale T"</code></td><td width="5%"></td><td width="20%"><code>"tls"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Triangular"</code></td><td width="5%"></td><td width="20%"><code>"tri"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Discrete Uniform"</code></td><td width="5%"></td><td width="20%"><code>"unid"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Uniform"</code></td><td width="5%"></td><td width="20%"><code>"unif"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Von Mises"</code></td><td width="5%"></td><td width="20%"><code>"vm"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Weibull"</code></td><td width="5%"></td><td width="20%"><code>"wbl"</code></td><td width="5%"></td><td width="30%">2</td></tr> </table> -<p> A <code>PoissonDistribution</code> object contains the following methods: - <code>cdf</code>, <code>icdf</code>, <code>iqr</code>, <code>mean</code>, <code>median</code>, - <code>negloglik</code>, <code>paramci</code>, <code>pdf</code>, <code>plot</code>, <code>proflik</code>, - <code>random</code>, <code>std</code>, <code>truncate</code>, <code>var</code>. -</p> -<p> Further information about the Poisson distribution can be found at - <a href="https://en.wikipedia.org/wiki/Rayleigh_distribution">https://en.wikipedia.org/wiki/Rayleigh_distribution</a> -</p> <p> <strong>See also: </strong> - <a href="fitdist.html">fitdist</a>, - <a href="makedist.html">makedist</a>, + <a href="icdf.html">icdf</a>, + <a href="pdf.html">pdf</a>, + <a href="cdf.html">cdf</a>, + <a href="betacdf.html">betacdf</a>, + <a href="binocdf.html">binocdf</a>, + <a href="bisacdf.html">bisacdf</a>, + <a href="burrcdf.html">burrcdf</a>, + <a href="cauchycdf.html">cauchycdf</a>, + <a href="chi2cdf.html">chi2cdf</a>, + <a href="evcdf.html">evcdf</a>, + <a href="expcdf.html">expcdf</a>, + <a href="fcdf.html">fcdf</a>, + <a href="gamcdf.html">gamcdf</a>, + <a href="geocdf.html">geocdf</a>, + <a href="gevcdf.html">gevcdf</a>, + <a href="gpcdf.html">gpcdf</a>, + <a href="gumbelcdf.html">gumbelcdf</a>, + <a href="hncdf.html">hncdf</a>, + <a href="hygecdf.html">hygecdf</a>, + <a href="invgcdf.html">invgcdf</a>, + <a href="laplacecdf.html">laplacecdf</a>, + <a href="logicdf.html">logicdf</a>, + <a href="loglcdf.html">loglcdf</a>, + <a href="logncdf.html">logncdf</a>, + <a href="nakacdf.html">nakacdf</a>, + <a href="nbincdf.html">nbincdf</a>, + <a href="ncfcdf.html">ncfcdf</a>, + <a href="nctcdf.html">nctcdf</a>, + <a href="ncx2cdf.html">ncx2cdf</a>, + <a href="normcdf.html">normcdf</a>, <a href="poisscdf.html">poisscdf</a>, - <a href="poissinv.html">poissinv</a>, - <a href="poisspdf.html">poisspdf</a>, - <a href="poissrnd.html">poissrnd</a>, - <a href="poissfit.html">poissfit</a>, - <a href="poisslike.html">poisslike</a>, - <a href="poisstat.html">poisstat</a> + <a href="raylcdf.html">raylcdf</a>, + <a href="ricecdf.html">ricecdf</a>, + <a href="tcdf.html">tcdf</a>, + <a href="tlscdf.html">tlscdf</a>, + <a href="tricdf.html">tricdf</a>, + <a href="unidcdf.html">unidcdf</a>, + <a href="unifcdf.html">unifcdf</a>, + <a href="vmcdf.html">vmcdf</a>, + <a href="wblcdf.html">wblcdf</a> </p> <p><strong>Source Code: </strong> <a href="https://github.com/gnu-octave/statistics/tree/main/inst/dist_obj/PoissonDistribution.m">PoissonDistribution</a> @@ -140,39 +201,6 @@ <div class="row d-flex flex-wrap align-items-center"> <div class="col-sm-3 col-md-5 mb-2 mb-sm-0"> <h3 class="d-inline-block mr-2"> - Method: <b><code>cdf</code></b> - </h3> - </div> - </div> - </div> - <div class="card-body"> -<dl> -<dt><u>PoissonDistribution:</u> <var>p</var> = <b>icdf</b><i> (<var>pd</var>, <var>p</var>)</i></dt> -</dl> - -<p> Compute the cumulative distribution function (CDF). -</p> -<div class="ms-5"> -<p> <code><var>p</var> = icdf (<var>pd</var>, <var>x</var>)</code> computes the quantile (the - inverse of the CDF) of the probability distribution object, <var>pd</var>, - evaluated at the values in <var>x</var>. -</p> - -</div> - - </div> - </div> - </div> - - - - - <div class="container-xl my-4"> - <div class="card rounded"> - <div class="card-header card-header-mod"> - <div class="row d-flex flex-wrap align-items-center"> - <div class="col-sm-3 col-md-5 mb-2 mb-sm-0"> - <h3 class="d-inline-block mr-2"> Method: <b><code>icdf</code></b> </h3> </div> @@ -226,7 +254,6 @@ </div> </div> - <div class="container-xl my-4"> <div class="card rounded"> <div class="card-header card-header-mod"> diff --git a/docs/RayleighDistribution.html b/docs/RayleighDistribution.html index 1e5ddfc..6fa19a5 100644 --- a/docs/RayleighDistribution.html +++ b/docs/RayleighDistribution.html @@ -71,65 +71,126 @@ </div> <div class="card-body"> <dl> -<dt><u>statistics:</u> RayleighDistribution</dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>, <var>C</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (…, <code>"upper"</code>)</i></dt> </dl> -<p> Rayleigh probability distribution object. +<p> Return the CDF of a univariate distribution evaluated at <var>x</var>. </p> <div class="ms-5"> -<p> A <code>RayleighDistribution</code> object consists of parameters, a model - description, and sample data for a Rayleigh probability distribution. +<p> <code>cdf</code> is a wrapper for the univariate cumulative distribution functions + available in the statistics package. See the corresponding functions’ help + to learn the signification of the parameters after <var>x</var>. </p> -<p> The Rayleigh distribution uses the following parameters. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>)</code> returns the CDF for the + one-parameter distribution family specified by <var>name</var> and the + distribution parameter <var>A</var>, evaluated at the values in <var>x</var>. </p> - <table> -<thead><tr><th width="25%"><var>Parameter</var></th><th width="48%"><var>Description</var></th><th width="27%"><var>Support</var></th></tr></thead> -<tr><td width="25%"><code>sigma</code></td><td width="48%">Scale parameter</td><td width="27%"><math>sigma > 0</math></td></tr> -</table> - -<p> There are several ways to create a <code>RayleighDistribution</code> object. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>)</code> returns the CDF + for the two-parameter distribution family specified by <var>name</var> and the + distribution parameters <var>A</var> and <var>B</var>, evaluated at the values in + <var>x</var>. </p> - <ul> -<li> Fit a distribution to data using the <code>fitdist</code> function. - </li><li> Create a distribution with specified parameter values using the - <code>makedist</code> function. - </li><li> Use the constructor <code>RayleighDistribution (<var>sigma</var>)</code> - to create a Rayleigh distribution with specified parameter values. - </li><li> Use the static method <code>RayleighDistribution.fit (<var>x</var>, - <var>censor</var>, <var>freq</var>, <var>options</var>)</code> to a distribution to data <var>x</var>. - </li></ul> - -<p> It is highly recommended to use <code>fitdist</code> and <code>makedist</code> - functions to create probability distribution objects, instead of the - constructor and the aforementioned static method. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>, <var>C</var>)</code> returns + the CDF for the three-parameter distribution family specified by <var>name</var> + and the distribution parameters <var>A</var>, <var>B</var>, and <var>C</var>, evaluated at + the values in <var>x</var>. +</p> +<p> <code><var>p</var> = cdf (…, <code>"upper"</code>)</code> returns the complement of the + CDF using an algorithm that more accurately computes the extreme upper-tail + probabilities. <code>"upper"</code> can follow any of the input arguments in the + previous syntaxes. </p> -<p> A <code>RayleighDistribution</code> object contains the following properties, - which can be accessed using dot notation. +<p> <var>name</var> must be a char string of the name or the abbreviation of the + desired cumulative distribution function as listed in the followng table. + The last column shows the number of required parameters that should be parsed + after <var>x</var> to the desired CDF. The optional input argument + <code>"upper"</code> does not count in the required number of parameters. </p> <table> -<tr><td width="25%"><code>DistributionName</code></td><td width="25%"><code>DistributionCode</code></td><td width="25%"><code>NumParameters</code></td><td width="25%"><code>ParameterNames</code></td></tr> -<tr><td width="25%"><code>ParameterDescription</code></td><td width="25%"><code>ParameterValues</code></td><td width="25%"><code>ParameterValues</code></td><td width="25%"><code>ParameterCI</code></td></tr> -<tr><td width="25%"><code>ParameterIsFixed</code></td><td width="25%"><code>Truncation</code></td><td width="25%"><code>IsTruncated</code></td><td width="25%"><code>InputData</code></td></tr> +<thead><tr><th width="40%">Distribution Name</th><th width="5%"></th><th width="20%">Abbreviation</th><th width="5%"></th><th width="30%">Input Parameters</th></tr></thead> +<tr><td width="40%"><code>"Beta"</code></td><td width="5%"></td><td width="20%"><code>"beta"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Binomial"</code></td><td width="5%"></td><td width="20%"><code>"bino"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Birnbaum-Saunders"</code></td><td width="5%"></td><td width="20%"><code>"bisa"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Burr"</code></td><td width="5%"></td><td width="20%"><code>"burr"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Cauchy"</code></td><td width="5%"></td><td width="20%"><code>"cauchy"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Chi-squared"</code></td><td width="5%"></td><td width="20%"><code>"chi2"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Extreme Value"</code></td><td width="5%"></td><td width="20%"><code>"ev"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Exponential"</code></td><td width="5%"></td><td width="20%"><code>"exp"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"F-Distribution"</code></td><td width="5%"></td><td width="20%"><code>"f"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Gamma"</code></td><td width="5%"></td><td width="20%"><code>"gam"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Geometric"</code></td><td width="5%"></td><td width="20%"><code>"geo"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Generalized Extreme Value"</code></td><td width="5%"></td><td width="20%"><code>"gev"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Generalized Pareto"</code></td><td width="5%"></td><td width="20%"><code>"gp"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Gumbel"</code></td><td width="5%"></td><td width="20%"><code>"gumbel"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Half-normal"</code></td><td width="5%"></td><td width="20%"><code>"hn"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Hypergeometric"</code></td><td width="5%"></td><td width="20%"><code>"hyge"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Inverse Gaussian"</code></td><td width="5%"></td><td width="20%"><code>"invg"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Laplace"</code></td><td width="5%"></td><td width="20%"><code>"laplace"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Logistic"</code></td><td width="5%"></td><td width="20%"><code>"logi"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Log-Logistic"</code></td><td width="5%"></td><td width="20%"><code>"logl"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Lognormal"</code></td><td width="5%"></td><td width="20%"><code>"logn"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Nakagami"</code></td><td width="5%"></td><td width="20%"><code>"naka"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Negative Binomial"</code></td><td width="5%"></td><td width="20%"><code>"nbin"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Noncentral F-Distribution"</code></td><td width="5%"></td><td width="20%"><code>"ncf"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Noncentral Student T"</code></td><td width="5%"></td><td width="20%"><code>"nct"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Noncentral Chi-Squared"</code></td><td width="5%"></td><td width="20%"><code>"ncx2"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Normal"</code></td><td width="5%"></td><td width="20%"><code>"norm"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Poisson"</code></td><td width="5%"></td><td width="20%"><code>"poiss"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Rayleigh"</code></td><td width="5%"></td><td width="20%"><code>"rayl"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Rician"</code></td><td width="5%"></td><td width="20%"><code>"rice"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Student T"</code></td><td width="5%"></td><td width="20%"><code>"t"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"location-scale T"</code></td><td width="5%"></td><td width="20%"><code>"tls"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Triangular"</code></td><td width="5%"></td><td width="20%"><code>"tri"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Discrete Uniform"</code></td><td width="5%"></td><td width="20%"><code>"unid"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Uniform"</code></td><td width="5%"></td><td width="20%"><code>"unif"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Von Mises"</code></td><td width="5%"></td><td width="20%"><code>"vm"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Weibull"</code></td><td width="5%"></td><td width="20%"><code>"wbl"</code></td><td width="5%"></td><td width="30%">2</td></tr> </table> -<p> A <code>RayleighDistribution</code> object contains the following methods: - <code>cdf</code>, <code>icdf</code>, <code>iqr</code>, <code>mean</code>, <code>median</code>, - <code>negloglik</code>, <code>paramci</code>, <code>pdf</code>, <code>plot</code>, <code>proflik</code>, - <code>random</code>, <code>std</code>, <code>truncate</code>, <code>var</code>. -</p> -<p> Further information about the Rayleigh distribution can be found at - <a href="https://en.wikipedia.org/wiki/Rayleigh_distribution">https://en.wikipedia.org/wiki/Rayleigh_distribution</a> -</p> <p> <strong>See also: </strong> - <a href="fitdist.html">fitdist</a>, - <a href="makedist.html">makedist</a>, + <a href="icdf.html">icdf</a>, + <a href="pdf.html">pdf</a>, + <a href="cdf.html">cdf</a>, + <a href="betacdf.html">betacdf</a>, + <a href="binocdf.html">binocdf</a>, + <a href="bisacdf.html">bisacdf</a>, + <a href="burrcdf.html">burrcdf</a>, + <a href="cauchycdf.html">cauchycdf</a>, + <a href="chi2cdf.html">chi2cdf</a>, + <a href="evcdf.html">evcdf</a>, + <a href="expcdf.html">expcdf</a>, + <a href="fcdf.html">fcdf</a>, + <a href="gamcdf.html">gamcdf</a>, + <a href="geocdf.html">geocdf</a>, + <a href="gevcdf.html">gevcdf</a>, + <a href="gpcdf.html">gpcdf</a>, + <a href="gumbelcdf.html">gumbelcdf</a>, + <a href="hncdf.html">hncdf</a>, + <a href="hygecdf.html">hygecdf</a>, + <a href="invgcdf.html">invgcdf</a>, + <a href="laplacecdf.html">laplacecdf</a>, + <a href="logicdf.html">logicdf</a>, + <a href="loglcdf.html">loglcdf</a>, + <a href="logncdf.html">logncdf</a>, + <a href="nakacdf.html">nakacdf</a>, + <a href="nbincdf.html">nbincdf</a>, + <a href="ncfcdf.html">ncfcdf</a>, + <a href="nctcdf.html">nctcdf</a>, + <a href="ncx2cdf.html">ncx2cdf</a>, + <a href="normcdf.html">normcdf</a>, + <a href="poisscdf.html">poisscdf</a>, <a href="raylcdf.html">raylcdf</a>, - <a href="raylinv.html">raylinv</a>, - <a href="raylpdf.html">raylpdf</a>, - <a href="raylrnd.html">raylrnd</a>, - <a href="raylfit.html">raylfit</a>, - <a href="rayllike.html">rayllike</a>, - <a href="raylstat.html">raylstat</a> + <a href="ricecdf.html">ricecdf</a>, + <a href="tcdf.html">tcdf</a>, + <a href="tlscdf.html">tlscdf</a>, + <a href="tricdf.html">tricdf</a>, + <a href="unidcdf.html">unidcdf</a>, + <a href="unifcdf.html">unifcdf</a>, + <a href="vmcdf.html">vmcdf</a>, + <a href="wblcdf.html">wblcdf</a> </p> <p><strong>Source Code: </strong> <a href="https://github.com/gnu-octave/statistics/tree/main/inst/dist_obj/RayleighDistribution.m">RayleighDistribution</a> @@ -140,39 +201,6 @@ <div class="row d-flex flex-wrap align-items-center"> <div class="col-sm-3 col-md-5 mb-2 mb-sm-0"> <h3 class="d-inline-block mr-2"> - Method: <b><code>cdf</code></b> - </h3> - </div> - </div> - </div> - <div class="card-body"> -<dl> -<dt><u>RayleighDistribution:</u> <var>p</var> = <b>icdf</b><i> (<var>pd</var>, <var>p</var>)</i></dt> -</dl> - -<p> Compute the cumulative distribution function (CDF). -</p> -<div class="ms-5"> -<p> <code><var>p</var> = icdf (<var>pd</var>, <var>x</var>)</code> computes the quantile (the - inverse of the CDF) of the probability distribution object, <var>pd</var>, - evaluated at the values in <var>x</var>. -</p> - -</div> - - </div> - </div> - </div> - - - - - <div class="container-xl my-4"> - <div class="card rounded"> - <div class="card-header card-header-mod"> - <div class="row d-flex flex-wrap align-items-center"> - <div class="col-sm-3 col-md-5 mb-2 mb-sm-0"> - <h3 class="d-inline-block mr-2"> Method: <b><code>icdf</code></b> </h3> </div> @@ -226,7 +254,6 @@ </div> </div> - <div class="container-xl my-4"> <div class="card rounded"> <div class="card-header card-header-mod"> diff --git a/docs/RegressionGAM.html b/docs/RegressionGAM.html index 226c46c..81c7769 100644 --- a/docs/RegressionGAM.html +++ b/docs/RegressionGAM.html @@ -172,9 +172,6 @@ <p><strong>Source Code: </strong> <a href="https://github.com/gnu-octave/statistics/tree/main/inst/Regression/RegressionGAM.m">RegressionGAM</a> </div> - - - <div class="container-xl my-4"> <div class="card rounded"> <div class="card-header card-header-mod"> diff --git a/docs/RicianDistribution.html b/docs/RicianDistribution.html index 39f22f7..5ac39b6 100644 --- a/docs/RicianDistribution.html +++ b/docs/RicianDistribution.html @@ -71,66 +71,126 @@ </div> <div class="card-body"> <dl> -<dt><u>statistics:</u> RicianDistribution</dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>, <var>C</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (…, <code>"upper"</code>)</i></dt> </dl> -<p> Rician probability distribution object. +<p> Return the CDF of a univariate distribution evaluated at <var>x</var>. </p> <div class="ms-5"> -<p> A <code>RicianDistribution</code> object consists of parameters, a model - description, and sample data for a Rician probability distribution. +<p> <code>cdf</code> is a wrapper for the univariate cumulative distribution functions + available in the statistics package. See the corresponding functions’ help + to learn the signification of the parameters after <var>x</var>. </p> -<p> The Rician distribution uses the following parameters. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>)</code> returns the CDF for the + one-parameter distribution family specified by <var>name</var> and the + distribution parameter <var>A</var>, evaluated at the values in <var>x</var>. </p> - <table> -<thead><tr><th width="25%"><var>Parameter</var></th><th width="48%"><var>Description</var></th><th width="27%"><var>Support</var></th></tr></thead> -<tr><td width="25%"><code>s</code></td><td width="48%">Noncentrality parameter</td><td width="27%"><math>s >= 0</math></td></tr> -<tr><td width="25%"><code>sigma</code></td><td width="48%">Scale parameter</td><td width="27%"><math>sigma > 0</math></td></tr> -</table> - -<p> There are several ways to create a <code>RicianDistribution</code> object. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>)</code> returns the CDF + for the two-parameter distribution family specified by <var>name</var> and the + distribution parameters <var>A</var> and <var>B</var>, evaluated at the values in + <var>x</var>. </p> - <ul> -<li> Fit a distribution to data using the <code>fitdist</code> function. - </li><li> Create a distribution with specified parameter values using the - <code>makedist</code> function. - </li><li> Use the constructor <code>RicianDistribution (<var>s</var>, <var>sigma</var>)</code> - to create a Rician distribution with specified parameter values. - </li><li> Use the static method <code>RicianDistribution.fit (<var>x</var>, - <var>censor</var>, <var>freq</var>, <var>options</var>)</code> to a distribution to data <var>x</var>. - </li></ul> - -<p> It is highly recommended to use <code>fitdist</code> and <code>makedist</code> - functions to create probability distribution objects, instead of the - constructor and the aforementioned static method. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>, <var>C</var>)</code> returns + the CDF for the three-parameter distribution family specified by <var>name</var> + and the distribution parameters <var>A</var>, <var>B</var>, and <var>C</var>, evaluated at + the values in <var>x</var>. +</p> +<p> <code><var>p</var> = cdf (…, <code>"upper"</code>)</code> returns the complement of the + CDF using an algorithm that more accurately computes the extreme upper-tail + probabilities. <code>"upper"</code> can follow any of the input arguments in the + previous syntaxes. </p> -<p> A <code>RicianDistribution</code> object contains the following properties, - which can be accessed using dot notation. +<p> <var>name</var> must be a char string of the name or the abbreviation of the + desired cumulative distribution function as listed in the followng table. + The last column shows the number of required parameters that should be parsed + after <var>x</var> to the desired CDF. The optional input argument + <code>"upper"</code> does not count in the required number of parameters. </p> <table> -<tr><td width="25%"><code>DistributionName</code></td><td width="25%"><code>DistributionCode</code></td><td width="25%"><code>NumParameters</code></td><td width="25%"><code>ParameterNames</code></td></tr> -<tr><td width="25%"><code>ParameterDescription</code></td><td width="25%"><code>ParameterValues</code></td><td width="25%"><code>ParameterValues</code></td><td width="25%"><code>ParameterCI</code></td></tr> -<tr><td width="25%"><code>ParameterIsFixed</code></td><td width="25%"><code>Truncation</code></td><td width="25%"><code>IsTruncated</code></td><td width="25%"><code>InputData</code></td></tr> +<thead><tr><th width="40%">Distribution Name</th><th width="5%"></th><th width="20%">Abbreviation</th><th width="5%"></th><th width="30%">Input Parameters</th></tr></thead> +<tr><td width="40%"><code>"Beta"</code></td><td width="5%"></td><td width="20%"><code>"beta"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Binomial"</code></td><td width="5%"></td><td width="20%"><code>"bino"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Birnbaum-Saunders"</code></td><td width="5%"></td><td width="20%"><code>"bisa"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Burr"</code></td><td width="5%"></td><td width="20%"><code>"burr"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Cauchy"</code></td><td width="5%"></td><td width="20%"><code>"cauchy"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Chi-squared"</code></td><td width="5%"></td><td width="20%"><code>"chi2"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Extreme Value"</code></td><td width="5%"></td><td width="20%"><code>"ev"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Exponential"</code></td><td width="5%"></td><td width="20%"><code>"exp"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"F-Distribution"</code></td><td width="5%"></td><td width="20%"><code>"f"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Gamma"</code></td><td width="5%"></td><td width="20%"><code>"gam"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Geometric"</code></td><td width="5%"></td><td width="20%"><code>"geo"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Generalized Extreme Value"</code></td><td width="5%"></td><td width="20%"><code>"gev"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Generalized Pareto"</code></td><td width="5%"></td><td width="20%"><code>"gp"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Gumbel"</code></td><td width="5%"></td><td width="20%"><code>"gumbel"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Half-normal"</code></td><td width="5%"></td><td width="20%"><code>"hn"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Hypergeometric"</code></td><td width="5%"></td><td width="20%"><code>"hyge"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Inverse Gaussian"</code></td><td width="5%"></td><td width="20%"><code>"invg"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Laplace"</code></td><td width="5%"></td><td width="20%"><code>"laplace"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Logistic"</code></td><td width="5%"></td><td width="20%"><code>"logi"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Log-Logistic"</code></td><td width="5%"></td><td width="20%"><code>"logl"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Lognormal"</code></td><td width="5%"></td><td width="20%"><code>"logn"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Nakagami"</code></td><td width="5%"></td><td width="20%"><code>"naka"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Negative Binomial"</code></td><td width="5%"></td><td width="20%"><code>"nbin"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Noncentral F-Distribution"</code></td><td width="5%"></td><td width="20%"><code>"ncf"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Noncentral Student T"</code></td><td width="5%"></td><td width="20%"><code>"nct"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Noncentral Chi-Squared"</code></td><td width="5%"></td><td width="20%"><code>"ncx2"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Normal"</code></td><td width="5%"></td><td width="20%"><code>"norm"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Poisson"</code></td><td width="5%"></td><td width="20%"><code>"poiss"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Rayleigh"</code></td><td width="5%"></td><td width="20%"><code>"rayl"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Rician"</code></td><td width="5%"></td><td width="20%"><code>"rice"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Student T"</code></td><td width="5%"></td><td width="20%"><code>"t"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"location-scale T"</code></td><td width="5%"></td><td width="20%"><code>"tls"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Triangular"</code></td><td width="5%"></td><td width="20%"><code>"tri"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Discrete Uniform"</code></td><td width="5%"></td><td width="20%"><code>"unid"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Uniform"</code></td><td width="5%"></td><td width="20%"><code>"unif"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Von Mises"</code></td><td width="5%"></td><td width="20%"><code>"vm"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Weibull"</code></td><td width="5%"></td><td width="20%"><code>"wbl"</code></td><td width="5%"></td><td width="30%">2</td></tr> </table> -<p> A <code>RicianDistribution</code> object contains the following methods: - <code>cdf</code>, <code>icdf</code>, <code>iqr</code>, <code>mean</code>, <code>median</code>, - <code>negloglik</code>, <code>paramci</code>, <code>pdf</code>, <code>plot</code>, <code>proflik</code>, - <code>random</code>, <code>std</code>, <code>truncate</code>, <code>var</code>. -</p> -<p> Further information about the Rician distribution can be found at - <a href="https://en.wikipedia.org/wiki/Weibull_distribution">https://en.wikipedia.org/wiki/Weibull_distribution</a> -</p> <p> <strong>See also: </strong> - <a href="fitdist.html">fitdist</a>, - <a href="makedist.html">makedist</a>, + <a href="icdf.html">icdf</a>, + <a href="pdf.html">pdf</a>, + <a href="cdf.html">cdf</a>, + <a href="betacdf.html">betacdf</a>, + <a href="binocdf.html">binocdf</a>, + <a href="bisacdf.html">bisacdf</a>, + <a href="burrcdf.html">burrcdf</a>, + <a href="cauchycdf.html">cauchycdf</a>, + <a href="chi2cdf.html">chi2cdf</a>, + <a href="evcdf.html">evcdf</a>, + <a href="expcdf.html">expcdf</a>, + <a href="fcdf.html">fcdf</a>, + <a href="gamcdf.html">gamcdf</a>, + <a href="geocdf.html">geocdf</a>, + <a href="gevcdf.html">gevcdf</a>, + <a href="gpcdf.html">gpcdf</a>, + <a href="gumbelcdf.html">gumbelcdf</a>, + <a href="hncdf.html">hncdf</a>, + <a href="hygecdf.html">hygecdf</a>, + <a href="invgcdf.html">invgcdf</a>, + <a href="laplacecdf.html">laplacecdf</a>, + <a href="logicdf.html">logicdf</a>, + <a href="loglcdf.html">loglcdf</a>, + <a href="logncdf.html">logncdf</a>, + <a href="nakacdf.html">nakacdf</a>, + <a href="nbincdf.html">nbincdf</a>, + <a href="ncfcdf.html">ncfcdf</a>, + <a href="nctcdf.html">nctcdf</a>, + <a href="ncx2cdf.html">ncx2cdf</a>, + <a href="normcdf.html">normcdf</a>, + <a href="poisscdf.html">poisscdf</a>, + <a href="raylcdf.html">raylcdf</a>, <a href="ricecdf.html">ricecdf</a>, - <a href="riceinv.html">riceinv</a>, - <a href="ricepdf.html">ricepdf</a>, - <a href="ricernd.html">ricernd</a>, - <a href="ricefit.html">ricefit</a>, - <a href="ricelike.html">ricelike</a>, - <a href="ricestat.html">ricestat</a> + <a href="tcdf.html">tcdf</a>, + <a href="tlscdf.html">tlscdf</a>, + <a href="tricdf.html">tricdf</a>, + <a href="unidcdf.html">unidcdf</a>, + <a href="unifcdf.html">unifcdf</a>, + <a href="vmcdf.html">vmcdf</a>, + <a href="wblcdf.html">wblcdf</a> </p> <p><strong>Source Code: </strong> <a href="https://github.com/gnu-octave/statistics/tree/main/inst/dist_obj/RicianDistribution.m">RicianDistribution</a> @@ -141,39 +201,6 @@ <div class="row d-flex flex-wrap align-items-center"> <div class="col-sm-3 col-md-5 mb-2 mb-sm-0"> <h3 class="d-inline-block mr-2"> - Method: <b><code>cdf</code></b> - </h3> - </div> - </div> - </div> - <div class="card-body"> -<dl> -<dt><u>RicianDistribution:</u> <var>p</var> = <b>icdf</b><i> (<var>pd</var>, <var>p</var>)</i></dt> -</dl> - -<p> Compute the cumulative distribution function (CDF). -</p> -<div class="ms-5"> -<p> <code><var>p</var> = icdf (<var>pd</var>, <var>x</var>)</code> computes the quantile (the - inverse of the CDF) of the probability distribution object, <var>pd</var>, - evaluated at the values in <var>x</var>. -</p> - -</div> - - </div> - </div> - </div> - - - - - <div class="container-xl my-4"> - <div class="card rounded"> - <div class="card-header card-header-mod"> - <div class="row d-flex flex-wrap align-items-center"> - <div class="col-sm-3 col-md-5 mb-2 mb-sm-0"> - <h3 class="d-inline-block mr-2"> Method: <b><code>icdf</code></b> </h3> </div> @@ -227,7 +254,6 @@ </div> </div> - <div class="container-xl my-4"> <div class="card rounded"> <div class="card-header card-header-mod"> diff --git a/docs/SilhouetteEvaluation.html b/docs/SilhouetteEvaluation.html index 7289e27..d510567 100644 --- a/docs/SilhouetteEvaluation.html +++ b/docs/SilhouetteEvaluation.html @@ -170,7 +170,6 @@ </div> - <div class="container-xl my-4"> <div class="card rounded"> <div class="card-header card-header-mod"> diff --git a/docs/TriangularDistribution.html b/docs/TriangularDistribution.html index fb57c14..14c1041 100644 --- a/docs/TriangularDistribution.html +++ b/docs/TriangularDistribution.html @@ -71,60 +71,126 @@ </div> <div class="card-body"> <dl> -<dt><u>statistics:</u> TriangularDistribution</dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>, <var>C</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (…, <code>"upper"</code>)</i></dt> </dl> -<p> Triangular probability distribution object. +<p> Return the CDF of a univariate distribution evaluated at <var>x</var>. </p> <div class="ms-5"> -<p> A <code>TriangularDistribution</code> object consists of parameters, a model - description, and sample data for a triangular probability distribution. +<p> <code>cdf</code> is a wrapper for the univariate cumulative distribution functions + available in the statistics package. See the corresponding functions’ help + to learn the signification of the parameters after <var>x</var>. </p> -<p> The triangular distribution uses the following parameters. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>)</code> returns the CDF for the + one-parameter distribution family specified by <var>name</var> and the + distribution parameter <var>A</var>, evaluated at the values in <var>x</var>. </p> - <table> -<thead><tr><th width="25%"><var>Parameter</var></th><th width="48%"><var>Description</var></th><th width="27%"><var>Support</var></th></tr></thead> -<tr><td width="25%"><code>A</code></td><td width="48%">Lower limit</td><td width="27%"><math>-Inf < A < Inf</math></td></tr> -<tr><td width="25%"><code>B</code></td><td width="48%">Peak location</td><td width="27%"><math>A <= B <= C</math></td></tr> -<tr><td width="25%"><code>C</code></td><td width="48%">Upper limit</td><td width="27%"><math>C > A</math></td></tr> -</table> - -<p> There are several ways to create a <code>TriangularDistribution</code> object. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>)</code> returns the CDF + for the two-parameter distribution family specified by <var>name</var> and the + distribution parameters <var>A</var> and <var>B</var>, evaluated at the values in + <var>x</var>. +</p> +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>, <var>C</var>)</code> returns + the CDF for the three-parameter distribution family specified by <var>name</var> + and the distribution parameters <var>A</var>, <var>B</var>, and <var>C</var>, evaluated at + the values in <var>x</var>. </p> - <ul> -<li> Create a distribution with specified parameter values using the - <code>makedist</code> function. - </li><li> Use the constructor <code>TriangularDistribution (<var>A</var>, <var>B</var> - <var>C</var>)</code> to create a triangular distribution with specified parameter - values. - </li></ul> - -<p> It is highly recommended to use <code>makedist</code> function to create - probability distribution objects, instead of the constructor. +<p> <code><var>p</var> = cdf (…, <code>"upper"</code>)</code> returns the complement of the + CDF using an algorithm that more accurately computes the extreme upper-tail + probabilities. <code>"upper"</code> can follow any of the input arguments in the + previous syntaxes. </p> -<p> A <code>TriangularDistribution</code> object contains the following - properties, which can be accessed using dot notation. +<p> <var>name</var> must be a char string of the name or the abbreviation of the + desired cumulative distribution function as listed in the followng table. + The last column shows the number of required parameters that should be parsed + after <var>x</var> to the desired CDF. The optional input argument + <code>"upper"</code> does not count in the required number of parameters. </p> <table> -<tr><td width="25%"><code>DistributionName</code></td><td width="25%"><code>DistributionCode</code></td><td width="25%"><code>NumParameters</code></td><td width="25%"><code>ParameterNames</code></td></tr> -<tr><td width="25%"><code>ParameterDescription</code></td><td width="25%"><code>ParameterValues</code></td><td width="25%"><code>Truncation</code></td><td width="25%"><code>IsTruncated</code></td></tr> +<thead><tr><th width="40%">Distribution Name</th><th width="5%"></th><th width="20%">Abbreviation</th><th width="5%"></th><th width="30%">Input Parameters</th></tr></thead> +<tr><td width="40%"><code>"Beta"</code></td><td width="5%"></td><td width="20%"><code>"beta"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Binomial"</code></td><td width="5%"></td><td width="20%"><code>"bino"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Birnbaum-Saunders"</code></td><td width="5%"></td><td width="20%"><code>"bisa"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Burr"</code></td><td width="5%"></td><td width="20%"><code>"burr"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Cauchy"</code></td><td width="5%"></td><td width="20%"><code>"cauchy"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Chi-squared"</code></td><td width="5%"></td><td width="20%"><code>"chi2"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Extreme Value"</code></td><td width="5%"></td><td width="20%"><code>"ev"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Exponential"</code></td><td width="5%"></td><td width="20%"><code>"exp"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"F-Distribution"</code></td><td width="5%"></td><td width="20%"><code>"f"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Gamma"</code></td><td width="5%"></td><td width="20%"><code>"gam"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Geometric"</code></td><td width="5%"></td><td width="20%"><code>"geo"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Generalized Extreme Value"</code></td><td width="5%"></td><td width="20%"><code>"gev"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Generalized Pareto"</code></td><td width="5%"></td><td width="20%"><code>"gp"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Gumbel"</code></td><td width="5%"></td><td width="20%"><code>"gumbel"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Half-normal"</code></td><td width="5%"></td><td width="20%"><code>"hn"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Hypergeometric"</code></td><td width="5%"></td><td width="20%"><code>"hyge"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Inverse Gaussian"</code></td><td width="5%"></td><td width="20%"><code>"invg"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Laplace"</code></td><td width="5%"></td><td width="20%"><code>"laplace"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Logistic"</code></td><td width="5%"></td><td width="20%"><code>"logi"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Log-Logistic"</code></td><td width="5%"></td><td width="20%"><code>"logl"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Lognormal"</code></td><td width="5%"></td><td width="20%"><code>"logn"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Nakagami"</code></td><td width="5%"></td><td width="20%"><code>"naka"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Negative Binomial"</code></td><td width="5%"></td><td width="20%"><code>"nbin"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Noncentral F-Distribution"</code></td><td width="5%"></td><td width="20%"><code>"ncf"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Noncentral Student T"</code></td><td width="5%"></td><td width="20%"><code>"nct"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Noncentral Chi-Squared"</code></td><td width="5%"></td><td width="20%"><code>"ncx2"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Normal"</code></td><td width="5%"></td><td width="20%"><code>"norm"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Poisson"</code></td><td width="5%"></td><td width="20%"><code>"poiss"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Rayleigh"</code></td><td width="5%"></td><td width="20%"><code>"rayl"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Rician"</code></td><td width="5%"></td><td width="20%"><code>"rice"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Student T"</code></td><td width="5%"></td><td width="20%"><code>"t"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"location-scale T"</code></td><td width="5%"></td><td width="20%"><code>"tls"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Triangular"</code></td><td width="5%"></td><td width="20%"><code>"tri"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Discrete Uniform"</code></td><td width="5%"></td><td width="20%"><code>"unid"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Uniform"</code></td><td width="5%"></td><td width="20%"><code>"unif"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Von Mises"</code></td><td width="5%"></td><td width="20%"><code>"vm"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Weibull"</code></td><td width="5%"></td><td width="20%"><code>"wbl"</code></td><td width="5%"></td><td width="30%">2</td></tr> </table> -<p> A <code>TriangularDistribution</code> object contains the following methods: - <code>cdf</code>, <code>icdf</code>, <code>iqr</code>, <code>mean</code>, <code>median</code>, - <code>pdf</code>, <code>plot</code>, <code>random</code>, <code>std</code>, <code>truncate</code>, - <code>var</code>. -</p> -<p> Further information about the continuous triangular distribution can be found - at <a href="https://en.wikipedia.org/wiki/Continuous_uniform_distribution">https://en.wikipedia.org/wiki/Continuous_uniform_distribution</a> -</p> <p> <strong>See also: </strong> - <a href="makedist.html">makedist</a>, + <a href="icdf.html">icdf</a>, + <a href="pdf.html">pdf</a>, + <a href="cdf.html">cdf</a>, + <a href="betacdf.html">betacdf</a>, + <a href="binocdf.html">binocdf</a>, + <a href="bisacdf.html">bisacdf</a>, + <a href="burrcdf.html">burrcdf</a>, + <a href="cauchycdf.html">cauchycdf</a>, + <a href="chi2cdf.html">chi2cdf</a>, + <a href="evcdf.html">evcdf</a>, + <a href="expcdf.html">expcdf</a>, + <a href="fcdf.html">fcdf</a>, + <a href="gamcdf.html">gamcdf</a>, + <a href="geocdf.html">geocdf</a>, + <a href="gevcdf.html">gevcdf</a>, + <a href="gpcdf.html">gpcdf</a>, + <a href="gumbelcdf.html">gumbelcdf</a>, + <a href="hncdf.html">hncdf</a>, + <a href="hygecdf.html">hygecdf</a>, + <a href="invgcdf.html">invgcdf</a>, + <a href="laplacecdf.html">laplacecdf</a>, + <a href="logicdf.html">logicdf</a>, + <a href="loglcdf.html">loglcdf</a>, + <a href="logncdf.html">logncdf</a>, + <a href="nakacdf.html">nakacdf</a>, + <a href="nbincdf.html">nbincdf</a>, + <a href="ncfcdf.html">ncfcdf</a>, + <a href="nctcdf.html">nctcdf</a>, + <a href="ncx2cdf.html">ncx2cdf</a>, + <a href="normcdf.html">normcdf</a>, + <a href="poisscdf.html">poisscdf</a>, + <a href="raylcdf.html">raylcdf</a>, + <a href="ricecdf.html">ricecdf</a>, + <a href="tcdf.html">tcdf</a>, + <a href="tlscdf.html">tlscdf</a>, <a href="tricdf.html">tricdf</a>, - <a href="triinv.html">triinv</a>, - <a href="tripdf.html">tripdf</a>, - <a href="trirnd.html">trirnd</a>, - <a href="tristat.html">tristat</a> + <a href="unidcdf.html">unidcdf</a>, + <a href="unifcdf.html">unifcdf</a>, + <a href="vmcdf.html">vmcdf</a>, + <a href="wblcdf.html">wblcdf</a> </p> <p><strong>Source Code: </strong> <a href="https://github.com/gnu-octave/statistics/tree/main/inst/dist_obj/TriangularDistribution.m">TriangularDistribution</a> @@ -135,38 +201,6 @@ <div class="row d-flex flex-wrap align-items-center"> <div class="col-sm-3 col-md-5 mb-2 mb-sm-0"> <h3 class="d-inline-block mr-2"> - Method: <b><code>cdf</code></b> - </h3> - </div> - </div> - </div> - <div class="card-body"> -<dl> -<dt><u>TriangularDistribution:</u> <var>p</var> = <b>icdf</b><i> (<var>pd</var>, <var>p</var>)</i></dt> -</dl> - -<p> Compute the cumulative distribution function (CDF). -</p> -<div class="ms-5"> -<p> <code><var>p</var> = icdf (<var>pd</var>, <var>x</var>)</code> computes the quantile (the - inverse of the CDF) of the probability distribution object, <var>pd</var>, - evaluated at the values in <var>x</var>. -</p> - -</div> - - </div> - </div> - </div> - - - - <div class="container-xl my-4"> - <div class="card rounded"> - <div class="card-header card-header-mod"> - <div class="row d-flex flex-wrap align-items-center"> - <div class="col-sm-3 col-md-5 mb-2 mb-sm-0"> - <h3 class="d-inline-block mr-2"> Method: <b><code>icdf</code></b> </h3> </div> diff --git a/docs/UniformDistribution.html b/docs/UniformDistribution.html index f11f4b4..f498473 100644 --- a/docs/UniformDistribution.html +++ b/docs/UniformDistribution.html @@ -71,60 +71,126 @@ </div> <div class="card-body"> <dl> -<dt><u>statistics:</u> UniformDistribution</dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>, <var>C</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (…, <code>"upper"</code>)</i></dt> </dl> -<p> Continuous uniform probability distribution object. +<p> Return the CDF of a univariate distribution evaluated at <var>x</var>. </p> <div class="ms-5"> -<p> A <code>UniformDistribution</code> object consists of parameters, a model - description, and sample data for a uniform probability distribution. +<p> <code>cdf</code> is a wrapper for the univariate cumulative distribution functions + available in the statistics package. See the corresponding functions’ help + to learn the signification of the parameters after <var>x</var>. </p> -<p> The uniform distribution uses the following parameters. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>)</code> returns the CDF for the + one-parameter distribution family specified by <var>name</var> and the + distribution parameter <var>A</var>, evaluated at the values in <var>x</var>. </p> - <table> -<thead><tr><th width="25%"><var>Parameter</var></th><th width="48%"><var>Description</var></th><th width="27%"><var>Support</var></th></tr></thead> -<tr><td width="25%"><code>Lower</code></td><td width="48%">Lower limit</td><td width="27%"><math>-Inf < Lower < Upper</math></td></tr> -<tr><td width="25%"><code>Upper</code></td><td width="48%">Upper limit</td><td width="27%"><math>Lower < Upper < Inf</math></td></tr> -</table> - -<p> There are several ways to create a <code>UniformDistribution</code> object. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>)</code> returns the CDF + for the two-parameter distribution family specified by <var>name</var> and the + distribution parameters <var>A</var> and <var>B</var>, evaluated at the values in + <var>x</var>. +</p> +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>, <var>C</var>)</code> returns + the CDF for the three-parameter distribution family specified by <var>name</var> + and the distribution parameters <var>A</var>, <var>B</var>, and <var>C</var>, evaluated at + the values in <var>x</var>. </p> - <ul> -<li> Create a distribution with specified parameter values using the - <code>makedist</code> function. - </li><li> Use the constructor <code>UniformDistribution (<var>Lower</var>, - <var>Upper</var>)</code> to create a uniform distribution with specified parameter - values. - </li></ul> - -<p> It is highly recommended to use <code>makedist</code> function to create - probability distribution objects, instead of the constructor. +<p> <code><var>p</var> = cdf (…, <code>"upper"</code>)</code> returns the complement of the + CDF using an algorithm that more accurately computes the extreme upper-tail + probabilities. <code>"upper"</code> can follow any of the input arguments in the + previous syntaxes. </p> -<p> A <code>UniformDistribution</code> object contains the following - properties, which can be accessed using dot notation. +<p> <var>name</var> must be a char string of the name or the abbreviation of the + desired cumulative distribution function as listed in the followng table. + The last column shows the number of required parameters that should be parsed + after <var>x</var> to the desired CDF. The optional input argument + <code>"upper"</code> does not count in the required number of parameters. </p> <table> -<tr><td width="25%"><code>DistributionName</code></td><td width="25%"><code>DistributionCode</code></td><td width="25%"><code>NumParameters</code></td><td width="25%"><code>ParameterNames</code></td></tr> -<tr><td width="25%"><code>ParameterDescription</code></td><td width="25%"><code>ParameterValues</code></td><td width="25%"><code>Truncation</code></td><td width="25%"><code>IsTruncated</code></td></tr> +<thead><tr><th width="40%">Distribution Name</th><th width="5%"></th><th width="20%">Abbreviation</th><th width="5%"></th><th width="30%">Input Parameters</th></tr></thead> +<tr><td width="40%"><code>"Beta"</code></td><td width="5%"></td><td width="20%"><code>"beta"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Binomial"</code></td><td width="5%"></td><td width="20%"><code>"bino"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Birnbaum-Saunders"</code></td><td width="5%"></td><td width="20%"><code>"bisa"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Burr"</code></td><td width="5%"></td><td width="20%"><code>"burr"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Cauchy"</code></td><td width="5%"></td><td width="20%"><code>"cauchy"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Chi-squared"</code></td><td width="5%"></td><td width="20%"><code>"chi2"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Extreme Value"</code></td><td width="5%"></td><td width="20%"><code>"ev"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Exponential"</code></td><td width="5%"></td><td width="20%"><code>"exp"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"F-Distribution"</code></td><td width="5%"></td><td width="20%"><code>"f"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Gamma"</code></td><td width="5%"></td><td width="20%"><code>"gam"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Geometric"</code></td><td width="5%"></td><td width="20%"><code>"geo"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Generalized Extreme Value"</code></td><td width="5%"></td><td width="20%"><code>"gev"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Generalized Pareto"</code></td><td width="5%"></td><td width="20%"><code>"gp"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Gumbel"</code></td><td width="5%"></td><td width="20%"><code>"gumbel"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Half-normal"</code></td><td width="5%"></td><td width="20%"><code>"hn"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Hypergeometric"</code></td><td width="5%"></td><td width="20%"><code>"hyge"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Inverse Gaussian"</code></td><td width="5%"></td><td width="20%"><code>"invg"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Laplace"</code></td><td width="5%"></td><td width="20%"><code>"laplace"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Logistic"</code></td><td width="5%"></td><td width="20%"><code>"logi"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Log-Logistic"</code></td><td width="5%"></td><td width="20%"><code>"logl"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Lognormal"</code></td><td width="5%"></td><td width="20%"><code>"logn"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Nakagami"</code></td><td width="5%"></td><td width="20%"><code>"naka"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Negative Binomial"</code></td><td width="5%"></td><td width="20%"><code>"nbin"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Noncentral F-Distribution"</code></td><td width="5%"></td><td width="20%"><code>"ncf"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Noncentral Student T"</code></td><td width="5%"></td><td width="20%"><code>"nct"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Noncentral Chi-Squared"</code></td><td width="5%"></td><td width="20%"><code>"ncx2"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Normal"</code></td><td width="5%"></td><td width="20%"><code>"norm"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Poisson"</code></td><td width="5%"></td><td width="20%"><code>"poiss"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Rayleigh"</code></td><td width="5%"></td><td width="20%"><code>"rayl"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Rician"</code></td><td width="5%"></td><td width="20%"><code>"rice"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Student T"</code></td><td width="5%"></td><td width="20%"><code>"t"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"location-scale T"</code></td><td width="5%"></td><td width="20%"><code>"tls"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Triangular"</code></td><td width="5%"></td><td width="20%"><code>"tri"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Discrete Uniform"</code></td><td width="5%"></td><td width="20%"><code>"unid"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Uniform"</code></td><td width="5%"></td><td width="20%"><code>"unif"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Von Mises"</code></td><td width="5%"></td><td width="20%"><code>"vm"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Weibull"</code></td><td width="5%"></td><td width="20%"><code>"wbl"</code></td><td width="5%"></td><td width="30%">2</td></tr> </table> -<p> A <code>UniformDistribution</code> object contains the following methods: - <code>cdf</code>, <code>icdf</code>, <code>iqr</code>, <code>mean</code>, <code>median</code>, - <code>pdf</code>, <code>plot</code>, <code>random</code>, <code>std</code>, <code>truncate</code>, - <code>var</code>. -</p> -<p> Further information about the continuous uniform distribution can be found - at <a href="https://en.wikipedia.org/wiki/Continuous_uniform_distribution">https://en.wikipedia.org/wiki/Continuous_uniform_distribution</a> -</p> <p> <strong>See also: </strong> - <a href="makedist.html">makedist</a>, + <a href="icdf.html">icdf</a>, + <a href="pdf.html">pdf</a>, + <a href="cdf.html">cdf</a>, + <a href="betacdf.html">betacdf</a>, + <a href="binocdf.html">binocdf</a>, + <a href="bisacdf.html">bisacdf</a>, + <a href="burrcdf.html">burrcdf</a>, + <a href="cauchycdf.html">cauchycdf</a>, + <a href="chi2cdf.html">chi2cdf</a>, + <a href="evcdf.html">evcdf</a>, + <a href="expcdf.html">expcdf</a>, + <a href="fcdf.html">fcdf</a>, + <a href="gamcdf.html">gamcdf</a>, + <a href="geocdf.html">geocdf</a>, + <a href="gevcdf.html">gevcdf</a>, + <a href="gpcdf.html">gpcdf</a>, + <a href="gumbelcdf.html">gumbelcdf</a>, + <a href="hncdf.html">hncdf</a>, + <a href="hygecdf.html">hygecdf</a>, + <a href="invgcdf.html">invgcdf</a>, + <a href="laplacecdf.html">laplacecdf</a>, + <a href="logicdf.html">logicdf</a>, + <a href="loglcdf.html">loglcdf</a>, + <a href="logncdf.html">logncdf</a>, + <a href="nakacdf.html">nakacdf</a>, + <a href="nbincdf.html">nbincdf</a>, + <a href="ncfcdf.html">ncfcdf</a>, + <a href="nctcdf.html">nctcdf</a>, + <a href="ncx2cdf.html">ncx2cdf</a>, + <a href="normcdf.html">normcdf</a>, + <a href="poisscdf.html">poisscdf</a>, + <a href="raylcdf.html">raylcdf</a>, + <a href="ricecdf.html">ricecdf</a>, + <a href="tcdf.html">tcdf</a>, + <a href="tlscdf.html">tlscdf</a>, + <a href="tricdf.html">tricdf</a>, + <a href="unidcdf.html">unidcdf</a>, <a href="unifcdf.html">unifcdf</a>, - <a href="unifinv.html">unifinv</a>, - <a href="unifpdf.html">unifpdf</a>, - <a href="unifrnd.html">unifrnd</a>, - <a href="unifit.html">unifit</a>, - <a href="unifstat.html">unifstat</a> + <a href="vmcdf.html">vmcdf</a>, + <a href="wblcdf.html">wblcdf</a> </p> <p><strong>Source Code: </strong> <a href="https://github.com/gnu-octave/statistics/tree/main/inst/dist_obj/UniformDistribution.m">UniformDistribution</a> @@ -135,38 +201,6 @@ <div class="row d-flex flex-wrap align-items-center"> <div class="col-sm-3 col-md-5 mb-2 mb-sm-0"> <h3 class="d-inline-block mr-2"> - Method: <b><code>cdf</code></b> - </h3> - </div> - </div> - </div> - <div class="card-body"> -<dl> -<dt><u>UniformDistribution:</u> <var>p</var> = <b>icdf</b><i> (<var>pd</var>, <var>p</var>)</i></dt> -</dl> - -<p> Compute the cumulative distribution function (CDF). -</p> -<div class="ms-5"> -<p> <code><var>p</var> = icdf (<var>pd</var>, <var>x</var>)</code> computes the quantile (the - inverse of the CDF) of the probability distribution object, <var>pd</var>, - evaluated at the values in <var>x</var>. -</p> - -</div> - - </div> - </div> - </div> - - - - <div class="container-xl my-4"> - <div class="card rounded"> - <div class="card-header card-header-mod"> - <div class="row d-flex flex-wrap align-items-center"> - <div class="col-sm-3 col-md-5 mb-2 mb-sm-0"> - <h3 class="d-inline-block mr-2"> Method: <b><code>icdf</code></b> </h3> </div> diff --git a/docs/WeibullDistribution.html b/docs/WeibullDistribution.html index 1dfaf1e..af0cc5b 100644 --- a/docs/WeibullDistribution.html +++ b/docs/WeibullDistribution.html @@ -71,67 +71,126 @@ </div> <div class="card-body"> <dl> -<dt><u>statistics:</u> WeibullDistribution</dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>, <var>C</var>)</i></dt> +<dt><u>statistics:</u> <var>p</var> = <b>cdf</b><i> (…, <code>"upper"</code>)</i></dt> </dl> -<p> Weibull probability distribution object. +<p> Return the CDF of a univariate distribution evaluated at <var>x</var>. </p> <div class="ms-5"> -<p> A <code>WeibullDistribution</code> object consists of parameters, a model - description, and sample data for a Weibull probability distribution. +<p> <code>cdf</code> is a wrapper for the univariate cumulative distribution functions + available in the statistics package. See the corresponding functions’ help + to learn the signification of the parameters after <var>x</var>. </p> -<p> The Weibull distribution uses the following parameters. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>)</code> returns the CDF for the + one-parameter distribution family specified by <var>name</var> and the + distribution parameter <var>A</var>, evaluated at the values in <var>x</var>. </p> - <table> -<thead><tr><th width="25%"><var>Parameter</var></th><th width="48%"><var>Description</var></th><th width="27%"><var>Support</var></th></tr></thead> -<tr><td width="25%"><code>lambda</code></td><td width="48%">Scale parameter</td><td width="27%"><math>lambda > 0</math></td></tr> -<tr><td width="25%"><code>k</code></td><td width="48%">Scale parameter</td><td width="27%"><math>k > 0</math></td></tr> -</table> - -<p> There are several ways to create a <code>WeibullDistribution</code> object. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>)</code> returns the CDF + for the two-parameter distribution family specified by <var>name</var> and the + distribution parameters <var>A</var> and <var>B</var>, evaluated at the values in + <var>x</var>. </p> - <ul> -<li> Fit a distribution to data using the <code>fitdist</code> function. - </li><li> Create a distribution with specified parameter values using the - <code>makedist</code> function. - </li><li> Use the constructor <code>WeibullDistribution (<var>lambda</var>, - <var>k</var>)</code> to create a Weibull distribution with specified parameter values. - </li><li> Use the static method <code>WeibullDistribution.fit (<var>x</var>, - <var>censor</var>, <var>freq</var>, <var>options</var>)</code> to a distribution to data <var>x</var>. - </li></ul> - -<p> It is highly recommended to use <code>fitdist</code> and <code>makedist</code> - functions to create probability distribution objects, instead of the - constructor and the aforementioned static method. +<p> <code><var>p</var> = cdf (<var>name</var>, <var>x</var>, <var>A</var>, <var>B</var>, <var>C</var>)</code> returns + the CDF for the three-parameter distribution family specified by <var>name</var> + and the distribution parameters <var>A</var>, <var>B</var>, and <var>C</var>, evaluated at + the values in <var>x</var>. +</p> +<p> <code><var>p</var> = cdf (…, <code>"upper"</code>)</code> returns the complement of the + CDF using an algorithm that more accurately computes the extreme upper-tail + probabilities. <code>"upper"</code> can follow any of the input arguments in the + previous syntaxes. </p> -<p> A <code>WeibullDistribution</code> object contains the following properties, - which can be accessed using dot notation. +<p> <var>name</var> must be a char string of the name or the abbreviation of the + desired cumulative distribution function as listed in the followng table. + The last column shows the number of required parameters that should be parsed + after <var>x</var> to the desired CDF. The optional input argument + <code>"upper"</code> does not count in the required number of parameters. </p> <table> -<tr><td width="25%"><code>DistributionName</code></td><td width="25%"><code>DistributionCode</code></td><td width="25%"><code>NumParameters</code></td><td width="25%"><code>ParameterNames</code></td></tr> -<tr><td width="25%"><code>ParameterDescription</code></td><td width="25%"><code>ParameterValues</code></td><td width="25%"><code>ParameterValues</code></td><td width="25%"><code>ParameterCI</code></td></tr> -<tr><td width="25%"><code>ParameterIsFixed</code></td><td width="25%"><code>Truncation</code></td><td width="25%"><code>IsTruncated</code></td><td width="25%"><code>InputData</code></td></tr> +<thead><tr><th width="40%">Distribution Name</th><th width="5%"></th><th width="20%">Abbreviation</th><th width="5%"></th><th width="30%">Input Parameters</th></tr></thead> +<tr><td width="40%"><code>"Beta"</code></td><td width="5%"></td><td width="20%"><code>"beta"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Binomial"</code></td><td width="5%"></td><td width="20%"><code>"bino"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Birnbaum-Saunders"</code></td><td width="5%"></td><td width="20%"><code>"bisa"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Burr"</code></td><td width="5%"></td><td width="20%"><code>"burr"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Cauchy"</code></td><td width="5%"></td><td width="20%"><code>"cauchy"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Chi-squared"</code></td><td width="5%"></td><td width="20%"><code>"chi2"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Extreme Value"</code></td><td width="5%"></td><td width="20%"><code>"ev"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Exponential"</code></td><td width="5%"></td><td width="20%"><code>"exp"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"F-Distribution"</code></td><td width="5%"></td><td width="20%"><code>"f"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Gamma"</code></td><td width="5%"></td><td width="20%"><code>"gam"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Geometric"</code></td><td width="5%"></td><td width="20%"><code>"geo"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Generalized Extreme Value"</code></td><td width="5%"></td><td width="20%"><code>"gev"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Generalized Pareto"</code></td><td width="5%"></td><td width="20%"><code>"gp"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Gumbel"</code></td><td width="5%"></td><td width="20%"><code>"gumbel"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Half-normal"</code></td><td width="5%"></td><td width="20%"><code>"hn"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Hypergeometric"</code></td><td width="5%"></td><td width="20%"><code>"hyge"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Inverse Gaussian"</code></td><td width="5%"></td><td width="20%"><code>"invg"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Laplace"</code></td><td width="5%"></td><td width="20%"><code>"laplace"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Logistic"</code></td><td width="5%"></td><td width="20%"><code>"logi"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Log-Logistic"</code></td><td width="5%"></td><td width="20%"><code>"logl"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Lognormal"</code></td><td width="5%"></td><td width="20%"><code>"logn"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Nakagami"</code></td><td width="5%"></td><td width="20%"><code>"naka"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Negative Binomial"</code></td><td width="5%"></td><td width="20%"><code>"nbin"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Noncentral F-Distribution"</code></td><td width="5%"></td><td width="20%"><code>"ncf"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Noncentral Student T"</code></td><td width="5%"></td><td width="20%"><code>"nct"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Noncentral Chi-Squared"</code></td><td width="5%"></td><td width="20%"><code>"ncx2"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Normal"</code></td><td width="5%"></td><td width="20%"><code>"norm"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Poisson"</code></td><td width="5%"></td><td width="20%"><code>"poiss"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Rayleigh"</code></td><td width="5%"></td><td width="20%"><code>"rayl"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Rician"</code></td><td width="5%"></td><td width="20%"><code>"rice"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Student T"</code></td><td width="5%"></td><td width="20%"><code>"t"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"location-scale T"</code></td><td width="5%"></td><td width="20%"><code>"tls"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Triangular"</code></td><td width="5%"></td><td width="20%"><code>"tri"</code></td><td width="5%"></td><td width="30%">3</td></tr> +<tr><td width="40%"><code>"Discrete Uniform"</code></td><td width="5%"></td><td width="20%"><code>"unid"</code></td><td width="5%"></td><td width="30%">1</td></tr> +<tr><td width="40%"><code>"Uniform"</code></td><td width="5%"></td><td width="20%"><code>"unif"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Von Mises"</code></td><td width="5%"></td><td width="20%"><code>"vm"</code></td><td width="5%"></td><td width="30%">2</td></tr> +<tr><td width="40%"><code>"Weibull"</code></td><td width="5%"></td><td width="20%"><code>"wbl"</code></td><td width="5%"></td><td width="30%">2</td></tr> </table> -<p> A <code>WeibullDistribution</code> object contains the following methods: - <code>cdf</code>, <code>icdf</code>, <code>iqr</code>, <code>mean</code>, <code>median</code>, - <code>negloglik</code>, <code>paramci</code>, <code>pdf</code>, <code>plot</code>, <code>proflik</code>, - <code>random</code>, <code>std</code>, <code>truncate</code>, <code>var</code>. -</p> -<p> Further information about the Weibull distribution can be found at - <a href="https://en.wikipedia.org/wiki/Weibull_distribution">https://en.wikipedia.org/wiki/Weibull_distribution</a> -</p> <p> <strong>See also: </strong> - <a href="fitdist.html">fitdist</a>, - <a href="makedist.html">makedist</a>, - <a href="wblcdf.html">wblcdf</a>, - <a href="wblinv.html">wblinv</a>, - <a href="wblpdf.html">wblpdf</a>, - <a href="wblrnd.html">wblrnd</a>, - <a href="wblfit.html">wblfit</a>, - <a href="wbllike.html">wbllike</a>, - <a href="wblstat.html">wblstat</a>, - <a href="wblplot.html">wblplot</a> + <a href="icdf.html">icdf</a>, + <a href="pdf.html">pdf</a>, + <a href="cdf.html">cdf</a>, + <a href="betacdf.html">betacdf</a>, + <a href="binocdf.html">binocdf</a>, + <a href="bisacdf.html">bisacdf</a>, + <a href="burrcdf.html">burrcdf</a>, + <a href="cauchycdf.html">cauchycdf</a>, + <a href="chi2cdf.html">chi2cdf</a>, + <a href="evcdf.html">evcdf</a>, + <a href="expcdf.html">expcdf</a>, + <a href="fcdf.html">fcdf</a>, + <a href="gamcdf.html">gamcdf</a>, + <a href="geocdf.html">geocdf</a>, + <a href="gevcdf.html">gevcdf</a>, + <a href="gpcdf.html">gpcdf</a>, + <a href="gumbelcdf.html">gumbelcdf</a>, + <a href="hncdf.html">hncdf</a>, + <a href="hygecdf.html">hygecdf</a>, + <a href="invgcdf.html">invgcdf</a>, + <a href="laplacecdf.html">laplacecdf</a>, + <a href="logicdf.html">logicdf</a>, + <a href="loglcdf.html">loglcdf</a>, + <a href="logncdf.html">logncdf</a>, + <a href="nakacdf.html">nakacdf</a>, + <a href="nbincdf.html">nbincdf</a>, + <a href="ncfcdf.html">ncfcdf</a>, + <a href="nctcdf.html">nctcdf</a>, + <a href="ncx2cdf.html">ncx2cdf</a>, + <a href="normcdf.html">normcdf</a>, + <a href="poisscdf.html">poisscdf</a>, + <a href="raylcdf.html">raylcdf</a>, + <a href="ricecdf.html">ricecdf</a>, + <a href="tcdf.html">tcdf</a>, + <a href="tlscdf.html">tlscdf</a>, + <a href="tricdf.html">tricdf</a>, + <a href="unidcdf.html">unidcdf</a>, + <a href="unifcdf.html">unifcdf</a>, + <a href="vmcdf.html">vmcdf</a>, + <a href="wblcdf.html">wblcdf</a> </p> <p><strong>Source Code: </strong> <a href="https://github.com/gnu-octave/statistics/tree/main/inst/dist_obj/WeibullDistribution.m">WeibullDistribution</a> @@ -142,39 +201,6 @@ <div class="row d-flex flex-wrap align-items-center"> <div class="col-sm-3 col-md-5 mb-2 mb-sm-0"> <h3 class="d-inline-block mr-2"> - Method: <b><code>cdf</code></b> - </h3> - </div> - </div> - </div> - <div class="card-body"> -<dl> -<dt><u>WeibullDistribution:</u> <var>p</var> = <b>icdf</b><i> (<var>pd</var>, <var>p</var>)</i></dt> -</dl> - -<p> Compute the cumulative distribution function (CDF). -</p> -<div class="ms-5"> -<p> <code><var>p</var> = icdf (<var>pd</var>, <var>x</var>)</code> computes the quantile (the - inverse of the CDF) of the probability distribution object, <var>pd</var>, - evaluated at the values in <var>x</var>. -</p> - -</div> - - </div> - </div> - </div> - - - - - <div class="container-xl my-4"> - <div class="card rounded"> - <div class="card-header card-header-mod"> - <div class="row d-flex flex-wrap align-items-center"> - <div class="col-sm-3 col-md-5 mb-2 mb-sm-0"> - <h3 class="d-inline-block mr-2"> Method: <b><code>icdf</code></b> </h3> </div> @@ -228,7 +254,6 @@ </div> </div> - <div class="container-xl my-4"> <div class="card rounded"> <div class="card-header card-header-mod"> diff --git a/docs/anovan.html b/docs/anovan.html index 7544e46..1fce594 100644 --- a/docs/anovan.html +++ b/docs/anovan.html @@ -846,7 +846,7 @@ ANOVA TABLE (Type II sums-of-squares): Source Sum Sq. d.f. Mean Sq. R Sq. F Prob>F -------------------------------------------------------------------------------- -strain 286.13 3 95.378 0.580 3.23 .091 +strain 286.13 3 95.377 0.580 3.23 .091 treatment 2275.3 1 2275.3 0.917 76.94 <.001 block' 1242.6 1 1242.6 0.857 42.02 <.001 strain*treatment 495.9 3 165.3 0.706 5.59 .028 diff --git a/docs/assets/ClassificationKNN_201.png b/docs/assets/ClassificationKNN_201.png Binary files differindex 54e7755..664c221 100644 --- a/docs/assets/ClassificationKNN_201.png +++ b/docs/assets/ClassificationKNN_201.png diff --git a/docs/assets/RegressionGAM_201.png b/docs/assets/RegressionGAM_201.png Binary files differindex 56c45eb..1dc7810 100644 --- a/docs/assets/RegressionGAM_201.png +++ b/docs/assets/RegressionGAM_201.png diff --git a/docs/assets/RegressionGAM_202.png b/docs/assets/RegressionGAM_202.png Binary files differindex bf9fe50..7181b88 100644 --- a/docs/assets/RegressionGAM_202.png +++ b/docs/assets/RegressionGAM_202.png diff --git a/docs/assets/anovan_1001.png b/docs/assets/anovan_1001.png Binary files differindex d6d9ce5..06845e1 100644 --- a/docs/assets/anovan_1001.png +++ b/docs/assets/anovan_1001.png diff --git a/docs/assets/anovan_101.png b/docs/assets/anovan_101.png Binary files differindex 69f9a49..02aa4a4 100644 --- a/docs/assets/anovan_101.png +++ b/docs/assets/anovan_101.png diff --git a/docs/assets/anovan_1101.png b/docs/assets/anovan_1101.png Binary files differindex 3a31251..99daf04 100644 --- a/docs/assets/anovan_1101.png +++ b/docs/assets/anovan_1101.png diff --git a/docs/assets/anovan_1201.png b/docs/assets/anovan_1201.png Binary files differindex 3faac2e..37883d2 100644 --- a/docs/assets/anovan_1201.png +++ b/docs/assets/anovan_1201.png diff --git a/docs/assets/anovan_1301.png b/docs/assets/anovan_1301.png Binary files differindex f69d8f4..23c6f3a 100644 --- a/docs/assets/anovan_1301.png +++ b/docs/assets/anovan_1301.png diff --git a/docs/assets/anovan_201.png b/docs/assets/anovan_201.png Binary files differindex 782d32c..a72737b 100644 --- a/docs/assets/anovan_201.png +++ b/docs/assets/anovan_201.png diff --git a/docs/assets/anovan_301.png b/docs/assets/anovan_301.png Binary files differindex a771a7f..e3698ea 100644 --- a/docs/assets/anovan_301.png +++ b/docs/assets/anovan_301.png diff --git a/docs/assets/anovan_401.png b/docs/assets/anovan_401.png Binary files differindex 7156345..74f661e 100644 --- a/docs/assets/anovan_401.png +++ b/docs/assets/anovan_401.png diff --git a/docs/assets/anovan_501.png b/docs/assets/anovan_501.png Binary files differindex 979a54f..128f2a5 100644 --- a/docs/assets/anovan_501.png +++ b/docs/assets/anovan_501.png diff --git a/docs/assets/anovan_601.png b/docs/assets/anovan_601.png Binary files differindex 8f549ab..344f122 100644 --- a/docs/assets/anovan_601.png +++ b/docs/assets/anovan_601.png diff --git a/docs/assets/anovan_701.png b/docs/assets/anovan_701.png Binary files differindex 1b8ba67..0289010 100644 --- a/docs/assets/anovan_701.png +++ b/docs/assets/anovan_701.png diff --git a/docs/assets/anovan_801.png b/docs/assets/anovan_801.png Binary files differindex 0c886ea..0a9e2fe 100644 --- a/docs/assets/anovan_801.png +++ b/docs/assets/anovan_801.png diff --git a/docs/assets/anovan_901.png b/docs/assets/anovan_901.png Binary files differindex 7fc80b7..67062db 100644 --- a/docs/assets/anovan_901.png +++ b/docs/assets/anovan_901.png diff --git a/docs/assets/betacdf_101.png b/docs/assets/betacdf_101.png Binary files differindex df7f4f1..34d2d77 100644 --- a/docs/assets/betacdf_101.png +++ b/docs/assets/betacdf_101.png diff --git a/docs/assets/betafit_101.png b/docs/assets/betafit_101.png Binary files differindex d6caea3..1f4c120 100644 --- a/docs/assets/betafit_101.png +++ b/docs/assets/betafit_101.png diff --git a/docs/assets/betainv_101.png b/docs/assets/betainv_101.png Binary files differindex 57493fc..0cc7f01 100644 --- a/docs/assets/betainv_101.png +++ b/docs/assets/betainv_101.png diff --git a/docs/assets/betapdf_101.png b/docs/assets/betapdf_101.png Binary files differindex 2affa5a..ac369d9 100644 --- a/docs/assets/betapdf_101.png +++ b/docs/assets/betapdf_101.png diff --git a/docs/assets/binocdf_101.png b/docs/assets/binocdf_101.png Binary files differindex ffa23ba..c65584d 100644 --- a/docs/assets/binocdf_101.png +++ b/docs/assets/binocdf_101.png diff --git a/docs/assets/binofit_101.png b/docs/assets/binofit_101.png Binary files differindex a414e61..d77b815 100644 --- a/docs/assets/binofit_101.png +++ b/docs/assets/binofit_101.png diff --git a/docs/assets/binoinv_101.png b/docs/assets/binoinv_101.png Binary files differindex a7ada15..398a5de 100644 --- a/docs/assets/binoinv_101.png +++ b/docs/assets/binoinv_101.png diff --git a/docs/assets/binopdf_101.png b/docs/assets/binopdf_101.png Binary files differindex 62b8f4a..a6bb417 100644 --- a/docs/assets/binopdf_101.png +++ b/docs/assets/binopdf_101.png diff --git a/docs/assets/bisacdf_101.png b/docs/assets/bisacdf_101.png Binary files differindex c96ca94..a66b674 100644 --- a/docs/assets/bisacdf_101.png +++ b/docs/assets/bisacdf_101.png diff --git a/docs/assets/bisacdf_201.png b/docs/assets/bisacdf_201.png Binary files differindex 54b452a..8b5c4d5 100644 --- a/docs/assets/bisacdf_201.png +++ b/docs/assets/bisacdf_201.png diff --git a/docs/assets/bisafit_101.png b/docs/assets/bisafit_101.png Binary files differindex a6b6bfc..6133559 100644 --- a/docs/assets/bisafit_101.png +++ b/docs/assets/bisafit_101.png diff --git a/docs/assets/bisainv_101.png b/docs/assets/bisainv_101.png Binary files differindex 328fd82..9c33928 100644 --- a/docs/assets/bisainv_101.png +++ b/docs/assets/bisainv_101.png diff --git a/docs/assets/bisainv_201.png b/docs/assets/bisainv_201.png Binary files differindex 85ee175..5708996 100644 --- a/docs/assets/bisainv_201.png +++ b/docs/assets/bisainv_201.png diff --git a/docs/assets/bisapdf_101.png b/docs/assets/bisapdf_101.png Binary files differindex 0fe7a99..7de30e8 100644 --- a/docs/assets/bisapdf_101.png +++ b/docs/assets/bisapdf_101.png diff --git a/docs/assets/bisapdf_201.png b/docs/assets/bisapdf_201.png Binary files differindex c187850..216a06f 100644 --- a/docs/assets/bisapdf_201.png +++ b/docs/assets/bisapdf_201.png diff --git a/docs/assets/burrcdf_101.png b/docs/assets/burrcdf_101.png Binary files differindex 3824db2..ccfa847 100644 --- a/docs/assets/burrcdf_101.png +++ b/docs/assets/burrcdf_101.png diff --git a/docs/assets/burrfit_101.png b/docs/assets/burrfit_101.png Binary files differindex 94e35ed..5d05ed3 100644 --- a/docs/assets/burrfit_101.png +++ b/docs/assets/burrfit_101.png diff --git a/docs/assets/burrinv_101.png b/docs/assets/burrinv_101.png Binary files differindex ca7ae86..fe09ea3 100644 --- a/docs/assets/burrinv_101.png +++ b/docs/assets/burrinv_101.png diff --git a/docs/assets/burrpdf_101.png b/docs/assets/burrpdf_101.png Binary files differindex 19f1a31..4a5bea8 100644 --- a/docs/assets/burrpdf_101.png +++ b/docs/assets/burrpdf_101.png diff --git a/docs/assets/cauchycdf_101.png b/docs/assets/cauchycdf_101.png Binary files differindex f034236..dab8ea7 100644 --- a/docs/assets/cauchycdf_101.png +++ b/docs/assets/cauchycdf_101.png diff --git a/docs/assets/cauchyinv_101.png b/docs/assets/cauchyinv_101.png Binary files differindex e0422b0..a7c5bce 100644 --- a/docs/assets/cauchyinv_101.png +++ b/docs/assets/cauchyinv_101.png diff --git a/docs/assets/cauchypdf_101.png b/docs/assets/cauchypdf_101.png Binary files differindex 020f739..470c9a9 100644 --- a/docs/assets/cauchypdf_101.png +++ b/docs/assets/cauchypdf_101.png diff --git a/docs/assets/chi2cdf_101.png b/docs/assets/chi2cdf_101.png Binary files differindex 7a094e3..ad118fa 100644 --- a/docs/assets/chi2cdf_101.png +++ b/docs/assets/chi2cdf_101.png diff --git a/docs/assets/chi2inv_101.png b/docs/assets/chi2inv_101.png Binary files differindex ae666b6..1d0fa58 100644 --- a/docs/assets/chi2inv_101.png +++ b/docs/assets/chi2inv_101.png diff --git a/docs/assets/chi2pdf_101.png b/docs/assets/chi2pdf_101.png Binary files differindex 770a70f..16c4720 100644 --- a/docs/assets/chi2pdf_101.png +++ b/docs/assets/chi2pdf_101.png diff --git a/docs/assets/confusionchart_501.png b/docs/assets/confusionchart_501.png Binary files differindex 7682fe6..b2b40fa 100644 --- a/docs/assets/confusionchart_501.png +++ b/docs/assets/confusionchart_501.png diff --git a/docs/assets/dcov_101.png b/docs/assets/dcov_101.png Binary files differindex f263c72..e5793af 100644 --- a/docs/assets/dcov_101.png +++ b/docs/assets/dcov_101.png diff --git a/docs/assets/dendrogram_301.png b/docs/assets/dendrogram_301.png Binary files differindex b721163..01f8cae 100644 --- a/docs/assets/dendrogram_301.png +++ b/docs/assets/dendrogram_301.png diff --git a/docs/assets/dendrogram_401.png b/docs/assets/dendrogram_401.png Binary files differindex 1cb21b2..d8e98bb 100644 --- a/docs/assets/dendrogram_401.png +++ b/docs/assets/dendrogram_401.png diff --git a/docs/assets/ecdf_201.png b/docs/assets/ecdf_201.png Binary files differindex d576af8..bf30e19 100644 --- a/docs/assets/ecdf_201.png +++ b/docs/assets/ecdf_201.png diff --git a/docs/assets/einstein_201.png b/docs/assets/einstein_201.png Binary files differindex 8c29daa..44bc473 100644 --- a/docs/assets/einstein_201.png +++ b/docs/assets/einstein_201.png diff --git a/docs/assets/evcdf_101.png b/docs/assets/evcdf_101.png Binary files differindex 5063f5e..514c091 100644 --- a/docs/assets/evcdf_101.png +++ b/docs/assets/evcdf_101.png diff --git a/docs/assets/evfit_101.png b/docs/assets/evfit_101.png Binary files differindex 97c434a..e4b9b05 100644 --- a/docs/assets/evfit_101.png +++ b/docs/assets/evfit_101.png diff --git a/docs/assets/evinv_101.png b/docs/assets/evinv_101.png Binary files differindex 14c2e1c..57fe21b 100644 --- a/docs/assets/evinv_101.png +++ b/docs/assets/evinv_101.png diff --git a/docs/assets/evpdf_101.png b/docs/assets/evpdf_101.png Binary files differindex a0799c5..356e0ad 100644 --- a/docs/assets/evpdf_101.png +++ b/docs/assets/evpdf_101.png diff --git a/docs/assets/expcdf_101.png b/docs/assets/expcdf_101.png Binary files differindex 1eb5d69..634db9f 100644 --- a/docs/assets/expcdf_101.png +++ b/docs/assets/expcdf_101.png diff --git a/docs/assets/expfit_101.png b/docs/assets/expfit_101.png Binary files differindex b95032e..ccdf5b7 100644 --- a/docs/assets/expfit_101.png +++ b/docs/assets/expfit_101.png diff --git a/docs/assets/expinv_101.png b/docs/assets/expinv_101.png Binary files differindex 52007e4..1cf1ac8 100644 --- a/docs/assets/expinv_101.png +++ b/docs/assets/expinv_101.png diff --git a/docs/assets/exppdf_101.png b/docs/assets/exppdf_101.png Binary files differindex 96947f9..e95ac76 100644 --- a/docs/assets/exppdf_101.png +++ b/docs/assets/exppdf_101.png diff --git a/docs/assets/fcdf_101.png b/docs/assets/fcdf_101.png Binary files differindex 8c04b7e..4960a74 100644 --- a/docs/assets/fcdf_101.png +++ b/docs/assets/fcdf_101.png diff --git a/docs/assets/finv_101.png b/docs/assets/finv_101.png Binary files differindex d7f7e68..00e0f3d 100644 --- a/docs/assets/finv_101.png +++ b/docs/assets/finv_101.png diff --git a/docs/assets/fitlm_101.png b/docs/assets/fitlm_101.png Binary files differindex 3faac2e..37883d2 100644 --- a/docs/assets/fitlm_101.png +++ b/docs/assets/fitlm_101.png diff --git a/docs/assets/fitlm_201.png b/docs/assets/fitlm_201.png Binary files differindex 7761e33..cbff485 100644 --- a/docs/assets/fitlm_201.png +++ b/docs/assets/fitlm_201.png diff --git a/docs/assets/fpdf_101.png b/docs/assets/fpdf_101.png Binary files differindex 5478d0e..7dea28b 100644 --- a/docs/assets/fpdf_101.png +++ b/docs/assets/fpdf_101.png diff --git a/docs/assets/gamcdf_101.png b/docs/assets/gamcdf_101.png Binary files differindex 5dd4258..e5a1b69 100644 --- a/docs/assets/gamcdf_101.png +++ b/docs/assets/gamcdf_101.png diff --git a/docs/assets/gamfit_101.png b/docs/assets/gamfit_101.png Binary files differindex 20474c5..748a3d8 100644 --- a/docs/assets/gamfit_101.png +++ b/docs/assets/gamfit_101.png diff --git a/docs/assets/gaminv_101.png b/docs/assets/gaminv_101.png Binary files differindex 655259a..dc2b5d5 100644 --- a/docs/assets/gaminv_101.png +++ b/docs/assets/gaminv_101.png diff --git a/docs/assets/gampdf_101.png b/docs/assets/gampdf_101.png Binary files differindex ae98151..1aa615b 100644 --- a/docs/assets/gampdf_101.png +++ b/docs/assets/gampdf_101.png diff --git a/docs/assets/geocdf_101.png b/docs/assets/geocdf_101.png Binary files differindex d524c95..223f332 100644 --- a/docs/assets/geocdf_101.png +++ b/docs/assets/geocdf_101.png diff --git a/docs/assets/geofit_101.png b/docs/assets/geofit_101.png Binary files differindex 6cad492..4605c7b 100644 --- a/docs/assets/geofit_101.png +++ b/docs/assets/geofit_101.png diff --git a/docs/assets/geoinv_101.png b/docs/assets/geoinv_101.png Binary files differindex 7f5d633..647abdb 100644 --- a/docs/assets/geoinv_101.png +++ b/docs/assets/geoinv_101.png diff --git a/docs/assets/geopdf_101.png b/docs/assets/geopdf_101.png Binary files differindex 6ee2e65..659103a 100644 --- a/docs/assets/geopdf_101.png +++ b/docs/assets/geopdf_101.png diff --git a/docs/assets/gevcdf_101.png b/docs/assets/gevcdf_101.png Binary files differindex 59d9976..cf64ecb 100644 --- a/docs/assets/gevcdf_101.png +++ b/docs/assets/gevcdf_101.png diff --git a/docs/assets/gevfit_101.png b/docs/assets/gevfit_101.png Binary files differindex 3fa84c4..0e0ee08 100644 --- a/docs/assets/gevfit_101.png +++ b/docs/assets/gevfit_101.png diff --git a/docs/assets/gevinv_101.png b/docs/assets/gevinv_101.png Binary files differindex 02d83e7..d9ae2c1 100644 --- a/docs/assets/gevinv_101.png +++ b/docs/assets/gevinv_101.png diff --git a/docs/assets/gevpdf_101.png b/docs/assets/gevpdf_101.png Binary files differindex e2b4637..31b0db1 100644 --- a/docs/assets/gevpdf_101.png +++ b/docs/assets/gevpdf_101.png diff --git a/docs/assets/gpcdf_101.png b/docs/assets/gpcdf_101.png Binary files differindex 25227b4..17974f0 100644 --- a/docs/assets/gpcdf_101.png +++ b/docs/assets/gpcdf_101.png diff --git a/docs/assets/gpfit_101.png b/docs/assets/gpfit_101.png Binary files differindex 26e3b25..f93ded4 100644 --- a/docs/assets/gpfit_101.png +++ b/docs/assets/gpfit_101.png diff --git a/docs/assets/gpinv_101.png b/docs/assets/gpinv_101.png Binary files differindex 80eb621..64e918a 100644 --- a/docs/assets/gpinv_101.png +++ b/docs/assets/gpinv_101.png diff --git a/docs/assets/gppdf_101.png b/docs/assets/gppdf_101.png Binary files differindex 72c04b2..c101826 100644 --- a/docs/assets/gppdf_101.png +++ b/docs/assets/gppdf_101.png diff --git a/docs/assets/gscatter_101.png b/docs/assets/gscatter_101.png Binary files differindex cef8ef6..a64386a 100644 --- a/docs/assets/gscatter_101.png +++ b/docs/assets/gscatter_101.png diff --git a/docs/assets/gumbelcdf_101.png b/docs/assets/gumbelcdf_101.png Binary files differindex 877b365..140a044 100644 --- a/docs/assets/gumbelcdf_101.png +++ b/docs/assets/gumbelcdf_101.png diff --git a/docs/assets/gumbelfit_101.png b/docs/assets/gumbelfit_101.png Binary files differindex c0fad79..913a88e 100644 --- a/docs/assets/gumbelfit_101.png +++ b/docs/assets/gumbelfit_101.png diff --git a/docs/assets/gumbelinv_101.png b/docs/assets/gumbelinv_101.png Binary files differindex c4d15b3..d7e658d 100644 --- a/docs/assets/gumbelinv_101.png +++ b/docs/assets/gumbelinv_101.png diff --git a/docs/assets/gumbelpdf_101.png b/docs/assets/gumbelpdf_101.png Binary files differindex 9ce6240..3d02ea4 100644 --- a/docs/assets/gumbelpdf_101.png +++ b/docs/assets/gumbelpdf_101.png diff --git a/docs/assets/histfit_101.png b/docs/assets/histfit_101.png Binary files differindex f5eac16..46d6a6b 100644 --- a/docs/assets/histfit_101.png +++ b/docs/assets/histfit_101.png diff --git a/docs/assets/histfit_201.png b/docs/assets/histfit_201.png Binary files differnew file mode 100644 index 0000000..9c7ed74 --- /dev/null +++ b/docs/assets/histfit_201.png diff --git a/docs/assets/histfit_301.png b/docs/assets/histfit_301.png Binary files differnew file mode 100644 index 0000000..f8dd675 --- /dev/null +++ b/docs/assets/histfit_301.png diff --git a/docs/assets/hncdf_101.png b/docs/assets/hncdf_101.png Binary files differindex c5be9a2..d689448 100644 --- a/docs/assets/hncdf_101.png +++ b/docs/assets/hncdf_101.png diff --git a/docs/assets/hncdf_201.png b/docs/assets/hncdf_201.png Binary files differindex bdfc97f..e0c8f22 100644 --- a/docs/assets/hncdf_201.png +++ b/docs/assets/hncdf_201.png diff --git a/docs/assets/hnfit_101.png b/docs/assets/hnfit_101.png Binary files differindex b1690a1..a1b1e10 100644 --- a/docs/assets/hnfit_101.png +++ b/docs/assets/hnfit_101.png diff --git a/docs/assets/hninv_101.png b/docs/assets/hninv_101.png Binary files differindex b32621f..4fd88fc 100644 --- a/docs/assets/hninv_101.png +++ b/docs/assets/hninv_101.png diff --git a/docs/assets/hnpdf_101.png b/docs/assets/hnpdf_101.png Binary files differindex 6942357..8b1c413 100644 --- a/docs/assets/hnpdf_101.png +++ b/docs/assets/hnpdf_101.png diff --git a/docs/assets/hnpdf_201.png b/docs/assets/hnpdf_201.png Binary files differindex 48ab039..7f518f5 100644 --- a/docs/assets/hnpdf_201.png +++ b/docs/assets/hnpdf_201.png diff --git a/docs/assets/hygecdf_101.png b/docs/assets/hygecdf_101.png Binary files differindex a955502..408de1f 100644 --- a/docs/assets/hygecdf_101.png +++ b/docs/assets/hygecdf_101.png diff --git a/docs/assets/hygeinv_101.png b/docs/assets/hygeinv_101.png Binary files differindex 9c76772..103dae2 100644 --- a/docs/assets/hygeinv_101.png +++ b/docs/assets/hygeinv_101.png diff --git a/docs/assets/hygepdf_101.png b/docs/assets/hygepdf_101.png Binary files differindex c532057..fe1127c 100644 --- a/docs/assets/hygepdf_101.png +++ b/docs/assets/hygepdf_101.png diff --git a/docs/assets/invgcdf_101.png b/docs/assets/invgcdf_101.png Binary files differindex e746a6c..dcf7279 100644 --- a/docs/assets/invgcdf_101.png +++ b/docs/assets/invgcdf_101.png diff --git a/docs/assets/invgfit_101.png b/docs/assets/invgfit_101.png Binary files differindex 40b9326..a262f6e 100644 --- a/docs/assets/invgfit_101.png +++ b/docs/assets/invgfit_101.png diff --git a/docs/assets/invginv_101.png b/docs/assets/invginv_101.png Binary files differindex 4e900b7..62e3c43 100644 --- a/docs/assets/invginv_101.png +++ b/docs/assets/invginv_101.png diff --git a/docs/assets/invgpdf_101.png b/docs/assets/invgpdf_101.png Binary files differindex 76b8642..af41158 100644 --- a/docs/assets/invgpdf_101.png +++ b/docs/assets/invgpdf_101.png diff --git a/docs/assets/isoutlier_201.png b/docs/assets/isoutlier_201.png Binary files differindex 4450ca3..88d881c 100644 --- a/docs/assets/isoutlier_201.png +++ b/docs/assets/isoutlier_201.png diff --git a/docs/assets/isoutlier_301.png b/docs/assets/isoutlier_301.png Binary files differindex eb3ddcc..6633f7f 100644 --- a/docs/assets/isoutlier_301.png +++ b/docs/assets/isoutlier_301.png diff --git a/docs/assets/jackknife_201.png b/docs/assets/jackknife_201.png Binary files differindex c483d8b..3b86236 100644 --- a/docs/assets/jackknife_201.png +++ b/docs/assets/jackknife_201.png diff --git a/docs/assets/kmeans_201.png b/docs/assets/kmeans_201.png Binary files differindex ef986dc..958247b 100644 --- a/docs/assets/kmeans_201.png +++ b/docs/assets/kmeans_201.png diff --git a/docs/assets/kmeans_301.png b/docs/assets/kmeans_301.png Binary files differindex 45e4a11..c2fdf28 100644 --- a/docs/assets/kmeans_301.png +++ b/docs/assets/kmeans_301.png diff --git a/docs/assets/kmeans_401.png b/docs/assets/kmeans_401.png Binary files differindex f622182..999f193 100644 --- a/docs/assets/kmeans_401.png +++ b/docs/assets/kmeans_401.png diff --git a/docs/assets/knnsearch_101.png b/docs/assets/knnsearch_101.png Binary files differindex d1f874b..26476ae 100644 --- a/docs/assets/knnsearch_101.png +++ b/docs/assets/knnsearch_101.png diff --git a/docs/assets/knnsearch_201.png b/docs/assets/knnsearch_201.png Binary files differindex 1d89131..5d6ffc9 100644 --- a/docs/assets/knnsearch_201.png +++ b/docs/assets/knnsearch_201.png diff --git a/docs/assets/laplacecdf_101.png b/docs/assets/laplacecdf_101.png Binary files differindex 60529d1..d73c4e5 100644 --- a/docs/assets/laplacecdf_101.png +++ b/docs/assets/laplacecdf_101.png diff --git a/docs/assets/laplaceinv_101.png b/docs/assets/laplaceinv_101.png Binary files differindex a1a157f..65310dd 100644 --- a/docs/assets/laplaceinv_101.png +++ b/docs/assets/laplaceinv_101.png diff --git a/docs/assets/laplacepdf_101.png b/docs/assets/laplacepdf_101.png Binary files differindex 382fdf2..0c26070 100644 --- a/docs/assets/laplacepdf_101.png +++ b/docs/assets/laplacepdf_101.png diff --git a/docs/assets/logicdf_101.png b/docs/assets/logicdf_101.png Binary files differindex 3211283..08dcd67 100644 --- a/docs/assets/logicdf_101.png +++ b/docs/assets/logicdf_101.png diff --git a/docs/assets/logifit_101.png b/docs/assets/logifit_101.png Binary files differindex 4c450db..88d0a60 100644 --- a/docs/assets/logifit_101.png +++ b/docs/assets/logifit_101.png diff --git a/docs/assets/logiinv_101.png b/docs/assets/logiinv_101.png Binary files differindex 938e885..1af0cbb 100644 --- a/docs/assets/logiinv_101.png +++ b/docs/assets/logiinv_101.png diff --git a/docs/assets/logipdf_101.png b/docs/assets/logipdf_101.png Binary files differindex e472f5a..9b9362c 100644 --- a/docs/assets/logipdf_101.png +++ b/docs/assets/logipdf_101.png diff --git a/docs/assets/loglcdf_101.png b/docs/assets/loglcdf_101.png Binary files differindex c4a3a34..f07e6e8 100644 --- a/docs/assets/loglcdf_101.png +++ b/docs/assets/loglcdf_101.png diff --git a/docs/assets/loglfit_101.png b/docs/assets/loglfit_101.png Binary files differindex e1ba0d0..5e4f23c 100644 --- a/docs/assets/loglfit_101.png +++ b/docs/assets/loglfit_101.png diff --git a/docs/assets/loglinv_101.png b/docs/assets/loglinv_101.png Binary files differindex 5bb151f..0856ed5 100644 --- a/docs/assets/loglinv_101.png +++ b/docs/assets/loglinv_101.png diff --git a/docs/assets/loglpdf_101.png b/docs/assets/loglpdf_101.png Binary files differindex 261e0f1..c734a4d 100644 --- a/docs/assets/loglpdf_101.png +++ b/docs/assets/loglpdf_101.png diff --git a/docs/assets/logncdf_101.png b/docs/assets/logncdf_101.png Binary files differindex e2dade5..cb26546 100644 --- a/docs/assets/logncdf_101.png +++ b/docs/assets/logncdf_101.png diff --git a/docs/assets/lognfit_101.png b/docs/assets/lognfit_101.png Binary files differindex 24de836..c31613f 100644 --- a/docs/assets/lognfit_101.png +++ b/docs/assets/lognfit_101.png diff --git a/docs/assets/logninv_101.png b/docs/assets/logninv_101.png Binary files differindex 1604dfa..842977b 100644 --- a/docs/assets/logninv_101.png +++ b/docs/assets/logninv_101.png diff --git a/docs/assets/lognpdf_101.png b/docs/assets/lognpdf_101.png Binary files differindex 8c837e2..7322aa6 100644 --- a/docs/assets/lognpdf_101.png +++ b/docs/assets/lognpdf_101.png diff --git a/docs/assets/nakacdf_101.png b/docs/assets/nakacdf_101.png Binary files differindex e9dfa1d..0e0eead 100644 --- a/docs/assets/nakacdf_101.png +++ b/docs/assets/nakacdf_101.png diff --git a/docs/assets/nakafit_101.png b/docs/assets/nakafit_101.png Binary files differindex 66254a9..4a75468 100644 --- a/docs/assets/nakafit_101.png +++ b/docs/assets/nakafit_101.png diff --git a/docs/assets/nakainv_101.png b/docs/assets/nakainv_101.png Binary files differindex 6723836..a49db3f 100644 --- a/docs/assets/nakainv_101.png +++ b/docs/assets/nakainv_101.png diff --git a/docs/assets/nakapdf_101.png b/docs/assets/nakapdf_101.png Binary files differindex d54f809..945d0c4 100644 --- a/docs/assets/nakapdf_101.png +++ b/docs/assets/nakapdf_101.png diff --git a/docs/assets/nbincdf_101.png b/docs/assets/nbincdf_101.png Binary files differindex b92d5b7..b287acd 100644 --- a/docs/assets/nbincdf_101.png +++ b/docs/assets/nbincdf_101.png diff --git a/docs/assets/nbinfit_101.png b/docs/assets/nbinfit_101.png Binary files differindex 7333465..659c5a4 100644 --- a/docs/assets/nbinfit_101.png +++ b/docs/assets/nbinfit_101.png diff --git a/docs/assets/nbininv_101.png b/docs/assets/nbininv_101.png Binary files differindex c27db1e..037777d 100644 --- a/docs/assets/nbininv_101.png +++ b/docs/assets/nbininv_101.png diff --git a/docs/assets/nbinpdf_101.png b/docs/assets/nbinpdf_101.png Binary files differindex b2e6d5c..2498fb9 100644 --- a/docs/assets/nbinpdf_101.png +++ b/docs/assets/nbinpdf_101.png diff --git a/docs/assets/ncfcdf_101.png b/docs/assets/ncfcdf_101.png Binary files differindex 42df5f9..0974af3 100644 --- a/docs/assets/ncfcdf_101.png +++ b/docs/assets/ncfcdf_101.png diff --git a/docs/assets/ncfcdf_201.png b/docs/assets/ncfcdf_201.png Binary files differindex e4330de..4c3b82c 100644 --- a/docs/assets/ncfcdf_201.png +++ b/docs/assets/ncfcdf_201.png diff --git a/docs/assets/ncfinv_101.png b/docs/assets/ncfinv_101.png Binary files differindex 7206531..08ff1ce 100644 --- a/docs/assets/ncfinv_101.png +++ b/docs/assets/ncfinv_101.png diff --git a/docs/assets/ncfinv_201.png b/docs/assets/ncfinv_201.png Binary files differindex 6d08502..3186d65 100644 --- a/docs/assets/ncfinv_201.png +++ b/docs/assets/ncfinv_201.png diff --git a/docs/assets/ncfpdf_101.png b/docs/assets/ncfpdf_101.png Binary files differindex dfd4e58..b822dcc 100644 --- a/docs/assets/ncfpdf_101.png +++ b/docs/assets/ncfpdf_101.png diff --git a/docs/assets/ncfpdf_201.png b/docs/assets/ncfpdf_201.png Binary files differindex cbd284a..c4568cf 100644 --- a/docs/assets/ncfpdf_201.png +++ b/docs/assets/ncfpdf_201.png diff --git a/docs/assets/nctcdf_101.png b/docs/assets/nctcdf_101.png Binary files differindex 5b319d0..6f26950 100644 --- a/docs/assets/nctcdf_101.png +++ b/docs/assets/nctcdf_101.png diff --git a/docs/assets/nctcdf_201.png b/docs/assets/nctcdf_201.png Binary files differindex 72595f4..1083183 100644 --- a/docs/assets/nctcdf_201.png +++ b/docs/assets/nctcdf_201.png diff --git a/docs/assets/nctinv_101.png b/docs/assets/nctinv_101.png Binary files differindex f9834cd..aa47830 100644 --- a/docs/assets/nctinv_101.png +++ b/docs/assets/nctinv_101.png diff --git a/docs/assets/nctinv_201.png b/docs/assets/nctinv_201.png Binary files differindex f14950b..ff01d02 100644 --- a/docs/assets/nctinv_201.png +++ b/docs/assets/nctinv_201.png diff --git a/docs/assets/nctpdf_101.png b/docs/assets/nctpdf_101.png Binary files differindex 6848755..0c7ca2b 100644 --- a/docs/assets/nctpdf_101.png +++ b/docs/assets/nctpdf_101.png diff --git a/docs/assets/nctpdf_201.png b/docs/assets/nctpdf_201.png Binary files differindex 92f6f3d..59fbb52 100644 --- a/docs/assets/nctpdf_201.png +++ b/docs/assets/nctpdf_201.png diff --git a/docs/assets/ncx2cdf_101.png b/docs/assets/ncx2cdf_101.png Binary files differindex dfa524e..e822c83 100644 --- a/docs/assets/ncx2cdf_101.png +++ b/docs/assets/ncx2cdf_101.png diff --git a/docs/assets/ncx2cdf_201.png b/docs/assets/ncx2cdf_201.png Binary files differindex 93372c7..e644b92 100644 --- a/docs/assets/ncx2cdf_201.png +++ b/docs/assets/ncx2cdf_201.png diff --git a/docs/assets/ncx2inv_101.png b/docs/assets/ncx2inv_101.png Binary files differindex 2fe793b..a207a2a 100644 --- a/docs/assets/ncx2inv_101.png +++ b/docs/assets/ncx2inv_101.png diff --git a/docs/assets/ncx2inv_201.png b/docs/assets/ncx2inv_201.png Binary files differindex af70013..5c45af3 100644 --- a/docs/assets/ncx2inv_201.png +++ b/docs/assets/ncx2inv_201.png diff --git a/docs/assets/ncx2pdf_101.png b/docs/assets/ncx2pdf_101.png Binary files differindex 7c81678..92b3399 100644 --- a/docs/assets/ncx2pdf_101.png +++ b/docs/assets/ncx2pdf_101.png diff --git a/docs/assets/ncx2pdf_201.png b/docs/assets/ncx2pdf_201.png Binary files differindex b583449..723682a 100644 --- a/docs/assets/ncx2pdf_201.png +++ b/docs/assets/ncx2pdf_201.png diff --git a/docs/assets/normcdf_101.png b/docs/assets/normcdf_101.png Binary files differindex 0e3516a..a5e6a10 100644 --- a/docs/assets/normcdf_101.png +++ b/docs/assets/normcdf_101.png diff --git a/docs/assets/normfit_101.png b/docs/assets/normfit_101.png Binary files differindex 50b5cbc..26f80d2 100644 --- a/docs/assets/normfit_101.png +++ b/docs/assets/normfit_101.png diff --git a/docs/assets/norminv_101.png b/docs/assets/norminv_101.png Binary files differindex fab19cf..02cf161 100644 --- a/docs/assets/norminv_101.png +++ b/docs/assets/norminv_101.png diff --git a/docs/assets/normpdf_101.png b/docs/assets/normpdf_101.png Binary files differindex d88b99d..0da5071 100644 --- a/docs/assets/normpdf_101.png +++ b/docs/assets/normpdf_101.png diff --git a/docs/assets/plcdf_101.png b/docs/assets/plcdf_101.png Binary files differindex e93db82..4d82201 100644 --- a/docs/assets/plcdf_101.png +++ b/docs/assets/plcdf_101.png diff --git a/docs/assets/plinv_101.png b/docs/assets/plinv_101.png Binary files differindex 3a15f80..e6f2c3b 100644 --- a/docs/assets/plinv_101.png +++ b/docs/assets/plinv_101.png diff --git a/docs/assets/plpdf_101.png b/docs/assets/plpdf_101.png Binary files differindex 40140d7..0675baa 100644 --- a/docs/assets/plpdf_101.png +++ b/docs/assets/plpdf_101.png diff --git a/docs/assets/poisscdf_101.png b/docs/assets/poisscdf_101.png Binary files differindex 24a05d3..d7adc7f 100644 --- a/docs/assets/poisscdf_101.png +++ b/docs/assets/poisscdf_101.png diff --git a/docs/assets/poissfit_101.png b/docs/assets/poissfit_101.png Binary files differindex 06e0715..15309db 100644 --- a/docs/assets/poissfit_101.png +++ b/docs/assets/poissfit_101.png diff --git a/docs/assets/poissinv_101.png b/docs/assets/poissinv_101.png Binary files differindex 29fee1d..77c074c 100644 --- a/docs/assets/poissinv_101.png +++ b/docs/assets/poissinv_101.png diff --git a/docs/assets/poisspdf_101.png b/docs/assets/poisspdf_101.png Binary files differindex 73af165..67db535 100644 --- a/docs/assets/poisspdf_101.png +++ b/docs/assets/poisspdf_101.png diff --git a/docs/assets/procrustes_201.png b/docs/assets/procrustes_201.png Binary files differindex 18ba20e..7f59dd1 100644 --- a/docs/assets/procrustes_201.png +++ b/docs/assets/procrustes_201.png diff --git a/docs/assets/procrustes_301.png b/docs/assets/procrustes_301.png Binary files differindex 3b28cc4..403397e 100644 --- a/docs/assets/procrustes_301.png +++ b/docs/assets/procrustes_301.png diff --git a/docs/assets/procrustes_302.png b/docs/assets/procrustes_302.png Binary files differindex a63ea77..4c73e85 100644 --- a/docs/assets/procrustes_302.png +++ b/docs/assets/procrustes_302.png diff --git a/docs/assets/procrustes_401.png b/docs/assets/procrustes_401.png Binary files differindex d360674..cbc0840 100644 --- a/docs/assets/procrustes_401.png +++ b/docs/assets/procrustes_401.png diff --git a/docs/assets/raylcdf_101.png b/docs/assets/raylcdf_101.png Binary files differindex 957365e..311e076 100644 --- a/docs/assets/raylcdf_101.png +++ b/docs/assets/raylcdf_101.png diff --git a/docs/assets/raylfit_101.png b/docs/assets/raylfit_101.png Binary files differindex b42160e..13d4658 100644 --- a/docs/assets/raylfit_101.png +++ b/docs/assets/raylfit_101.png diff --git a/docs/assets/raylinv_101.png b/docs/assets/raylinv_101.png Binary files differindex 220367e..c9baaae 100644 --- a/docs/assets/raylinv_101.png +++ b/docs/assets/raylinv_101.png diff --git a/docs/assets/raylpdf_101.png b/docs/assets/raylpdf_101.png Binary files differindex fa1f0be..44be7c3 100644 --- a/docs/assets/raylpdf_101.png +++ b/docs/assets/raylpdf_101.png diff --git a/docs/assets/regress_gp_301.png b/docs/assets/regress_gp_301.png Binary files differindex 5ddbf59..691f6f9 100644 --- a/docs/assets/regress_gp_301.png +++ b/docs/assets/regress_gp_301.png diff --git a/docs/assets/regress_gp_401.png b/docs/assets/regress_gp_401.png Binary files differindex e29c0c8..ab1afa0 100644 --- a/docs/assets/regress_gp_401.png +++ b/docs/assets/regress_gp_401.png diff --git a/docs/assets/regress_gp_501.png b/docs/assets/regress_gp_501.png Binary files differindex e0f8b7f..8aac63b 100644 --- a/docs/assets/regress_gp_501.png +++ b/docs/assets/regress_gp_501.png diff --git a/docs/assets/regress_gp_601.png b/docs/assets/regress_gp_601.png Binary files differindex af4f8e0..7484f79 100644 --- a/docs/assets/regress_gp_601.png +++ b/docs/assets/regress_gp_601.png diff --git a/docs/assets/regress_gp_602.png b/docs/assets/regress_gp_602.png Binary files differindex 85c90dd..f0202fd 100644 --- a/docs/assets/regress_gp_602.png +++ b/docs/assets/regress_gp_602.png diff --git a/docs/assets/regress_gp_603.png b/docs/assets/regress_gp_603.png Binary files differindex 74cfe99..75e46ef 100644 --- a/docs/assets/regress_gp_603.png +++ b/docs/assets/regress_gp_603.png diff --git a/docs/assets/regress_gp_604.png b/docs/assets/regress_gp_604.png Binary files differindex e38322a..3c9c4f9 100644 --- a/docs/assets/regress_gp_604.png +++ b/docs/assets/regress_gp_604.png diff --git a/docs/assets/regress_gp_701.png b/docs/assets/regress_gp_701.png Binary files differindex 53a4b6f..7ca85df 100644 --- a/docs/assets/regress_gp_701.png +++ b/docs/assets/regress_gp_701.png diff --git a/docs/assets/regress_gp_801.png b/docs/assets/regress_gp_801.png Binary files differindex 08d5167..734e1aa 100644 --- a/docs/assets/regress_gp_801.png +++ b/docs/assets/regress_gp_801.png diff --git a/docs/assets/ricecdf_101.png b/docs/assets/ricecdf_101.png Binary files differindex b176653..b9fc9a9 100644 --- a/docs/assets/ricecdf_101.png +++ b/docs/assets/ricecdf_101.png diff --git a/docs/assets/ricecdf_201.png b/docs/assets/ricecdf_201.png Binary files differindex 08412c8..b48f0dd 100644 --- a/docs/assets/ricecdf_201.png +++ b/docs/assets/ricecdf_201.png diff --git a/docs/assets/ricefit_101.png b/docs/assets/ricefit_101.png Binary files differindex daa4b71..eb76f14 100644 --- a/docs/assets/ricefit_101.png +++ b/docs/assets/ricefit_101.png diff --git a/docs/assets/riceinv_101.png b/docs/assets/riceinv_101.png Binary files differindex b23ccd3..4426b83 100644 --- a/docs/assets/riceinv_101.png +++ b/docs/assets/riceinv_101.png diff --git a/docs/assets/ricepdf_101.png b/docs/assets/ricepdf_101.png Binary files differindex 401ce05..1f9ffed 100644 --- a/docs/assets/ricepdf_101.png +++ b/docs/assets/ricepdf_101.png diff --git a/docs/assets/ridge_101.png b/docs/assets/ridge_101.png Binary files differindex 371c2fd..23dd21b 100644 --- a/docs/assets/ridge_101.png +++ b/docs/assets/ridge_101.png diff --git a/docs/assets/sigma_pts_101.png b/docs/assets/sigma_pts_101.png Binary files differindex 0d88d39..2c92ef3 100644 --- a/docs/assets/sigma_pts_101.png +++ b/docs/assets/sigma_pts_101.png diff --git a/docs/assets/tcdf_101.png b/docs/assets/tcdf_101.png Binary files differindex 7bccec0..5863e7e 100644 --- a/docs/assets/tcdf_101.png +++ b/docs/assets/tcdf_101.png diff --git a/docs/assets/tinv_101.png b/docs/assets/tinv_101.png Binary files differindex ffa7a66..7e45cf7 100644 --- a/docs/assets/tinv_101.png +++ b/docs/assets/tinv_101.png diff --git a/docs/assets/tlscdf_101.png b/docs/assets/tlscdf_101.png Binary files differindex 2b3c203..7d12744 100644 --- a/docs/assets/tlscdf_101.png +++ b/docs/assets/tlscdf_101.png diff --git a/docs/assets/tlsfit_101.png b/docs/assets/tlsfit_101.png Binary files differindex ddf7393..f26a44e 100644 --- a/docs/assets/tlsfit_101.png +++ b/docs/assets/tlsfit_101.png diff --git a/docs/assets/tlsinv_101.png b/docs/assets/tlsinv_101.png Binary files differindex b393765..bc8d533 100644 --- a/docs/assets/tlsinv_101.png +++ b/docs/assets/tlsinv_101.png diff --git a/docs/assets/tlspdf_101.png b/docs/assets/tlspdf_101.png Binary files differindex 3a7de70..6f5c844 100644 --- a/docs/assets/tlspdf_101.png +++ b/docs/assets/tlspdf_101.png diff --git a/docs/assets/tpdf_101.png b/docs/assets/tpdf_101.png Binary files differindex dec78d8..4786957 100644 --- a/docs/assets/tpdf_101.png +++ b/docs/assets/tpdf_101.png diff --git a/docs/assets/tricdf_101.png b/docs/assets/tricdf_101.png Binary files differindex 749f76f..f41f023 100644 --- a/docs/assets/tricdf_101.png +++ b/docs/assets/tricdf_101.png diff --git a/docs/assets/triinv_101.png b/docs/assets/triinv_101.png Binary files differindex 02541fb..e6b6a75 100644 --- a/docs/assets/triinv_101.png +++ b/docs/assets/triinv_101.png diff --git a/docs/assets/tripdf_101.png b/docs/assets/tripdf_101.png Binary files differindex 974aca9..6881872 100644 --- a/docs/assets/tripdf_101.png +++ b/docs/assets/tripdf_101.png diff --git a/docs/assets/unidcdf_101.png b/docs/assets/unidcdf_101.png Binary files differindex adca150..5bf3896 100644 --- a/docs/assets/unidcdf_101.png +++ b/docs/assets/unidcdf_101.png diff --git a/docs/assets/unidfit_101.png b/docs/assets/unidfit_101.png Binary files differindex 0051e99..a44e0bf 100644 --- a/docs/assets/unidfit_101.png +++ b/docs/assets/unidfit_101.png diff --git a/docs/assets/unidinv_101.png b/docs/assets/unidinv_101.png Binary files differindex d295891..28a772d 100644 --- a/docs/assets/unidinv_101.png +++ b/docs/assets/unidinv_101.png diff --git a/docs/assets/unidpdf_101.png b/docs/assets/unidpdf_101.png Binary files differindex c031d19..3f3266f 100644 --- a/docs/assets/unidpdf_101.png +++ b/docs/assets/unidpdf_101.png diff --git a/docs/assets/unifcdf_101.png b/docs/assets/unifcdf_101.png Binary files differindex b7025f7..b9edcad 100644 --- a/docs/assets/unifcdf_101.png +++ b/docs/assets/unifcdf_101.png diff --git a/docs/assets/unifinv_101.png b/docs/assets/unifinv_101.png Binary files differindex 5fefe6f..4981ffb 100644 --- a/docs/assets/unifinv_101.png +++ b/docs/assets/unifinv_101.png diff --git a/docs/assets/unifit_101.png b/docs/assets/unifit_101.png Binary files differindex 48a2d44..61cd4a2 100644 --- a/docs/assets/unifit_101.png +++ b/docs/assets/unifit_101.png diff --git a/docs/assets/unifpdf_101.png b/docs/assets/unifpdf_101.png Binary files differindex cc21153..793119b 100644 --- a/docs/assets/unifpdf_101.png +++ b/docs/assets/unifpdf_101.png diff --git a/docs/assets/violin_201.png b/docs/assets/violin_201.png Binary files differindex 97c079d..9583b76 100644 --- a/docs/assets/violin_201.png +++ b/docs/assets/violin_201.png diff --git a/docs/assets/vmcdf_101.png b/docs/assets/vmcdf_101.png Binary files differindex f79b121..ccce307 100644 --- a/docs/assets/vmcdf_101.png +++ b/docs/assets/vmcdf_101.png diff --git a/docs/assets/vminv_101.png b/docs/assets/vminv_101.png Binary files differindex de73e72..fecf262 100644 --- a/docs/assets/vminv_101.png +++ b/docs/assets/vminv_101.png diff --git a/docs/assets/vmpdf_101.png b/docs/assets/vmpdf_101.png Binary files differindex 4f5b79b..69edfea 100644 --- a/docs/assets/vmpdf_101.png +++ b/docs/assets/vmpdf_101.png diff --git a/docs/assets/wblcdf_101.png b/docs/assets/wblcdf_101.png Binary files differindex e26a2ef..63ac860 100644 --- a/docs/assets/wblcdf_101.png +++ b/docs/assets/wblcdf_101.png diff --git a/docs/assets/wblfit_101.png b/docs/assets/wblfit_101.png Binary files differindex 195de50..da2a669 100644 --- a/docs/assets/wblfit_101.png +++ b/docs/assets/wblfit_101.png diff --git a/docs/assets/wblinv_101.png b/docs/assets/wblinv_101.png Binary files differindex fabe34d..e7a0d2a 100644 --- a/docs/assets/wblinv_101.png +++ b/docs/assets/wblinv_101.png diff --git a/docs/assets/wblpdf_101.png b/docs/assets/wblpdf_101.png Binary files differindex 4a49d37..8abc0ed 100644 --- a/docs/assets/wblpdf_101.png +++ b/docs/assets/wblpdf_101.png diff --git a/docs/assets/wblplot_101.png b/docs/assets/wblplot_101.png Binary files differindex 8e7b41b..f082ef2 100644 --- a/docs/assets/wblplot_101.png +++ b/docs/assets/wblplot_101.png diff --git a/docs/assets/wblplot_201.png b/docs/assets/wblplot_201.png Binary files differindex b7d621c..567142b 100644 --- a/docs/assets/wblplot_201.png +++ b/docs/assets/wblplot_201.png diff --git a/docs/assets/wblplot_301.png b/docs/assets/wblplot_301.png Binary files differindex 62ed38b..3c892bd 100644 --- a/docs/assets/wblplot_301.png +++ b/docs/assets/wblplot_301.png diff --git a/docs/assets/wblplot_401.png b/docs/assets/wblplot_401.png Binary files differindex be853b6..a10bdf2 100644 --- a/docs/assets/wblplot_401.png +++ b/docs/assets/wblplot_401.png diff --git a/docs/assets/wblplot_501.png b/docs/assets/wblplot_501.png Binary files differindex 4410ec2..6b1ca88 100644 --- a/docs/assets/wblplot_501.png +++ b/docs/assets/wblplot_501.png diff --git a/docs/chi2gof.html b/docs/chi2gof.html index aaeb1dc..05af681 100644 --- a/docs/chi2gof.html +++ b/docs/chi2gof.html @@ -291,13 +291,13 @@ stats = df = 9 edges = - Columns 1 through 6: + Columns 1 through 7: - 4.2756e-03 1.0230e-01 2.0032e-01 2.9835e-01 3.9637e-01 4.9439e-01 + 4.2756e-03 1.0230e-01 2.0032e-01 2.9835e-01 3.9637e-01 4.9439e-01 5.9242e-01 - Columns 7 through 11: + Columns 8 through 11: - 5.9242e-01 6.9044e-01 7.8847e-01 8.8649e-01 9.8451e-01 + 6.9044e-01 7.8847e-01 8.8649e-01 9.8451e-01 O = diff --git a/docs/editDistance.html b/docs/editDistance.html new file mode 100644 index 0000000..de853fc --- /dev/null +++ b/docs/editDistance.html @@ -0,0 +1,112 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + <title>Statistics: editDistance</title> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> + <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css" integrity="sha512-1ycn6IcaQQ40/MKBW2W4Rhis/DbILU74C1vSrLJxCq57o941Ym01SwNsOMqvEBFlcgUa6xLiPY/NS5R+E6ztJQ==" crossorigin="anonymous" referrerpolicy="no-referrer"> + <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/css/bootstrap.min.css" integrity="sha384-KyZXEAg3QhqLMpG8r+8fhAXLRk2vvoC2f3B09zVXn8CA5QIVfZOJ3BCsw2P0p/We" crossorigin="anonymous"> + <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-U1DAWAznBHeqEIlVSCgzq+c9gqGAJn5c/t99JyeKa9xxaYpSvHU5awsuZVVFIhvj" crossorigin="anonymous"></script> + <script type="text/javascript" async + src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_CHTML"> + </script> + <style> + var { + font-style: italics; + font-weight: bold; + } + td { + vertical-align: top; + } + </style> + </head> + <body> + <div class="bg-dark"> + <div class="container-xl"> + <nav class="navbar navbar-expand-lg navbar-dark bg-dark"> + <div class="container-fluid"> + <a class="navbar-brand" href=index.html> + <img src="assets/statistics.png" alt="statistics" class="d-inline-block align-top" width="25" height="25"> + Statistics + </a> + <button type="button" class="navbar-toggler" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation"> + <span class="navbar-toggler-icon"></span> + </button> + <div class="collapse navbar-collapse" id="navbarNav"> + <ul class="navbar-nav"> + <li class="nav-item"> + <a class="nav-link" href="index.html#Clustering"> + <i class="fas fa-list-alt"></i> + Clustering + </a> + </li> + <li class="nav-item"> + <a class="nav-link" href="https://gnu-octave.github.io/packages/"> + <img src="assets/octave-logo.svg" alt="GNU Octave logo" class="d-inline-block align-top" width="25" height="25"> + Octave Packages + </a> + </li> + <li class="nav-item"> + <a class="nav-link" href="https://www.octave.org"> + <i class="fas fa-home"></i> + GNU Octave website + </a> + </li> + </ul> + </div> + </div> + </nav> + </div> + </div> + <div class="container-xl my-4"> + <div class="card rounded"> + <div class="card-header card-header-mod"> + <div class="row d-flex flex-wrap align-items-center"> + <div class="col-sm-3 col-md-5 mb-2 mb-sm-0"> + <h3 class="d-inline-block mr-2"> + Function Reference: <b><code>editDistance</code></b> + </h3> + </div> + </div> + </div> + <div class="card-body"> +<dl> +<dt><u>statistics:</u> <var>d</var> = <b>editDistance</b><i> (<var>str</var>)</i></dt> +<dt><u>statistics:</u> <var>d</var> = <b>editDistance</b><i> (<var>doc</var>)</i></dt> +<dt><u>statistics:</u> <var>C</var> = <b>editDistance</b><i> (…, <var>minDist</var>)</i></dt> +<dt><u>statistics:</u> [<var>C</var>, <var>IA</var>, <var>IC</var>] = <b>editDistance</b><i> @ (…, <var>minDist</var>)</i></dt> +<dt><u>statistics:</u> [<var>C</var>, <var>IA</var>, <var>IC</var>] = <b>editDistance</b><i> @ (…, <var>minDist</var>, <code>"OutputAllIndices"</code>, <var>value</var>)</i></dt> +<dt><u>statistics:</u> <var>d</var> = <b>editDistance</b><i> (<var>str1</var>, <var>str2</var>)</i></dt> +<dt><u>statistics:</u> <var>d</var> = <b>editDistance</b><i> (<var>doc1</var>, <var>doc2</var>)</i></dt> +</dl> + + +<p>Compute the edit (Levenshtein) distance between strings or documents. +</p> +<div class="ms-5"> +<p><code><var>d</var> = editDistance (<var>str</var>)</code> takes a cell array of character vectors and computes the Levenshtein distance between each pair of strings in <var>str</var> as the lowest number of grapheme insertions, deletions, and substitutions required to convert string <code><var>str</var>{1}</code> to string <code><var>str</var>{2}</code>. If <var>str</var> is a <code>cellstr</code> vector with <math>N</math> elements, the returned distance <var>d</var> is an <math>(N× (N-1)) / 2)</math> column vector of doubles. If <var>str</var> is an array (that is <code>all (size (str) > 1) = true</code>), then it is transformed to a column vector as in <code>str = str(:)</code>. <code>editDistance</code> expects <var>str</var> to be a column vector, if it is row vector, it is transformed to a column vector. +</p> +<p><code><var>d</var> = editDistance (<var>doc</var>)</code> can also take a cell array containing cell arrays of character vectors, in which case each element of <var>doc</var> is regarded as a document, and the character vector in each element of the cell string array is regarded a token. <code>editDistance</code> computes the Levenshtein distance between each pair of cell elements in <var>doc</var> as the lowest number of token insertions, deletions, and substitutions required to convert document <code><var>doc</var>{1}</code> to document <code><var>doc</var>{2}</code>. If <var>doc</var> is a <code>cell</code> vector with <math>N</math> elements, the distance <var>d</var> is an <math>(N× (N-1)) / 2)</math> column vector of doubles. If <var>doc</var> is an array (that is <code>all (size (doc) > 1) = true</code>), then it is converted to a column vector as in <code>doc = doc(:)</code>. +</p> +<p><code><var>C</var> = editDistance (…, <var>minDist</var>)</code> specifies a minimum distance, <var>minDist</var>, which is regarded as a similarity threshold between each pair of strings or documents, defined in the previous syntaces. In this case, <code>editDistance</code> resembles the functionality of the <code>uniquetol</code> function and returns the unique strings or documents that are similar up to <var>minDist</var> distance. <var>C</var> is either a cellstring array or a cell array of cellstrings, depending on the first input argument. +</p> +<p><code>[<var>C</var>, <var>IA</var>, <var>IC</var>] = editDistance (…, <var>minDist</var>)</code> also returns index vectors <var>IA</var> and <var>IC</var>. Assuming <var>A</var> contains either strings <var>str</var> or documents <var>doc</var> as defined above, <var>IA</var> is a column vector of indices to the first occurrence of similar elements such that <code><var>C</var> = <var>A</var>(<var>IA</var>)</code>, and <var>IC</var> is a column vector of indices such that <code><var>A</var> ~ <var>C</var>(<var>IC</var>)</code> where <code>~</code> means that the strings or documents are within the specified distance <var>minDist</var> of each other. +</p> +<p><code>[<var>C</var>, <var>IA</var>, <var>IC</var>] = editDistance (…, <var>minDist</var>, <code>"OutputAllIndices"</code>, <var>value</var>)</code> specifies the type of the second output index <var>IA</var>. <var>value</var> must be a logical scalar. When set to <code>true</code>, <var>IA</var> is a cell array containing the vectors of indices for ALL elements in <var>A</var> that are within the specified distance <var>minDist</var> of each other. Each cell in <var>IA</var> corresponds to a value in <var>C</var> and the values in each cell correspond to locations in <var>A</var>. If <var>value</var> is set to <code>false</code>, then <var>IA</var> is returned as an index vector described in the previous syntax. +</p> +<p><code><var>d</var> = editDistance (<var>str1</var>, <var>str2</var>)</code> can also take two character vectors, <var>str1</var> and <var>str2</var> and compute the Levenshtein distance <var>d</var> as the lowest number of grapheme insertions, deletions, and substitutions required to convert <var>str1</var> to <var>str2</var>. <var>str1</var> and <var>str2</var> may also be cellstring arrays, in which case the pairwise distance is computed between <code><var>str1</var>{n}</code> and <code><var>str1</var>{n}</code>. The cellstring arrays must be of the same size or scalars, in which case the scalar is expanded to the size of the other cellstring input. The returned distance <var>d</var> is a column vector with the same number of elements as the cellstring arrays. If <var>str1</var> or <var>str2</var> is an array, then it is transformed to a column vector. <code>editDistance</code> expects both <var>str1</var> and <var>str2</var> to be a column vectors, if not, they are transformed into column vectors. +</p> +<p><code><var>d</var> = editDistance (<var>doc1</var>, <var>doc2</var>)</code> can also take two cell array containing cell arrays of character vectors, in which case each element of <var>doc1</var> and <var>dos2</var> is regarded as a document, and the character vector in each element of the cell string array is regarded a token. <code>editDistance</code> computes the pairwise Levenshtein distance between the of cell elements in <var>doc1</var> and <var>doc2</var> as the lowest number of token insertions, deletions, and substitutions required to convert document <code><var>doc1</var>{n}</code> to document <code><var>doc1</var>{n}</code>. +</p> + +<p><strong>Source Code: </strong> + <a href="https://github.com/gnu-octave/statistics/tree/main/src/editDistance.cc">editDistance</a> +</div> + + + </div> + </div> + </div> + + </body> +</html> diff --git a/docs/fillmissing.html b/docs/fillmissing.html index a32d852..0647824 100644 --- a/docs/fillmissing.html +++ b/docs/fillmissing.html @@ -71,7 +71,7 @@ </div> <div class="card-body"> <dl> -<dt><u>statistics:</u> <var>B</var> = <b>fillmissing</b><i> (<var>A</var>, 'constant', <var>v</var>)</i></dt> +<dt><u>statistics:</u> <var>B</var> = <b>fillmissing</b><i> (<var>A</var>, "constant", <var>v</var>)</i></dt> <dt><u>statistics:</u> <var>B</var> = <b>fillmissing</b><i> (<var>A</var>, <var>method</var>)</i></dt> <dt><u>statistics:</u> <var>B</var> = <b>fillmissing</b><i> (<var>A</var>, <var>move_method</var>, <var>window_size</var>)</i></dt> <dt><u>statistics:</u> <var>B</var> = <b>fillmissing</b><i> (<var>A</var>, <var>fill_function</var>, <var>window_size</var>)</i></dt> diff --git a/docs/fitdist.html b/docs/fitdist.html index 1b16d14..f7a4a42 100644 --- a/docs/fitdist.html +++ b/docs/fitdist.html @@ -116,7 +116,7 @@ <code>"By"</code>, <var>groupvar</var>)</code> creates probability distribution objects by fitting the distribution specified by <var>distname</var> to the data in <var>x</var> based on the grouping variable <var>groupvar</var>. It returns a cell array of - fitted probability distribution objec<var>pdca</var>pdca, a cell array of group + fitted probability distribution object, <var>pdca</var>, a cell array of group labels, <var>gn</var>, and a cell array of grouping variable levels, <var>gl</var>. </p> <p> <code>[<var>pdca</var>, <var>gn</var>, <var>gl</var>] = fitdist (<var>x</var>, <var>distname</var>, @@ -124,8 +124,11 @@ output arguments using additional options specified by one or more <code>Name-Value</code> pair arguments mentioned above. </p> +<p> Note: calling <code>fitdist</code> without any input arguments will return a cell + array of character vectors listing all supported distributions. +</p> <p> <strong>See also: </strong> - <a href="fitdist.html">fitdist</a> + <a href="makedist.html">makedist</a> </p> <p><strong>Source Code: </strong> <a href="https://github.com/gnu-octave/statistics/tree/main/inst/dist_wrap/fitdist.m">fitdist</a> diff --git a/docs/glmfit.html b/docs/glmfit.html index 4c3dcae..a76bdca 100644 --- a/docs/glmfit.html +++ b/docs/glmfit.html @@ -72,45 +72,123 @@ <div class="card-body"> <dl> <dt><u>statistics:</u> <var>b</var> = <b>glmfit</b><i> (<var>X</var>, <var>y</var>, <var>distribution</var>)</i></dt> -<dt><u>statistics:</u> <var>b</var> = <b>glmfit</b><i> (<var>X</var>, <var>y</var>, <var>distribution</var>, <var>Name</var>, <var>Value</var>)</i></dt> +<dt><u>statistics:</u> <var>b</var> = <b>glmfit</b><i> (<var>X</var>, <var>y</var>, <var>distribution</var>,<var>Name</var>, <var>Value</var>)</i></dt> +<dt><u>statistics:</u> [<var>b</var>, <var>dev</var>] = <b>glmfit</b><i> (…)</i></dt> </dl> <p> Perform generalized linear model fitting. </p> <div class="ms-5"> -<p> This function fits a generalized linear model (GLM) to the given data using - the specified link function and distribution of the response variable. The - model is fitted using Iteratively Reweighted Least Squares (IRLS). +<p> <code><var>b</var> = glmfit (<var>X</var>, <var>y</var>, <var>distribution</var>)</code> returns a + coefficient estimates vector, <var>b</var> for a + generalized linear regression model of responses in <var>y</var> and + predictors in <var>X</var>, using the <var>distribution</var>. </p> <ul> -<li> <var>X</var> is an <math>n×p</math> matrix of predictor variables with +<li> <var>X</var> is an <math>n×p</math> numeric matrix of predictor variables with <math>n</math> observations and <math>p</math> predictors. - </li><li> <var>y</var> is an <math>n×1</math> vector of response variables. + </li><li> <var>y</var> is a <math>n× 1</math> numeric vector of responses for all supported + distributions, except for the ’binomial’ distribution which can also have + <var>y</var> as a <math>n× 2</math> matrix, where the first column contains the number + of successes and the second column contains the number of trials. </li><li> <var>distribution</var> specifies the distribution of the response variable (e.g., ’poisson’). </li></ul> -<p> <code><var>b</var> = glmfit (<var>X</var>, <var>y</var>, <var>distribution</var>, <var>Name</var>, - <var>Value</var>)</code> specifies additional options using <code>Name-Value</code> pair - arguments. - </p><table> -<thead><tr><th width="18%"></th><th width="2%"><var>Name</var></th><th width="80%"><var>Value</var></th></tr></thead> -<tr><td width="18%"><code>"link"</code></td><td width="2%"></td><td width="80%">A character vector specifying a lin +<p> <code><var>b</var> = glmfit (…, <var>Name</var>, <var>Value</var>)</code> + specifies additional options using <code>Name-Value</code> pair arguments. +</p> + <table> +<thead><tr><th width="18%"><var>Name</var></th><th width="2%"></th><th width="80%"><var>Value</var></th></tr></thead> +<tr><td width="18%"><code>"link"</code></td><td width="2%"></td><td width="80%">A character vector specifying a link function.</td></tr> +<tr><td width="18%"><code>"constant"</code></td><td width="2%"></td><td width="80%">Specifies whether to + include a constant term in the model. Options are + <var>"on"</var> (default) or <var>"off"</var>.</td></tr> </table> -<p> The function returns <var>b</var>, the estimated coefficients of the GLM, - including the intercept term as the first element of <var>b</var>. -</p> -<p> Currently, the function supports only the ’poisson’ distribution - and ’log’ link function. Further expansion is required to support - additional distributions and link functions. +<p> <code>[<var>b</var>, <var>dev</var>] = glmfit (…)</code> + returns the estimated coefficient vector, <var>b</var>, as well as + the deviance, <var>dev</var>, of the fit. </p> - +<p> Supported distributions include ’poisson’, ’binomial’, and ’normal’. + Supported link functions include ’identity’, ’log’, ’logit’, ’probit’, + ’loglog’, ’comploglog’, ’reciprocal’ and a custom link. + Custom link function provided as a structure with three fields: + Link Function, Derivative Function, Inverse Function. + </p> <p><strong>Source Code: </strong> <a href="https://github.com/gnu-octave/statistics/tree/main/inst/glmfit.m">glmfit</a> </div> + <div class="container-xl my-4"> + <div class="card rounded"> + <div class="card-header card-header-mod"> + <div class="row d-flex flex-wrap align-items-center"> + <div class="col-sm-3 col-md-5 mb-2 mb-sm-0"> + <h3 class="d-inline-block mr-2"> + Example: 1 + </h3> + </div> + </div> + </div> + <div class="card-body"> + <div class="container bg-light"> + <div class="row"> + <table><tbody><tr> + <td> </td> + <td><pre class="example"> + + rand ("seed", 1); + X = rand (100, 1); + b_true = [0.5; -1.2]; + mu = exp (b_true(1) + b_true(2) * X); + randp ("seed", 1); + y = poissrnd (mu); + ## Fit a GLM model using the poisson distribution + [b,dev] = glmfit (X, y, 'poisson'); + + </pre></td></tr></tbody> + </table> + + </div> + </div> + </div> + </div> + </div> + + <div class="container-xl my-4"> + <div class="card rounded"> + <div class="card-header card-header-mod"> + <div class="row d-flex flex-wrap align-items-center"> + <div class="col-sm-3 col-md-5 mb-2 mb-sm-0"> + <h3 class="d-inline-block mr-2"> + Example: 2 + </h3> + </div> + </div> + </div> + <div class="card-body"> + <div class="container bg-light"> + <div class="row"> + <table><tbody><tr> + <td> </td> + <td><pre class="example"> + + x = [2100 2300 2500 2700 2900 3100 3300 3500 3700 3900 4100 4300]'; + n = [48 42 31 34 31 21 23 23 21 16 17 21]'; + y = [1 2 0 3 8 8 14 17 19 15 17 21]'; + [b,dev] = glmfit (x,[y n],'binomial','Link','probit'); + + </pre></td></tr></tbody> + </table> + + </div> + </div> + </div> + </div> + </div> + </div> </div> diff --git a/docs/histfit.html b/docs/histfit.html index b68b5fc..89d3994 100644 --- a/docs/histfit.html +++ b/docs/histfit.html @@ -71,30 +71,46 @@ </div> <div class="card-body"> <dl> +<dt><u>statistics:</u> <b>histfit</b><i> (<var>x</var>)</i></dt> <dt><u>statistics:</u> <b>histfit</b><i> (<var>x</var>, <var>nbins</var>)</i></dt> -<dt><u>statistics:</u> <var>h</var> = <b>histfit</b><i> (<var>x</var>, <var>nbins</var>)</i></dt> +<dt><u>statistics:</u> <b>histfit</b><i> (<var>x</var>, <var>nbins</var>, <var>distname</var>)</i></dt> +<dt><u>statistics:</u> <b>histfit</b><i> (<var>ax</var>, …)</i></dt> +<dt><u>statistics:</u> <var>h</var> = <b>histfit</b><i> (…)</i></dt> </dl> -<p> Plot histogram with superimposed fitted normal density. +<p> Plot histogram with superimposed distribution fit. </p> <div class="ms-5"> -<p> <code>histfit (<var>x</var>, <var>nbins</var>)</code> plots a histogram of the values in - the vector <var>x</var> using <var>nbins</var> bars in the histogram. With one input - argument, <var>nbins</var> is set to the square root of the number of elements in - <var>x</var>. +<p> <code>histfit (<var>x</var>)</code> plots a histogram of the values in the vector + <var>x</var> using the number of bins equal to the square root of the number of + non-missing elements in <var>x</var> and superimposes a fitted normal density + function. </p> -<p> <code><var>h</var> = histfit (<var>x</var>, <var>nbins</var>)</code> returns the bins and fitted - line handles of the plot in <var>h</var>. +<p> <code>histfit (<var>x</var>, <var>nbins</var>)</code> plots a histogram of the values in the + vector <var>x</var> using <var>nbins</var> number of bins in the histogram and + superimposes a fitted normal density function. </p> -<p> Example +<p> <code>histfit (<var>x</var>, <var>nbins</var>, <var>distname</var>)</code> plots a histogram of + the values in the vector <var>x</var> using <var>nbins</var> number of bins in the + histogram and superimposes a fitted density function from the distribution + specified by <var>distname</var>. +</p> +<p> <code>histfit (<var>ax</var>, …)</code> uses the axes handle <var>ax</var> to plot the + histogram and the fitted density function onto followed by any of the input + argument combinations specified in the previous syntaxes. +</p> +<p> <code><var>h</var> = histfit (…)</code> returns a vector of handles <var>h</var>, where + <code><var>h</var>(1)</code> is the handle to the histogram and <code><var>h</var>(1)</code> is + the handle to the density curve. +</p> +<p> Note: calling <code>fitdist</code> without any input arguments will return a cell + array of character vectors listing all supported distributions. </p> - <table><tr><td> </td><td><pre class="example"> histfit (randn (100, 1)) - </pre></td></tr></table> - <p> <strong>See also: </strong> bar, hist, -pareto + <a href="normplot.html">normplot</a>, + <a href="fitdist.html">fitdist</a> </p> <p><strong>Source Code: </strong> <a href="https://github.com/gnu-octave/statistics/tree/main/inst/histfit.m">histfit</a> @@ -131,6 +147,70 @@ pareto </div> </div> + <div class="container-xl my-4"> + <div class="card rounded"> + <div class="card-header card-header-mod"> + <div class="row d-flex flex-wrap align-items-center"> + <div class="col-sm-3 col-md-5 mb-2 mb-sm-0"> + <h3 class="d-inline-block mr-2"> + Example: 2 + </h3> + </div> + </div> + </div> + <div class="card-body"> + <div class="container bg-light"> + <div class="row"> + <table><tbody><tr> + <td> </td> + <td><pre class="example"> + + histfit (poissrnd (2, 1000, 1), 10, "Poisson") + + </pre></td></tr></tbody> + </table> + <div class="text-center"> + <img src="assets/histfit_201.png" class="rounded img-thumbnail" alt="plotted figure"> + </div><p></p> + + </div> + </div> + </div> + </div> + </div> + + <div class="container-xl my-4"> + <div class="card rounded"> + <div class="card-header card-header-mod"> + <div class="row d-flex flex-wrap align-items-center"> + <div class="col-sm-3 col-md-5 mb-2 mb-sm-0"> + <h3 class="d-inline-block mr-2"> + Example: 3 + </h3> + </div> + </div> + </div> + <div class="card-body"> + <div class="container bg-light"> + <div class="row"> + <table><tbody><tr> + <td> </td> + <td><pre class="example"> + + histfit (betarnd (3, 10, 1000, 1), 10, "beta") + + </pre></td></tr></tbody> + </table> + <div class="text-center"> + <img src="assets/histfit_301.png" class="rounded img-thumbnail" alt="plotted figure"> + </div><p></p> + + </div> + </div> + </div> + </div> + </div> + </div> </div> diff --git a/docs/index.html b/docs/index.html index 3e0fbec..bedecb5 100644 --- a/docs/index.html +++ b/docs/index.html @@ -61,7 +61,7 @@ </div> <div class="col-sm-9 col-md-10"> <h3 class="d-inline-block mr-2">statistics</h3> - <b>1.6.5 2024-3-7</b> + <b>1.6.6 2024-5-16</b> <p class="indent"> The Statistics package for GNU Octave. </p> @@ -150,6 +150,14 @@ <tr> <td> <b><code> + <a href="editDistance.html">editDistance</a> + </code></b> + </td> + <td>Compute the edit (Levenshtein) distance between strings or documents.</td> + </tr> + <tr> + <td> + <b><code> <a href="evalclusters.html">evalclusters</a> </code></b> </td> @@ -579,7 +587,8 @@ samples as parameters.</td> <a href="mad.html">mad</a> </code></b> </td> - <td>Compute the mean or median absolute deviation (MAD).</td> + <td>Compute the mean or median absolute deviation (MAD) of the elements of +X.</td> </tr> <tr> <td> @@ -627,7 +636,7 @@ samples as parameters.</td> <a href="std.html">std</a> </code></b> </td> - <td>Compute the standard deviation of the elements of X.</td> + <td>Compute the standard deviation of the elements of the vector X.</td> </tr> <tr> <td> @@ -643,7 +652,7 @@ samples as parameters.</td> <a href="var.html">var</a> </code></b> </td> - <td>Compute the variance of the elements of X.</td> + <td>Compute the variance of the elements of the vector X.</td> </tr> </tbody> </table> @@ -770,7 +779,7 @@ samples as parameters.</td> <a href="LoguniformDistribution.html">LoguniformDistribution</a> </code></b> </td> - <td>Loguniform probability distribution object.</td> + <td>Log-uniform probability distribution object.</td> </tr> <tr> <td> @@ -810,7 +819,7 @@ samples as parameters.</td> <a href="PiecewiseLinearDistribution.html">PiecewiseLinearDistribution</a> </code></b> </td> - <td>Continuous uniform probability distribution object.</td> + <td>Piecewise linear probability distribution object.</td> </tr> <tr> <td> @@ -3559,7 +3568,7 @@ a file specified by FILENAME.</td> <a href="histfit.html">histfit</a> </code></b> </td> - <td>Plot histogram with superimposed fitted normal density.</td> + <td>Plot histogram with superimposed distribution fit.</td> </tr> <tr> <td> diff --git a/docs/mad.html b/docs/mad.html index f1ee1e1..232032f 100644 --- a/docs/mad.html +++ b/docs/mad.html @@ -71,56 +71,62 @@ </div> <div class="card-body"> <dl> -<dt><u>statistics:</u> <var>m</var> = <b>mad</b><i> (<var>x</var>)</i></dt> -<dt><u>statistics:</u> <var>m</var> = <b>mad</b><i> (<var>x</var>, <var>flag</var>)</i></dt> -<dt><u>statistics:</u> <var>m</var> = <b>mad</b><i> (<var>x</var>, <var>flag</var>, <code>"all"</code>)</i></dt> -<dt><u>statistics:</u> <var>m</var> = <b>mad</b><i> (<var>x</var>, <var>flag</var>, <var>dim</var>)</i></dt> -<dt><u>statistics:</u> <var>m</var> = <b>mad</b><i> (<var>x</var>, <var>flag</var>, <var>vecdim</var>)</i></dt> +<dt><u>:</u> <var>m</var> = <b>mad</b><i> (<var>x</var>)</i></dt> +<dt><u>:</u> <var>m</var> = <b>mad</b><i> (<var>x</var>, <var>opt</var>)</i></dt> +<dt><u>:</u> <var>m</var> = <b>mad</b><i> (<var>x</var>, <var>opt</var>, <var>dim</var>)</i></dt> +<dt><u>:</u> <var>m</var> = <b>mad</b><i> (<var>x</var>, <var>opt</var>, <var>vecdim</var>)</i></dt> +<dt><u>:</u> <var>m</var> = <b>mad</b><i> (<var>x</var>, <var>opt</var>, "all")</i></dt> </dl> - -<p> Compute the mean or median absolute deviation (MAD). +<p> Compute the mean or median absolute deviation (MAD) of the elements of + <var>x</var>. </p> <div class="ms-5"> -<p> <code>mad (<var>x</var>)</code> returns the mean absolute deviation of the values in - <var>x</var>. <code>mad</code> treats NaNs as missing values and removes them. +<p> The mean absolute deviation is defined as +</p> + <table><tr><td> </td><td><pre class="example"> <var>mad</var> = mean (abs (<var>x</var> - mean (<var>x</var>))) + </pre></td></tr></table> + +<p> The median absolute deviation is defined as </p> - <ul> -<li> - If <var>x</var> is a vector, then <code>mad</code> returns the mean or median absolute - deviation of the values in <var>X</var>. - </li><li> - If <var>x</var> is a matrix, then <code>mad</code> returns the mean or median absolute - deviation of each column of <var>X</var>. - </li><li> - If <var>x</var> is an multidimensional array, then <code>mad (<var>x</var>)</code> operates - along the first non-singleton dimension of <var>x</var>. - </li></ul> + <table><tr><td> </td><td><pre class="example"> <var>mad</var> = median (abs (<var>x</var> - median (<var>x</var>))) + </pre></td></tr></table> -<p> <code>mad (<var>x</var>, <var>flag</var>)</code> specifies whether to compute the mean - absolute deviation (<code>flag = 0</code>, the default) or the median absolute - deviation (<code>flag = 1</code>). Passing an empty variable, defaults to 0. +<p> If <var>x</var> is a vector, compute <code>mad</code> for each element in <var>x</var>. If + <var>x</var> is an array the calculation is performed over the first + non-singleton dimension. +</p> +<p> <code>mad</code> excludes NaN values from calculation similar to using the + <code>omitnan</code> option in <code>var</code>, <code>mean</code>, and <code>median</code>. +</p> +<p> The optional argument <var>opt</var> determines whether mean or median absolute + deviation is calculated. The default is 0 which corresponds to mean + absolute deviation; a value of 1 corresponds to median absolute deviation. + Passing an empty input [] defaults to mean absolute deviation + (<var>opt</var> = 0). </p> -<p> <code>mad (<var>x</var>, <var>flag</var>, <code>"all"</code>)</code> returns the MAD of all the - elements in <var>x</var>. +<p> The optional argument <var>dim</var> forces <code>mad</code> to operate along the + specified dimension. Specifying any singleton dimension in <var>x</var>, + including any dimension exceeding <code>ndims (<var>x</var>)</code>, will result in + an output of 0. </p> -<p> The optional variable <var>dim</var> forces <code>mad</code> to operate over the - specified dimension, which must be a positive integer-valued number. - Specifying any singleton dimension in <var>x</var>, including any dimension - exceeding <code>ndims (<var>x</var>)</code>, will result in a MAD equal to - <code>zeros (size (<var>x</var>))</code>, while non-finite elements are returned as NaNs. +<p> Specifying the dimension as <var>vecdim</var>, a vector of non-repeating + dimensions, will return the <code>mad</code> over the array slice defined by + <var>vecdim</var>. If <var>vecdim</var> indexes all dimensions of <var>x</var>, then it is + equivalent to the option <code>"all"</code>. Any dimension included in + <var>vecdim</var> greater than <code>ndims (<var>x</var>)</code> is ignored. </p> -<p> <code>mad (<var>x</var>, <var>flag</var>, <var>vecdim</var>)</code> returns the MAD over the - dimensions specified in the vector <var>vecdim</var>. For example, if <var>x</var> - is a 2-by-3-by-4 array, then <code>mad (<var>x</var>, [1 2])</code> returns a - 1-by-1-by-4 array. Each element of the output array is the median of the - elements on the corresponding page of <var>x</var>. If <var>vecdim</var> indexes all - dimensions of <var>x</var>, then it is equivalent to <code>mad (<var>x</var>, "all")</code>. - Any dimension in <var>vecdim</var> greater than <code>ndims (<var>x</var>)</code> is ignored. +<p> Specifying the dimension as <code>"all"</code> will force <code>mad</code> to operate + on all elements of <var>x</var>, and is equivalent to <code>mad (<var>x</var>(:))</code>. </p> -<p> <strong>See also: </strong> - <a href="median.html">median</a>, +<p> As a measure of dispersion, <code>mad</code> is less affected by outliers than + <code>std</code>. + <strong>See also: </strong> +bounds, +range, +iqr, + <a href="std.html">std</a>, <a href="mean.html">mean</a>, -mode + <a href="median.html">median</a> </p> <p><strong>Source Code: </strong> <a href="https://github.com/gnu-octave/statistics/tree/main/inst/shadow9/mad.m">mad</a> diff --git a/docs/mean.html b/docs/mean.html index 7e15e77..9fab26e 100644 --- a/docs/mean.html +++ b/docs/mean.html @@ -71,77 +71,66 @@ </div> <div class="card-body"> <dl> -<dt><u>statistics:</u> <var>m</var> = <b>mean</b><i> (<var>x</var>)</i></dt> -<dt><u>statistics:</u> <var>m</var> = <b>mean</b><i> (<var>x</var>, "all")</i></dt> -<dt><u>statistics:</u> <var>m</var> = <b>mean</b><i> (<var>x</var>, <var>dim</var>)</i></dt> -<dt><u>statistics:</u> <var>m</var> = <b>mean</b><i> (<var>x</var>, <var>vecdim</var>)</i></dt> -<dt><u>statistics:</u> <var>m</var> = <b>mean</b><i> (…, <var>outtype</var>)</i></dt> -<dt><u>statistics:</u> <var>m</var> = <b>mean</b><i> (…, <var>nanflag</var>)</i></dt> +<dt><u>:</u> <var>m</var> = <b>mean</b><i> (<var>x</var>)</i></dt> +<dt><u>:</u> <var>m</var> = <b>mean</b><i> (<var>x</var>, <var>dim</var>)</i></dt> +<dt><u>:</u> <var>m</var> = <b>mean</b><i> (<var>x</var>, <var>vecdim</var>)</i></dt> +<dt><u>:</u> <var>m</var> = <b>mean</b><i> (<var>x</var>, "all")</i></dt> +<dt><u>:</u> <var>m</var> = <b>mean</b><i> (…, <var>nanflag</var>)</i></dt> +<dt><u>:</u> <var>m</var> = <b>mean</b><i> (…, <var>outtype</var>)</i></dt> </dl> - <p> Compute the mean of the elements of <var>x</var>. </p> <div class="ms-5"> - <ul> -<li> - If <var>x</var> is a vector, then <code>mean(<var>x</var>)</code> returns the - mean of the elements in <var>x</var> defined as +<p> If <var>x</var> is a vector, then <code>mean (<var>x</var>)</code> returns the mean of the + elements in <var>x</var> defined as $$ {\rm mean}(x) = \bar{x} = {1\over N} \sum_{i=1}^N x_i $$ - where <math>N</math> is the length of the <var>x</var> vector. - - </li><li> - If <var>x</var> is a matrix, then <code>mean(<var>x</var>)</code> returns a row vector - with the mean of each columns in <var>x</var>. - - </li><li> - If <var>x</var> is a multidimensional array, then <code>mean(<var>x</var>)</code> - operates along the first nonsingleton dimension of <var>x</var>. - </li></ul> - -<p> <code>mean (<var>x</var>, <var>dim</var>)</code> returns the mean along the operating - dimension <var>dim</var> of <var>x</var>. For <var>dim</var> greater than - <code>ndims (<var>x</var>)</code>, then <var>m</var> = <var>x</var>. +</p> +<p> If <var>x</var> is an array, then <code>mean(<var>x</var>)</code> computes the mean along + the first non-singleton dimension of <var>x</var>. +</p> +<p> The optional variable <var>dim</var> forces <code>mean</code> to operate over the + specified dimension, which must be a positive integer-valued number. + Specifying any singleton dimension in <var>x</var>, including any dimension + exceeding <code>ndims (<var>x</var>)</code>, will result in a mean equal to <var>x</var>. </p> -<p> <code>mean (<var>x</var>, <var>vecdim</var>)</code> returns the mean over the - dimensions specified in the vector <var>vecdim</var>. For example, if <var>x</var> - is a 2-by-3-by-4 array, then <code>mean (<var>x</var>, [1 2])</code> returns a - 1-by-1-by-4 array. Each element of the output array is the mean of the - elements on the corresponding page of <var>x</var>. If <var>vecdim</var> indexes all - dimensions of <var>x</var>, then it is equivalent to <code>mean (<var>x</var>, "all")</code>. - Any dimension in <var>vecdim</var> greater than <code>ndims (<var>x</var>)</code> is ignored. +<p> Specifying the dimensions as <var>vecdim</var>, a vector of non-repeating + dimensions, will return the mean over the array slice defined by + <var>vecdim</var>. If <var>vecdim</var> indexes all dimensions of <var>x</var>, then it is + equivalent to the option <code>"all"</code>. Any dimension in <var>vecdim</var> + greater than <code>ndims (<var>x</var>)</code> is ignored. </p> -<p> <code>mean (<var>x</var>, "all")</code> returns the mean of all the elements in <var>x</var>. - The optional flag "all" cannot be used together with <var>dim</var> or - <var>vecdim</var> input arguments. +<p> Specifying the dimension as <code>"all"</code> will force <code>mean</code> to operate + on all elements of <var>x</var>, and is equivalent to <code>mean (<var>x</var>(:))</code>. </p> -<p> <code>mean (…, <var>outtype</var>)</code> returns the mean with a specified data - type, using any of the input arguments in the previous syntaxes. +<p> The optional input <var>outtype</var> specifies the data type that is returned. <var>outtype</var> can take the following values: - </p><ul> -<li> "default" - Output is of type double, unless the input is single in which case the output - is of type single. - - </li><li> "double" - Output is of type double. - - </li><li> "native". - Output is of the same type as the input (<code>class (<var>x</var>)</code>), unless the - input is logical in which case the output is of type double or a character - array in which case an error is produced. - </li></ul> +</p> + <dl compact="compact"> +<dt> <code>'default'</code> : Output is of type double, unless the input is</dt> +</dl> +<p> single in which case the output is of type single. +</p> + </dd> +<dt> <code>'double'</code> : Output is of type double.</dt> +<dt> <code>'native'</code> : Output is of the same type as the input as reported</dt> +</dl> +<p> by (<code>class (<var>x</var>)</code>), unless the input is logical in which case the + output is of type double. + </p></dd> +</dl> -<p> <code>mean (…, <var>nanflag</var>)</code> specifies whether to exclude NaN values - from the calculation, using any of the input argument combinations in - previous syntaxes. By default, NaN values are included in the calculation - (<var>nanflag</var> has the value "includenan"). To exclude NaN values, set the - value of <var>nanflag</var> to "omitnan". +<p> The optional variable <var>nanflag</var> specifies whether to include or exclude + NaN values from the calculation using any of the previously specified input + argument combinations. The default value for <var>nanflag</var> is + <code>"includenan"</code> which keeps NaN values in the calculation. To exclude + NaN values set the value of <var>nanflag</var> to <code>"omitnan"</code>. The output + will still contain NaN values if <var>x</var> consists of all NaN values in the + operating dimension. </p> <p> <strong>See also: </strong> - <a href="trimmean.html">trimmean</a>, <a href="median.html">median</a>, - <a href="mad.html">mad</a>, -mode +mode, +movmean </p> <p><strong>Source Code: </strong> <a href="https://github.com/gnu-octave/statistics/tree/main/inst/shadow9/mean.m">mean</a> diff --git a/docs/median.html b/docs/median.html index e4e963c..f447dab 100644 --- a/docs/median.html +++ b/docs/median.html @@ -71,59 +71,64 @@ </div> <div class="card-body"> <dl> -<dt><u>statistics:</u> <var>m</var> = <b>median</b><i> (<var>x</var>)</i></dt> -<dt><u>statistics:</u> <var>m</var> = <b>median</b><i> (<var>x</var>, "all")</i></dt> -<dt><u>statistics:</u> <var>m</var> = <b>median</b><i> (<var>x</var>, <var>dim</var>)</i></dt> -<dt><u>statistics:</u> <var>m</var> = <b>median</b><i> (<var>x</var>, <var>vecdim</var>)</i></dt> -<dt><u>statistics:</u> <var>m</var> = <b>median</b><i> (…, <var>outtype</var>)</i></dt> -<dt><u>statistics:</u> <var>m</var> = <b>median</b><i> (…, <var>nanflag</var>)</i></dt> +<dt><u>:</u> <var>m</var> = <b>median</b><i> (<var>x</var>)</i></dt> +<dt><u>:</u> <var>m</var> = <b>median</b><i> (<var>x</var>, <var>dim</var>)</i></dt> +<dt><u>:</u> <var>m</var> = <b>median</b><i> (<var>x</var>, <var>vecdim</var>)</i></dt> +<dt><u>:</u> <var>m</var> = <b>median</b><i> (<var>x</var>, "all")</i></dt> +<dt><u>:</u> <var>m</var> = <b>median</b><i> (…, <var>nanflag</var>)</i></dt> +<dt><u>:</u> <var>m</var> = <b>median</b><i> (…, <var>outtype</var>)</i></dt> </dl> - <p> Compute the median value of the elements of <var>x</var>. </p> <div class="ms-5"> <p> When the elements of <var>x</var> are sorted, say <code><var>s</var> = sort (<var>x</var>)</code>, the median is defined as - $$ {\rm median} (x) = \cases{s(\lceil N/2\rceil), & $N$ odd; - \cr (s(N/2)+s(N/2+1))/2, & $N$ even.} $$ - where <math>N</math> is the number of elements of <var>x</var>. -</p> -<p> If <var>x</var> is an array, then <code>median (<var>x</var>)</code> operates along the first - non-singleton dimension of <var>x</var>. + $$ + {\rm median} (x) = + \cases{s(\lceil N/2\rceil), & $N$ odd;\cr + (s(N/2)+s(N/2+1))/2, & $N$ even.} + $$ +</p> +<p> If <var>x</var> is an array, then <code>median (<var>x</var>)</code> operates along the + first non-singleton dimension of <var>x</var>. </p> <p> The optional variable <var>dim</var> forces <code>median</code> to operate over the specified dimension, which must be a positive integer-valued number. Specifying any singleton dimension in <var>x</var>, including any dimension exceeding <code>ndims (<var>x</var>)</code>, will result in a median equal to <var>x</var>. </p> -<p> <code>median (<var>x</var>, <var>vecdim</var>)</code> returns the median over the - dimensions specified in the vector <var>vecdim</var>. For example, if <var>x</var> - is a 2-by-3-by-4 array, then <code>median (<var>x</var>, [1 2])</code> returns a - 1-by-1-by-4 array. Each element of the output array is the median of the - elements on the corresponding page of <var>x</var>. If <var>vecdim</var> indexes all - dimensions of <var>x</var>, then it is equivalent to - <code>median (<var>x</var>, "all")</code>. Any dimension in <var>vecdim</var> greater than - <code>ndims (<var>x</var>)</code> is ignored. +<p> Specifying the dimensions as <var>vecdim</var>, a vector of non-repeating + dimensions, will return the median over the array slice defined by + <var>vecdim</var>. If <var>vecdim</var> indexes all dimensions of <var>x</var>, then it is + equivalent to the option <code>"all"</code>. Any dimension in <var>vecdim</var> + greater than <code>ndims (<var>x</var>)</code> is ignored. </p> -<p> <code>median (<var>x</var>, "all")</code> returns the median of all the elements in - <var>x</var>. The optional flag "all" cannot be used together with <var>dim</var> or - <var>vecdim</var> input arguments. +<p> Specifying the dimension as <code>"all"</code> will force <code>median</code> to + operate on all elements of <var>x</var>, and is equivalent to + <code>median (<var>x</var>(:))</code>. </p> <p> <code>median (…, <var>outtype</var>)</code> returns the median with a specified data type, using any of the input arguments in the previous syntaxes. <var>outtype</var> can take the following values: - </p><ul> -<li> <code>"default"</code> - Output is of type double, unless the input is single in which case the +</p> + <dl compact="compact"> +<dt> <code>"default"</code></dt> +</dl> +<p> Output is of type double, unless the input is single in which case the output is of type single. - - </li><li> <code>"double"</code> - Output is of type double. - - </li><li> <code>"native"</code> - Output is of the same type as the input (<code>class (<var>x</var>)</code>), unless the +</p> + </dd> +<dt> <code>"double"</code></dt> +</dl> +<p> Output is of type double. +</p> + </dd> +<dt> <code>"native"</code>.</dt> +</dl> +<p> Output is of the same type as the input (<code>class (<var>x</var>)</code>), unless the input is logical in which case the output is of type double. - </li></ul> + </p></dd> +</dl> <p> The optional variable <var>nanflag</var> specifies whether to include or exclude NaN values from the calculation using any of the previously specified input @@ -135,8 +140,8 @@ </p> <p> <strong>See also: </strong> <a href="mean.html">mean</a>, - <a href="mad.html">mad</a>, -mode +mode, +movmedian </p> <p><strong>Source Code: </strong> <a href="https://github.com/gnu-octave/statistics/tree/main/inst/shadow9/median.m">median</a> diff --git a/docs/multcompare.html b/docs/multcompare.html index 411e9a6..1159cf1 100644 --- a/docs/multcompare.html +++ b/docs/multcompare.html @@ -337,19 +337,10 @@ Group ID Group ID LBoundDiff EstimatedDiff UBoundDiff p-value C = - Columns 1 through 6: - - 1.0000e+00 2.0000e+00 -1.1343e+01 -8.0000e+00 -4.6572e+00 2.8581e-05 - 1.0000e+00 3.0000e+00 -1.1932e+01 -9.0000e+00 -6.0682e+00 1.0459e-06 - 1.0000e+00 4.0000e+00 -1.4035e+01 -1.1000e+01 -7.9654e+00 6.3838e-08 - 1.0000e+00 5.0000e+00 -2.1849e+01 -1.9000e+01 -1.6151e+01 3.0198e-14 - - Columns 7 and 8: - - -4.8748e+00 3.2000e+01 - -6.2529e+00 3.2000e+01 - -7.3834e+00 3.2000e+01 - -1.3583e+01 3.2000e+01 + 1.0000e+00 2.0000e+00 -1.1343e+01 -8.0000e+00 -4.6572e+00 2.8581e-05 -4.8748e+00 3.2000e+01 + 1.0000e+00 3.0000e+00 -1.1932e+01 -9.0000e+00 -6.0682e+00 1.0459e-06 -6.2529e+00 3.2000e+01 + 1.0000e+00 4.0000e+00 -1.4035e+01 -1.1000e+01 -7.9654e+00 6.3838e-08 -7.3834e+00 3.2000e+01 + 1.0000e+00 5.0000e+00 -2.1849e+01 -1.9000e+01 -1.6151e+01 3.1974e-14 -1.3583e+01 3.2000e+01 M = @@ -456,41 +447,21 @@ Group ID Group ID LBoundDiff EstimatedDiff UBoundDiff p-value C = - Columns 1 through 6: - - 1.0000e+00 2.0000e+00 -4.5437e+00 -1.7457e-02 4.5087e+00 1.0000e+00 - 1.0000e+00 3.0000e+00 8.9634e+00 1.3703e+01 1.8443e+01 4.5333e-06 - 1.0000e+00 4.0000e+00 -6.0019e+00 -1.5286e+00 2.9447e+00 1.0000e+00 - 1.0000e+00 5.0000e+00 -6.1735e+00 -1.7011e+00 2.7714e+00 1.0000e+00 - 1.0000e+00 6.0000e+00 -6.9212e-01 3.9565e+00 8.6051e+00 6.6201e-01 - 2.0000e+00 3.0000e+00 9.1656e+00 1.3721e+01 1.8276e+01 2.0212e-06 - 2.0000e+00 4.0000e+00 -6.0600e+00 -1.5111e+00 3.0378e+00 1.0000e+00 - 2.0000e+00 5.0000e+00 -6.1953e+00 -1.6836e+00 2.8281e+00 1.0000e+00 - 2.0000e+00 6.0000e+00 -5.3340e-01 3.9740e+00 8.4813e+00 6.6201e-01 - 3.0000e+00 4.0000e+00 -2.0018e+01 -1.5232e+01 -1.0446e+01 6.1827e-07 - 3.0000e+00 5.0000e+00 -2.0112e+01 -1.5404e+01 -1.0697e+01 3.4083e-07 - 3.0000e+00 6.0000e+00 -1.4228e+01 -9.7468e+00 -5.2654e+00 6.5704e-04 - 4.0000e+00 5.0000e+00 -4.6499e+00 -1.7249e-01 4.3050e+00 1.0000e+00 - 4.0000e+00 6.0000e+00 7.9808e-01 5.4851e+00 1.0172e+01 2.0411e-01 - 5.0000e+00 6.0000e+00 1.0354e+00 5.6576e+00 1.0280e+01 1.7402e-01 - - Columns 7 and 8: - - -7.7360e-03 5.3000e+01 - 5.7988e+00 5.3000e+01 - -6.8538e-01 5.3000e+01 - -7.6287e-01 5.3000e+01 - 1.7071e+00 5.3000e+01 - 6.0416e+00 5.3000e+01 - -6.6630e-01 5.3000e+01 - -7.4847e-01 5.3000e+01 - 1.7684e+00 5.3000e+01 - -6.3835e+00 5.3000e+01 - -6.5634e+00 5.3000e+01 - -4.3623e+00 5.3000e+01 - -7.7268e-02 5.3000e+01 - 2.3473e+00 5.3000e+01 - 2.4550e+00 5.3000e+01 + 1.0000e+00 2.0000e+00 -4.5437e+00 -1.7457e-02 4.5087e+00 1.0000e+00 -7.7360e-03 5.3000e+01 + 1.0000e+00 3.0000e+00 8.9634e+00 1.3703e+01 1.8443e+01 4.5333e-06 5.7988e+00 5.3000e+01 + 1.0000e+00 4.0000e+00 -6.0019e+00 -1.5286e+00 2.9447e+00 1.0000e+00 -6.8538e-01 5.3000e+01 + 1.0000e+00 5.0000e+00 -6.1735e+00 -1.7011e+00 2.7714e+00 1.0000e+00 -7.6287e-01 5.3000e+01 + 1.0000e+00 6.0000e+00 -6.9212e-01 3.9565e+00 8.6051e+00 6.6201e-01 1.7071e+00 5.3000e+01 + 2.0000e+00 3.0000e+00 9.1656e+00 1.3721e+01 1.8276e+01 2.0212e-06 6.0416e+00 5.3000e+01 + 2.0000e+00 4.0000e+00 -6.0600e+00 -1.5111e+00 3.0378e+00 1.0000e+00 -6.6630e-01 5.3000e+01 + 2.0000e+00 5.0000e+00 -6.1953e+00 -1.6836e+00 2.8281e+00 1.0000e+00 -7.4847e-01 5.3000e+01 + 2.0000e+00 6.0000e+00 -5.3340e-01 3.9740e+00 8.4813e+00 6.6201e-01 1.7684e+00 5.3000e+01 + 3.0000e+00 4.0000e+00 -2.0018e+01 -1.5232e+01 -1.0446e+01 6.1827e-07 -6.3835e+00 5.3000e+01 + 3.0000e+00 5.0000e+00 -2.0112e+01 -1.5404e+01 -1.0697e+01 3.4083e-07 -6.5634e+00 5.3000e+01 + 3.0000e+00 6.0000e+00 -1.4228e+01 -9.7468e+00 -5.2654e+00 6.5704e-04 -4.3623e+00 5.3000e+01 + 4.0000e+00 5.0000e+00 -4.6499e+00 -1.7249e-01 4.3050e+00 1.0000e+00 -7.7268e-02 5.3000e+01 + 4.0000e+00 6.0000e+00 7.9808e-01 5.4851e+00 1.0172e+01 2.0411e-01 2.3473e+00 5.3000e+01 + 5.0000e+00 6.0000e+00 1.0354e+00 5.6576e+00 1.0280e+01 1.7402e-01 2.4550e+00 5.3000e+01 M = @@ -566,29 +537,21 @@ GNAMES = Group ID Group ID LBoundDiff EstimatedDiff UBoundDiff p-value ---------------------------------------------------------------------- - 1 2 -42.096 -26.750 -11.404 <.001 - 1 3 -26.805 -14.125 -1.445 .027 - 2 3 -5.239 12.625 30.489 .198 + 1 2 -42.087 -26.750 -11.413 <.001 + 1 3 -26.797 -14.125 -1.453 .027 + 2 3 -5.228 12.625 30.478 .199 C = - Columns 1 through 6: - - 1.0000e+00 2.0000e+00 -4.2096e+01 -2.6750e+01 -1.1404e+01 7.0100e-04 - 1.0000e+00 3.0000e+00 -2.6805e+01 -1.4125e+01 -1.4448e+00 2.7414e-02 - 2.0000e+00 3.0000e+00 -5.2387e+00 1.2625e+01 3.0489e+01 1.9829e-01 - - Columns 7 and 8: - - -4.3716e+00 2.1000e+01 - -2.7937e+00 2.1000e+01 - 1.7725e+00 2.1000e+01 + 1.0000e+00 2.0000e+00 -4.2087e+01 -2.6750e+01 -1.1413e+01 7.2100e-04 -4.3716e+00 2.1000e+01 + 1.0000e+00 3.0000e+00 -2.6797e+01 -1.4125e+01 -1.4527e+00 2.7444e-02 -2.7937e+00 2.1000e+01 + 2.0000e+00 3.0000e+00 -5.2276e+00 1.2625e+01 3.0478e+01 1.9866e-01 1.7725e+00 2.1000e+01 M = - 9.7500 2.4770 5.3572 14.1428 - 36.5000 5.5953 26.5773 46.4227 - 23.8750 4.4076 16.0585 31.6915 + 9.7500 2.4770 5.3600 14.1400 + 36.5000 5.5953 26.5835 46.4165 + 23.8750 4.4076 16.0634 31.6866 </pre></td></tr></tbody> </table> diff --git a/docs/normplot.html b/docs/normplot.html index 1f3ccd2..d541f04 100644 --- a/docs/normplot.html +++ b/docs/normplot.html @@ -83,7 +83,7 @@ <div class="ms-5"> <p> <code><var>h</var> = normplot (<var>ax</var>, <var>x</var>)</code> takes a handle <var>ax</var> in addition to the data in <var>x</var> and it uses that axes for ploting. You may - get this handle of an existing plot with <code>gca</code>/. + get this handle of an existing plot with <code>gca</code>. </p> <p> The line joing the 1st and 3rd quantile is drawn solid whereas its extensions to both ends are dotted. If the underlying distribution is normal, the diff --git a/docs/pcares.html b/docs/pcares.html index 0940a38..2d126b6 100644 --- a/docs/pcares.html +++ b/docs/pcares.html @@ -157,7 +157,7 @@ factoran, n1 = 28.460 n2 = 12.201 n3 = 1.6870 -n4 = 3.3717e-14 +n4 = 4.2168e-14 </pre></td></tr></tbody> </table> diff --git a/docs/std.html b/docs/std.html index b7d4d81..0d5501e 100644 --- a/docs/std.html +++ b/docs/std.html @@ -71,80 +71,95 @@ </div> <div class="card-body"> <dl> -<dt><u>statistics:</u> <var>s</var> = <b>std</b><i> (<var>x</var>)</i></dt> -<dt><u>statistics:</u> <var>s</var> = <b>std</b><i> (<var>x</var>, <var>w</var>)</i></dt> -<dt><u>statistics:</u> <var>s</var> = <b>std</b><i> (<var>x</var>, <var>w</var>, "all")</i></dt> -<dt><u>statistics:</u> <var>s</var> = <b>std</b><i> (<var>x</var>, <var>w</var>, <var>dim</var>)</i></dt> -<dt><u>statistics:</u> <var>s</var> = <b>std</b><i> (<var>x</var>, <var>w</var>, <var>vecdim</var>)</i></dt> -<dt><u>statistics:</u> <var>s</var> = <b>std</b><i> (…, <var>nanflag</var>)</i></dt> -<dt><u>statistics:</u> [<var>s</var>, <var>m</var>] = <b>std</b><i> (…)</i></dt> +<dt><u>:</u> <var>s</var> = <b>std</b><i> (<var>x</var>)</i></dt> +<dt><u>:</u> <var>s</var> = <b>std</b><i> (<var>x</var>, <var>w</var>)</i></dt> +<dt><u>:</u> <var>s</var> = <b>std</b><i> (<var>x</var>, <var>w</var>, <var>dim</var>)</i></dt> +<dt><u>:</u> <var>s</var> = <b>std</b><i> (<var>x</var>, <var>w</var>, <var>vecdim</var>)</i></dt> +<dt><u>:</u> <var>s</var> = <b>std</b><i> (<var>x</var>, <var>w</var>, <code>"ALL"</code>)</i></dt> +<dt><u>:</u> <var>s</var> = <b>std</b><i> (…, <var>nanflag</var>)</i></dt> +<dt><u>:</u> [<var>s</var>, <var>m</var>] = <b>std</b><i> (…)</i></dt> </dl> - -<p> Compute the standard deviation of the elements of <var>x</var>. +<p> Compute the standard deviation of the elements of the vector <var>x</var>. </p> <div class="ms-5"> - <ul> -<li> - If <var>x</var> is a vector, then <code>std (<var>x</var>)</code> returns the standard - deviation of the elements in <var>x</var> defined as - $$ {\rm std}(x) = \sqrt{{1\over N-1} \sum_{i=1}^N |x_i - \bar x |^2} $$ - where <math>N</math> is the length of the <var>x</var> vector. - - </li><li> - If <var>x</var> is a matrix, then <code>std (<var>x</var>)</code> returns a row vector with - the standard deviation of each column in <var>x</var>. - - </li><li> - If <var>x</var> is a multi-dimensional array, then <code>std (<var>x</var>)</code> operates - along the first non-singleton dimension of <var>x</var>. - </li></ul> - -<p> <code>std (<var>x</var>, <var>w</var>)</code> specifies a weighting scheme. When <var>w</var> = 0 - (default), the standard deviation is normalized by N-1 (population standard - deviation), where N is the number of observations. When <var>w</var> = 1, the - standard deviation is normalized by the number of observations (sample - standard deviation). To use the default value you may pass an empty input - argument [] before entering other options. +<p> The standard deviation is defined as + $$ {\rm std}(x) = \sqrt{{1\over N-1} \sum_{i=1}^N (x_i - \bar x )^2} $$ +</p> +<p> If <var>x</var> is an array, compute the standard deviation along the first + non-singleton dimensions of <var>x</var>. +</p> +<p> The optional argument <var>w</var> determines the weighting scheme to use. Valid + values are: +</p> + <dl compact="compact"> +<dt> 0 [default]:</dt> +</dl> +<p> Normalize with <math>N-1</math> (population standard deviation). This provides + the square root of the best unbiased estimator of the standard deviation. </p> -<p> <var>w</var> can also be an array of non-negative numbers. When <var>w</var> is a - vector, it must have the same length as the number of elements in the - operating dimension of <var>x</var>. If <var>w</var> is a matrix or n-D array, or the - operating dimension is supplied as a <var>vecdim</var> or "all", <var>w</var> must be - the same size as <var>x</var>. NaN values are permitted in <var>w</var>, will be - multiplied with the associated values in <var>x</var>, and can be excluded by the - <var>nanflag</var> option. + </dd> +<dt> 1:</dt> +</dl> +<p> Normalize with <math>N</math> (sample standard deviation). This provides the + square root of the second moment around the mean. +</p> + </dd> +<dt> a vector:</dt> +</dl> +<p> Compute the weighted standard deviation with non-negative weights. + The length of <var>w</var> must equal the size of <var>x</var> in the operating + dimension. NaN values are permitted in <var>w</var>, will be multiplied with the + associated values in <var>x</var>, and can be excluded by the <var>nanflag</var> + option. +</p> + </dd> +<dt> an array:</dt> +</dl> +<p> Similar to vector weights, but <var>w</var> must be the same size as <var>x</var>. If + the operating dimension is supplied as <var>vecdim</var> or <code>"all"</code> and + <var>w</var> is not a scalar, <var>w</var> must be an same-sized array. + </p></dd> +</dl> + +<p> Note: <var>w</var> must always be specified before specifying any of the + following dimension options. To use the default value for <var>w</var> you + may pass an empty input argument []. </p> -<p> <code>std (<var>x</var>, [], <var>dim</var>)</code> returns the standard deviation along the - operating dimension <var>dim</var> of <var>x</var>. For <var>dim</var> greater than - <code>ndims (<var>x</var>)</code>, then <var>s</var> is returned as zeros of the same size as - <var>x</var> and <var>m</var> = <var>x</var>. +<p> The optional variable <var>dim</var> forces <code>std</code> to operate over the + specified dimension, which must be a positive integer-valued number. + Specifying any singleton dimension in <var>x</var>, including any dimension + exceeding <code>ndims (<var>x</var>)</code>, will result in a standard deviation of 0. </p> -<p> <code>std (<var>x</var>, [], <var>vecdim</var>)</code> returns the standard deviation over - the dimensions specified in the vector <var>vecdim</var>. For example, if <var>x</var> - is a 2-by-3-by-4 array, then <code>var (<var>x</var>, [1 2])</code> returns a - 1-by-1-by-4 array. Each element of the output array is the standard - deviation of the elements on the corresponding page of <var>x</var>. - If <var>vecdim</var> indexes all dimensions of <var>x</var>, then it is equivalent to - <code>std (<var>x</var>, "all")</code>. Any dimension in <var>vecdim</var> greater than - <code>ndims (<var>x</var>)</code> is ignored. +<p> Specifying the dimensions as <var>vecdim</var>, a vector of non-repeating + dimensions, will return the standard deviation calculated over the array + slice defined by <var>vecdim</var>. If <var>vecdim</var> indexes all dimensions of + <var>x</var>, then it is equivalent to the option <code>"all"</code>. Any + dimension in <var>vecdim</var> greater than <code>ndims (<var>x</var>)</code> is ignored. </p> -<p> <code>std (<var>x</var>, "all")</code> returns the standard deviation of all the - elements in <var>x</var>. The optional flag "all" cannot be used together with - <var>dim</var> or <var>vecdim</var> input arguments. +<p> Specifying the dimension as <code>"all"</code> will force <code>std</code> to + operate on all elements of <var>x</var>, and is equivalent to + <code>std (<var>x</var>(:))</code>. </p> -<p> <code>std (…, <var>nanflag</var>)</code> specifies whether to exclude NaN values - from the calculation using any of the input argument combinations in previous - syntaxes. The default value for <var>nanflag</var> is "includenan", and keeps NaN - values in the calculation. To exclude NaN values, set the value of - <var>nanflag</var> to "omitnan". +<p> The optional variable <var>nanflag</var> specifies whether to include or exclude + NaN values from the calculation using any of the previously specified input + argument combinations. The default value for <var>nanflag</var> is + <code>"includenan"</code> which keeps NaN values in the calculation. To + exclude NaN values set the value of <var>nanflag</var> to <code>"omitnan"</code>. + The output will still contain NaN values if <var>x</var> consists of all NaN + values in the operating dimension. </p> -<p> <code>[<var>s</var>, <var>m</var>] = std (…)</code> also returns the mean of the - elements of <var>x</var> used to calculate the standard deviation. If <var>s</var> is - the weighted standard deviation, then <var>m</var> is the weighted mean. +<p> The optional second output variable <var>m</var> contains the mean of the + elements of <var>x</var> used to calculate the standard deviation. If <var>v</var> is + the weighted standard deviation, then <var>m</var> is also the weighted mean. </p> <p> <strong>See also: </strong> <a href="var.html">var</a>, - <a href="mean.html">mean</a> +bounds, + <a href="mad.html">mad</a>, +range, +iqr, + <a href="mean.html">mean</a>, + <a href="median.html">median</a> </p> <p><strong>Source Code: </strong> <a href="https://github.com/gnu-octave/statistics/tree/main/inst/shadow9/std.m">std</a> diff --git a/docs/tLocationScaleDistribution.html b/docs/tLocationScaleDistribution.html index a84b0f8..7419e0f 100644 --- a/docs/tLocationScaleDistribution.html +++ b/docs/tLocationScaleDistribution.html @@ -195,9 +195,6 @@ <p><strong>Source Code: </strong> <a href="https://github.com/gnu-octave/statistics/tree/main/inst/dist_obj/tLocationScaleDistribution.m">tLocationScaleDistribution</a> </div> - - - <div class="container-xl my-4"> <div class="card rounded"> <div class="card-header card-header-mod"> @@ -257,7 +254,6 @@ </div> </div> - <div class="container-xl my-4"> <div class="card rounded"> <div class="card-header card-header-mod"> @@ -616,35 +612,6 @@ <div class="row d-flex flex-wrap align-items-center"> <div class="col-sm-3 col-md-5 mb-2 mb-sm-0"> <h3 class="d-inline-block mr-2"> - Method: <b><code>tLocationScaleDistribution</code></b> - </h3> - </div> - </div> - </div> - <div class="card-body"> -<dl> -<dt><u>tLocationScaleDistribution:</u> <var>v</var> = <b>var</b><i> (<var>pd</var>)</i></dt> -</dl> - -<p> Compute the variance of a probability distribution. -</p> -<div class="ms-5"> -<p> <code><var>v</var> = var (<var>pd</var>)</code> computes the standard deviation of the - probability distribution object, <var>pd</var>. -</p> - -</div> - - </div> - </div> - </div> - - <div class="container-xl my-4"> - <div class="card rounded"> - <div class="card-header card-header-mod"> - <div class="row d-flex flex-wrap align-items-center"> - <div class="col-sm-3 col-md-5 mb-2 mb-sm-0"> - <h3 class="d-inline-block mr-2"> Method: <b><code>truncate</code></b> </h3> </div> diff --git a/docs/var.html b/docs/var.html index 3a827ec..5983816 100644 --- a/docs/var.html +++ b/docs/var.html @@ -71,78 +71,93 @@ </div> <div class="card-body"> <dl> -<dt><u>statistics:</u> <var>v</var> = <b>var</b><i> (<var>x</var>)</i></dt> -<dt><u>statistics:</u> <var>v</var> = <b>var</b><i> (<var>x</var>, <var>w</var>)</i></dt> -<dt><u>statistics:</u> <var>v</var> = <b>var</b><i> (<var>x</var>, <var>w</var>, "all")</i></dt> -<dt><u>statistics:</u> <var>v</var> = <b>var</b><i> (<var>x</var>, <var>w</var>, <var>dim</var>)</i></dt> -<dt><u>statistics:</u> <var>v</var> = <b>var</b><i> (<var>x</var>, <var>w</var>, <var>vecdim</var>)</i></dt> -<dt><u>statistics:</u> <var>v</var> = <b>var</b><i> (…, <var>nanflag</var>)</i></dt> -<dt><u>statistics:</u> [<var>v</var>, <var>m</var>] = <b>var</b><i> (…)</i></dt> +<dt><u>:</u> <var>v</var> = <b>var</b><i> (<var>x</var>)</i></dt> +<dt><u>:</u> <var>v</var> = <b>var</b><i> (<var>x</var>, <var>w</var>)</i></dt> +<dt><u>:</u> <var>v</var> = <b>var</b><i> (<var>x</var>, <var>w</var>, <var>dim</var>)</i></dt> +<dt><u>:</u> <var>v</var> = <b>var</b><i> (<var>x</var>, <var>w</var>, <var>vecdim</var>)</i></dt> +<dt><u>:</u> <var>v</var> = <b>var</b><i> (<var>x</var>, <var>w</var>, <code>"all"</code>)</i></dt> +<dt><u>:</u> <var>v</var> = <b>var</b><i> (…, <var>nanflag</var>)</i></dt> +<dt><u>:</u> [<var>v</var>, <var>m</var>] = <b>var</b><i> (…)</i></dt> </dl> - -<p> Compute the variance of the elements of <var>x</var>. +<p> Compute the variance of the elements of the vector <var>x</var>. </p> <div class="ms-5"> - <ul> -<li> - If <var>x</var> is a vector, then <code>var(<var>x</var>)</code> returns the variance of the - elements in <var>x</var> defined as - $$ {\rm var}(x) = {1\over N-1} \sum_{i=1}^N |x_i - \bar x |^2 $$ - where <math>N</math> is the length of the <var>x</var> vector. - - </li><li> - If <var>x</var> is a matrix, then <code>var (<var>x</var>)</code> returns a row vector with - the variance of each column in <var>x</var>. - - </li><li> - If <var>x</var> is a multi-dimensional array, then <code>var (<var>x</var>)</code> operates - along the first non-singleton dimension of <var>x</var>. - </li></ul> - -<p> <code>var (<var>x</var>, <var>w</var>)</code> specifies a weighting scheme. When <var>w</var> = 0 - (default), the variance is normalized by N-1 (population variance) where N is - the number of observations. When <var>w</var> = 1, the variance is normalized by - the number of observations (sample variance). To use the default value you - may pass an empty input argument [] before entering other options. +<p> The variance is defined as + $$ {\rm var}(x) = {1\over N-1} \sum_{i=1}^N (x_i - \bar x )^2 $$ +</p> +<p> If <var>x</var> is an array, compute the variance along the first non-singleton + dimensions of <var>x</var>. +</p> +<p> The optional argument <var>w</var> determines the weighting scheme to use. Valid + values are: +</p> + <dl compact="compact"> +<dt> 0 [default]:</dt> +</dl> +<p> Normalize with <math>N-1</math> (population variance). This provides the square + root of the best unbiased estimator of the variance. </p> -<p> <var>w</var> can also be an array of non-negative numbers. When <var>w</var> is a - vector, it must have the same length as the number of elements in the - operating dimension of <var>x</var>. If <var>w</var> is a matrix or n-D array, or the - operating dimension is supplied as a <var>vecdim</var> or "all", <var>w</var> must be - the same size as <var>x</var>. NaN values are permitted in <var>w</var>, will be - multiplied with the associated values in <var>x</var>, and can be excluded by the - <var>nanflag</var> option. + </dd> +<dt> 1:</dt> +</dl> +<p> Normalize with <math>N</math> (sample variance). This provides the square root of + the second moment around the mean. +</p> + </dd> +<dt> a vector:</dt> +</dl> +<p> Compute the weighted variance with non-negative weights. The length of + <var>w</var> must equal the size of <var>x</var> in the operating dimension. NaN + values are permitted in <var>w</var>, will be multiplied with the associated + values in <var>x</var>, and can be excluded by the <var>nanflag</var> option. +</p> + </dd> +<dt> an array:</dt> +</dl> +<p> Similar to vector weights, but <var>w</var> must be the same size as <var>x</var>. If + the operating dimension is supplied as <var>vecdim</var> or <code>"all"</code> and + <var>w</var> is not a scalar, <var>w</var> must be an same-sized array. + </p></dd> +</dl> + +<p> Note: <var>w</var> must always be specified before specifying any of the + following dimension options. To use the default value for <var>w</var> you + may pass an empty input argument []. </p> -<p> <code>var (<var>x</var>, [], <var>dim</var>)</code> returns the variance along the operating - dimension <var>dim</var> of <var>x</var>. For <var>dim</var> greater than - <code>ndims (<var>x</var>)</code> <var>v</var> is returned as zeros of the same size as - <var>x</var> and <var>m</var> = <var>x</var>. +<p> The optional variable <var>dim</var> forces <code>var</code> to operate over the + specified dimension, which must be a positive integer-valued number. + Specifying any singleton dimension in <var>x</var>, including any dimension + exceeding <code>ndims (<var>x</var>)</code>, will result in a variance of 0. </p> -<p> <code>var (<var>x</var>, [], <var>vecdim</var>)</code> returns the variance over the - dimensions specified in the vector <var>vecdim</var>. For example, if <var>x</var> - is a 2-by-3-by-4 array, then <code>var (<var>x</var>, [1 2])</code> returns a - 1-by-1-by-4 array. Each element of the output array is the variance of the - elements on the corresponding page of <var>x</var>. If <var>vecdim</var> indexes all - dimensions of <var>x</var>, then it is equivalent to <code>var (<var>x</var>, "all")</code>. - Any dimension in <var>vecdim</var> greater than <code>ndims (<var>x</var>)</code> is ignored. +<p> Specifying the dimensions as <var>vecdim</var>, a vector of non-repeating + dimensions, will return the variance calculated over the array slice defined + by <var>vecdim</var>. If <var>vecdim</var> indexes all dimensions of <var>x</var>, then it + is equivalent to the option <code>"all"</code>. Any dimension in <var>vecdim</var> + greater than <code>ndims (<var>x</var>)</code> is ignored. </p> -<p> <code>var (<var>x</var>, "all")</code> returns the variance of all the elements in - <var>x</var>. The optional flag "all" cannot be used together with <var>dim</var> or - <var>vecdim</var> input arguments. +<p> Specifying the dimension as <code>"all"</code> will force <code>var</code> to + operate on all elements of <var>x</var>, and is equivalent to <code>var + (<var>x</var>(:))</code>. </p> -<p> <code>var (…, <var>nanflag</var>)</code> specifies whether to exclude NaN values - from the calculation using any of the input argument combinations in previous - syntaxes. The default value for <var>nanflag</var> is "includenan", and keeps NaN - values in the calculation. To exclude NaN values, set the value of - <var>nanflag</var> to "omitnan". +<p> The optional variable <var>nanflag</var> specifies whether to include or exclude + NaN values from the calculation using any of the previously specified input + argument combinations. The default value for <var>nanflag</var> is + <code>"includenan"</code> which keeps NaN values in the calculation. To + exclude NaN values set the value of <var>nanflag</var> to <code>"omitnan"</code>. + The output will still contain NaN values if <var>x</var> consists of all NaN + values in the operating dimension. </p> -<p> <code>[<var>v</var>, <var>m</var>] = var (…)</code> also returns the mean of the +<p> The optional second output variable <var>m</var> contains the mean of the elements of <var>x</var> used to calculate the variance. If <var>v</var> is the - weighted variance, then <var>m</var> is the weighted mean. + weighted variance, then <var>m</var> is also the weighted mean. </p> <p> <strong>See also: </strong> <a href="std.html">std</a>, - <a href="mean.html">mean</a> + <a href="mean.html">mean</a>, +cov, +skewness, +kurtosis, +moment </p> <p><strong>Source Code: </strong> <a href="https://github.com/gnu-octave/statistics/tree/main/inst/shadow9/var.m">var</a> diff --git a/inst/PKG_DEL b/inst/PKG_DEL index 1dcc67a..aef2dae 100644 --- a/inst/PKG_DEL +++ b/inst/PKG_DEL @@ -1,4 +1,4 @@ -clear -f libsvmread libsvmwrite svmpredict svmtrain +clear -f editDistance libsvmread libsvmwrite svmpredict svmtrain if (compare_versions (version (), "9", "<")) a1_e324kporit985_itogj3_dirlist = ... diff --git a/inst/anovan.m b/inst/anovan.m index f5d1a0b..9005ffd 100644 --- a/inst/anovan.m +++ b/inst/anovan.m @@ -519,10 +519,12 @@ function [P, T, STATS, TERMS] = anovan (Y, GROUP, varargin) endif TERMS = zeros (N + Nx, N); TERMS(1:N,:) = eye (N); + cnt = N + 1; for j = 1:N for i = j:N-1 - TERMS(N+j+i-1,j) = 1; - TERMS(N+j+i-1,i+1) = 1; + TERMS(cnt,j) = 1; + TERMS(cnt,i+1) = 1; + cnt++; endfor endfor otherwise @@ -804,7 +806,7 @@ function [P, T, STATS, TERMS] = anovan (Y, GROUP, varargin) title ("Normal Q-Q Plot"); arrayfun (@(i) text (q(I == DI(i)), t(DI(i)), ... sprintf (" %u", DI(i))), [1:min(nk,n)]) - iqr = [0.25; 0.75]; + iqr = [0.25; 0.75]; yl = quantile (t, iqr, 1, 6); xl = norminv (iqr); slope = diff (yl) / diff (xl); @@ -821,14 +823,14 @@ function [P, T, STATS, TERMS] = anovan (Y, GROUP, varargin) ylabel ("sqrt ( | Studentized Residuals | )"); title ("Spread-Location Plot") ax2_xlim = get (gca, "XLim"); - hold on; + hold on; plot (ax2_xlim, ones (1, 2) * sqrt (2), "k:"); - plot (ax2_xlim, ones (1, 2) * sqrt (3), "k-."); + plot (ax2_xlim, ones (1, 2) * sqrt (3), "k-."); plot (ax2_xlim, ones (1, 2) * sqrt (4), "k--"); hold off; arrayfun (@(i) text (fit(DI(i)), sqrt (abs (t(DI(i)))), ... sprintf (" %u", DI(i))), [1:min(nk,n)]); - xlim (ax2_xlim); + xlim (ax2_xlim); ## Residual-Leverage plot subplot (2, 2, 3); @@ -855,7 +857,7 @@ function [P, T, STATS, TERMS] = anovan (Y, GROUP, varargin) xlim ([0, n]); ax4_xlim = get (gca, "XLim"); ax4_ylim = get (gca, "YLim"); - hold on; + hold on; plot (ax4_xlim, ones (1, 2) * 4 / dfe, "k:"); plot (ax4_xlim, ones (1, 2) * 0.5, "k-."); plot (ax4_xlim, ones (1, 2), "k--"); diff --git a/inst/dist_fun/fpdf.m b/inst/dist_fun/fpdf.m index 95b63ac..d349cfa 100644 --- a/inst/dist_fun/fpdf.m +++ b/inst/dist_fun/fpdf.m @@ -108,6 +108,7 @@ endfunction %!assert (fpdf (x, 2, [0 NaN Inf 2 2]), [NaN NaN NaN y(4:5)], eps) %!assert (fpdf ([x, NaN], 2, 2), [y, NaN], eps) %!test #F (x, 1, df1) == T distribution (sqrt (x), df1) / sqrt (x) +%! rand ("seed", 1234); # for reproducibility %! xr = rand (10,1); %! xr = xr(x > 0.1 & x < 0.9); %! yr = tpdf (sqrt (xr), 2) ./ sqrt (xr); diff --git a/inst/dist_fun/gumbelinv.m b/inst/dist_fun/gumbelinv.m index 99eaf98..162d3f7 100644 --- a/inst/dist_fun/gumbelinv.m +++ b/inst/dist_fun/gumbelinv.m @@ -111,25 +111,25 @@ function [x, xlo, xup] = gumbelinv (p, mu, beta, pcov, alpha) ## Compute inverse of type 1 extreme value cdf k = (eps <= p & p < 1); if (all (k(:))) - q = log (-log (p)); + q = -log (-log (p)); else q = zeros (size (p), is_class); - q(k) = log (-log (p(k))); + q(k) = -log (-log (p(k))); ## Return -Inf for p = 0 and Inf for p = 1 - q(p < eps) = Inf; - q(p == 1) = -Inf; + q(p < eps) = -Inf; + q(p == 1) = Inf; ## Return NaN for out of range values of P q(p < 0 | 1 < p | isnan (p)) = NaN; endif ## Return NaN for out of range values of BETA beta(beta <= 0) = NaN; - x = -(beta .* q + mu); + x = (beta .* q) + mu; ## Compute confidence bounds if requested. if (nargout >= 2) xvar = pcov(1,1) + 2 * pcov(1,2) * q + pcov(2,2) * q .^ 2; - if (any (xvar < 0)) + if (any (xvar < 0)) || any(isnan(xvar)) error ("gumbelinv: bad covariance matrix."); endif z = -norminv (alpha / 2); @@ -164,7 +164,7 @@ endfunction %!assert (gumbelinv (p, zeros (1,4), ones (1,4)), x, 1e-4) %!assert (gumbelinv (p, 0, ones (1,4)), x, 1e-4) %!assert (gumbelinv (p, zeros (1,4), 1), x, 1e-4) -%!assert (gumbelinv (p, [0, -Inf, NaN, Inf], 1), [-Inf, Inf, NaN, -Inf], 1e-4) +%!assert (gumbelinv (p, [0, -Inf, NaN, Inf], 1), [-Inf, -Inf, NaN, Inf], 1e-4) %!assert (gumbelinv (p, 0, [Inf, NaN, -1, 0]), [-Inf, NaN, NaN, NaN], 1e-4) %!assert (gumbelinv ([p(1:2), NaN, p(4)], 0, 1), [x(1:2), NaN, x(4)], 1e-4) @@ -174,6 +174,11 @@ endfunction %!assert (gumbelinv ([p, NaN], single (0), 1), single ([x, NaN]), 1e-4) %!assert (gumbelinv ([p, NaN], 0, single (1)), single ([x, NaN]), 1e-4) +## Test whether gumbelcdf is successfully inverted +%! p = [0.05, 0.5, 0.95]; +%! x = gumbelinv(p); +%!assert (gumbelcdf(x), p, 1e-4) + ## Test input validation %!error<gumbelinv: invalid number of input arguments.> gumbelinv () %!error gumbelinv (1,2,3,4,5,6) diff --git a/inst/dist_obj/BinomialDistribution.m b/inst/dist_obj/BinomialDistribution.m index c87e606..3a1c564 100644 --- a/inst/dist_obj/BinomialDistribution.m +++ b/inst/dist_obj/BinomialDistribution.m @@ -284,7 +284,11 @@ classdef BinomialDistribution Fa_b = binocdf ([lx, ux], this.N, this.p); m = binoinv (sum (Fa_b) / 2, this.N, this.p); else - m = binoinv (0.5, this.N, this.p); + if (! __traditional__() & this.p == 0.5 & rem (this.N, 2) == 1) + m = this.mean (); + else + m = binoinv (0.5, this.N, this.p); + endif endif endfunction @@ -662,7 +666,7 @@ endfunction #%!assert (iqr (t), 1); %!assert (mean (pd), 2.5, 1e-10); #%!assert (mean (t), 2.8, 1e-10); -%!assert (median (pd), 3); +%!assert (median (pd), 2.5); #%!assert (median (t), 3); %!assert (pdf (pd, [0:5]), [0.0312, 0.1562, 0.3125, 0.3125, 0.1562, 0.0312], 1e-4); #%!assert (pdf (t, [0:5]), [0, 0, 0.4, 0.4, 0.2, 0], 1e-4); diff --git a/inst/dist_obj/GammaDistribution.m b/inst/dist_obj/GammaDistribution.m index c4007d0..97620bc 100644 --- a/inst/dist_obj/GammaDistribution.m +++ b/inst/dist_obj/GammaDistribution.m @@ -66,8 +66,8 @@ classdef GammaDistribution ## @code{negloglik}, @code{paramci}, @code{pdf}, @code{plot}, @code{proflik}, ## @code{random}, @code{std}, @code{truncate}, @code{var}. ## - ## Further information about the inverse Gaussian distribution can be found at - ## @url{https://en.wikipedia.org/wiki/Inverse_Gaussian_distribution} + ## Further information about the Gamma distribution can be found at + ## @url{https://en.wikipedia.org/wiki/Gamma_distribution} ## ## @seealso{fitdist, makedist, gamcdf, gaminv, gampdf, gamrnd, lognfit, ## gamlike, gamstat} diff --git a/inst/dist_obj/LogisticDistribution.m b/inst/dist_obj/LogisticDistribution.m index e4e7151..4e13062 100644 --- a/inst/dist_obj/LogisticDistribution.m +++ b/inst/dist_obj/LogisticDistribution.m @@ -67,7 +67,7 @@ classdef LogisticDistribution ## @code{random}, @code{std}, @code{truncate}, @code{var}. ## ## Further information about the logistic distribution can be found at - ## @url{https://en.wikipedia.org/wiki/Log-normal_distribution} + ## @url{https://en.wikipedia.org/wiki/Logistic_distribution} ## ## OCTAVE/MATLAB use an alternative parameterization given by the pair ## @math{μ, s}, i.e. @var{mu} and @var{sigma}, in analogy with the logistic diff --git a/inst/dist_obj/LoglogisticDistribution.m b/inst/dist_obj/LoglogisticDistribution.m index 87c0b4e..8766617 100644 --- a/inst/dist_obj/LoglogisticDistribution.m +++ b/inst/dist_obj/LoglogisticDistribution.m @@ -67,7 +67,7 @@ classdef LoglogisticDistribution ## @code{random}, @code{std}, @code{truncate}, @code{var}. ## ## Further information about the loglogistic distribution can be found at - ## @url{https://en.wikipedia.org/wiki/Log-normal_distribution} + ## @url{https://en.wikipedia.org/wiki/Loglogistic_distribution} ## ## OCTAVE/MATLAB use an alternative parameterization given by the pair ## @math{μ, s}, i.e. @var{mu} and @var{sigma}, in analogy with the logistic diff --git a/inst/dist_obj/LoguniformDistribution.m b/inst/dist_obj/LoguniformDistribution.m index 702696b..5869975 100644 --- a/inst/dist_obj/LoguniformDistribution.m +++ b/inst/dist_obj/LoguniformDistribution.m @@ -19,12 +19,12 @@ classdef LoguniformDistribution ## -*- texinfo -*- ## @deftypefn {statistics} LoguniformDistribution ## - ## Loguniform probability distribution object. + ## Log-uniform probability distribution object. ## ## A @code{LoguniformDistribution} object consists of parameters, a model - ## description, and sample data for a loguniform probability distribution. + ## description, and sample data for a log-uniform probability distribution. ## - ## The loguniform distribution uses the following parameters. + ## The log-uniform distribution uses the following parameters. ## ## @multitable @columnfractions 0.25 0.48 0.27 ## @headitem @var{Parameter} @tab @var{Description} @tab @var{Support} @@ -39,7 +39,7 @@ classdef LoguniformDistribution ## @item Create a distribution with specified parameter values using the ## @code{makedist} function. ## @item Use the constructor @qcode{LoguniformDistribution (@var{Lower})} - ## to create a loguniform distribution with specified parameter values. + ## to create a log-uniform distribution with specified parameter values. ## @end itemize ## ## It is highly recommended to use the @code{makedist} function to create @@ -60,7 +60,7 @@ classdef LoguniformDistribution ## @code{pdf}, @code{plot}, @code{random}, @code{std}, @code{truncate}, ## @code{var}. ## - ## Further information about the loguniform distribution can be found at + ## Further information about the log-uniform distribution can be found at ## @url{https://en.wikipedia.org/wiki/Reciprocal_distribution} ## ## @seealso{fitdist, makedist} diff --git a/inst/dist_obj/MultinomialDistribution.m b/inst/dist_obj/MultinomialDistribution.m index f109d3b..571dfe1 100644 --- a/inst/dist_obj/MultinomialDistribution.m +++ b/inst/dist_obj/MultinomialDistribution.m @@ -367,7 +367,7 @@ classdef MultinomialDistribution if (! isscalar (this)) error ("plot: requires a scalar probability distribution."); endif - h = __plot__ (this, false, varargin{:}); + h = __plot__ (this, true, varargin{:}); if (nargout > 0) varargout{1} = h; endif @@ -500,8 +500,9 @@ endclassdef function checkparams (Probabilities) if (! (isvector (Probabilities) && isnumeric (Probabilities) && isreal (Probabilities) && isfinite (Probabilities) && - sum (Probabilities) == 1)) - error ("MultinomialDistribution: PROBABILITIES must be a positive real scalar.") + abs (sum (Probabilities) - 1) < eps * 100)) + error (["MultinomialDistribution: PROBABILITIES must be a vector", ... + " of positive real scalars that sum up to 1."]) endif endfunction @@ -544,19 +545,19 @@ endfunction ## Test input validation ## 'MultinomialDistribution' constructor -%!error <MultinomialDistribution: PROBABILITIES must be a positive real scalar.> ... +%!error <MultinomialDistribution: PROBABILITIES must be a vector of positive real scalars that sum up to 1.> ... %! MultinomialDistribution(0) -%!error <MultinomialDistribution: PROBABILITIES must be a positive real scalar.> ... +%!error <MultinomialDistribution: PROBABILITIES must be a vector of positive real scalars that sum up to 1.> ... %! MultinomialDistribution(-1) -%!error <MultinomialDistribution: PROBABILITIES must be a positive real scalar.> ... +%!error <MultinomialDistribution: PROBABILITIES must be a vector of positive real scalars that sum up to 1.> ... %! MultinomialDistribution(Inf) -%!error <MultinomialDistribution: PROBABILITIES must be a positive real scalar.> ... +%!error <MultinomialDistribution: PROBABILITIES must be a vector of positive real scalars that sum up to 1.> ... %! MultinomialDistribution(i) -%!error <MultinomialDistribution: PROBABILITIES must be a positive real scalar.> ... +%!error <MultinomialDistribution: PROBABILITIES must be a vector of positive real scalars that sum up to 1.> ... %! MultinomialDistribution("a") -%!error <MultinomialDistribution: PROBABILITIES must be a positive real scalar.> ... +%!error <MultinomialDistribution: PROBABILITIES must be a vector of positive real scalars that sum up to 1.> ... %! MultinomialDistribution([1, 2]) -%!error <MultinomialDistribution: PROBABILITIES must be a positive real scalar.> ... +%!error <MultinomialDistribution: PROBABILITIES must be a vector of positive real scalars that sum up to 1.> ... %! MultinomialDistribution(NaN) ## 'cdf' method diff --git a/inst/dist_obj/NegativeBinomialDistribution.m b/inst/dist_obj/NegativeBinomialDistribution.m index ab3a214..71b756b 100644 --- a/inst/dist_obj/NegativeBinomialDistribution.m +++ b/inst/dist_obj/NegativeBinomialDistribution.m @@ -426,7 +426,7 @@ classdef NegativeBinomialDistribution if (! isscalar (this)) error ("plot: requires a scalar probability distribution."); endif - h = __plot__ (this, false, varargin{:}); + h = __plot__ (this, true, varargin{:}); if (nargout > 0) varargout{1} = h; endif diff --git a/inst/dist_obj/PiecewiseLinearDistribution.m b/inst/dist_obj/PiecewiseLinearDistribution.m index 9a51c62..fd32296 100644 --- a/inst/dist_obj/PiecewiseLinearDistribution.m +++ b/inst/dist_obj/PiecewiseLinearDistribution.m @@ -19,12 +19,12 @@ classdef PiecewiseLinearDistribution ## -*- texinfo -*- ## @deftypefn {statistics} PiecewiseLinearDistribution ## - ## Continuous uniform probability distribution object. + ## Piecewise linear probability distribution object. ## ## A @code{PiecewiseLinearDistribution} object consists of parameters, a model ## description, and sample data for a uniform probability distribution. ## - ## The uniform distribution uses the following parameters. + ## The piecewise linear distribution uses the following parameters. ## ## @multitable @columnfractions 0.25 0.48 0.27 ## @headitem @var{Parameter} @tab @var{Description} @tab @var{Support} @@ -35,7 +35,8 @@ classdef PiecewiseLinearDistribution ## @math{x} @tab @math{0 <= Fx <= 1} ## @end multitable ## - ## There are several ways to create a @code{PiecewiseLinearDistribution} object. + ## There are several ways to create a @code{PiecewiseLinearDistribution} + ## object. ## ## @itemize ## @item Create a distribution with specified parameter values using the @@ -502,7 +503,7 @@ endfunction %!assert (iqr (pd), 50.0833, 1e-4); %!assert (iqr (t), 36.8077, 1e-4); %!assert (mean (pd), 153.61, 1e-10); -%!assert (mean (t), 152.311, 1e-4); +%!assert (mean (t), 152.311, 1e-3); %!assert (median (pd), 142, 1e-10); %!assert (median (t), 141.9462, 1e-4); %!assert (pdf (pd, [120, 130, 140, 150, 200]), [0.0133, 0.0240, 0.0186, 0.0024, 0.0046], 1e-4); diff --git a/inst/dist_obj/PoissonDistribution.m b/inst/dist_obj/PoissonDistribution.m index 24b3c7a..770c490 100644 --- a/inst/dist_obj/PoissonDistribution.m +++ b/inst/dist_obj/PoissonDistribution.m @@ -66,7 +66,7 @@ classdef PoissonDistribution ## @code{random}, @code{std}, @code{truncate}, @code{var}. ## ## Further information about the Poisson distribution can be found at - ## @url{https://en.wikipedia.org/wiki/Rayleigh_distribution} + ## @url{https://en.wikipedia.org/wiki/Poisson_distribution} ## ## @seealso{fitdist, makedist, poisscdf, poissinv, poisspdf, poissrnd, ## poissfit, poisslike, poisstat} @@ -407,7 +407,7 @@ classdef PoissonDistribution if (! isscalar (this)) error ("plot: requires a scalar probability distribution."); endif - h = __plot__ (this, false, varargin{:}); + h = __plot__ (this, true, varargin{:}); if (nargout > 0) varargout{1} = h; endif diff --git a/inst/dist_obj/RicianDistribution.m b/inst/dist_obj/RicianDistribution.m index a4c62f6..6be5e1d 100644 --- a/inst/dist_obj/RicianDistribution.m +++ b/inst/dist_obj/RicianDistribution.m @@ -67,7 +67,7 @@ classdef RicianDistribution ## @code{random}, @code{std}, @code{truncate}, @code{var}. ## ## Further information about the Rician distribution can be found at - ## @url{https://en.wikipedia.org/wiki/Weibull_distribution} + ## @url{https://en.wikipedia.org/wiki/Rice_distribution} ## ## @seealso{fitdist, makedist, ricecdf, riceinv, ricepdf, ricernd, ricefit, ## ricelike, ricestat} diff --git a/inst/dist_obj/TriangularDistribution.m b/inst/dist_obj/TriangularDistribution.m index 9976bc2..4fbb2d4 100644 --- a/inst/dist_obj/TriangularDistribution.m +++ b/inst/dist_obj/TriangularDistribution.m @@ -62,8 +62,8 @@ classdef TriangularDistribution ## @code{pdf}, @code{plot}, @code{random}, @code{std}, @code{truncate}, ## @code{var}. ## - ## Further information about the continuous triangular distribution can be found - ## at @url{https://en.wikipedia.org/wiki/Continuous_uniform_distribution} + ## Further information about the triangular distribution can be found + ## at @url{https://en.wikipedia.org/wiki/Triangular_distribution} ## ## @seealso{makedist, tricdf, triinv, tripdf, trirnd, tristat} ## @end deftypefn diff --git a/inst/dist_obj/private/__plot__.m b/inst/dist_obj/private/__plot__.m index 4e49d1f..69c057e 100644 --- a/inst/dist_obj/private/__plot__.m +++ b/inst/dist_obj/private/__plot__.m @@ -23,11 +23,12 @@ ## ## @end deftypefn -function h = __plot__ (pd, Discrete, varargin) +function h = __plot__ (pd, DistType, varargin) ## Add defaults (Discrete is passed by the calling method) - h = []; + ax = []; PlotType = "pdf"; + Discrete = DistType; ## Parse optional agruments if (mod (numel (varargin), 2) != 0) @@ -53,7 +54,7 @@ function h = __plot__ (pd, Discrete, varargin) error ("plot: invalid VALUE for 'Discrete' argument."); endif ## Only for discrete distributions this can be changed by the user - if (Discrete) + if (DistType) Discrete = varargin{2}; endif @@ -61,7 +62,7 @@ function h = __plot__ (pd, Discrete, varargin) if (! isaxes (varargin{2})) error ("plot: invalid VALUE for 'Parent' argument."); endif - h = varargin{2}; + ax = varargin{2}; otherwise error ("plot: invalid NAME for optional argument."); @@ -71,10 +72,199 @@ function h = __plot__ (pd, Discrete, varargin) endwhile ## Get current axes or create new ones - if (isempty (h)) - h = cga; + if (isempty (ax)) + ax = gca (); endif + ## Switch to PlotType + switch (PlotType) + case "pdf" + h = plot_pdf (pd, ax, DistType, Discrete); + case "cdf" + case "probability" + + endswitch + +endfunction + +function x = expand_freq (data, freq) + x = []; + for i = 1:numel (freq) + x = [x, repmat(data(i), 1, freq(i))]; + endfor +endfunction + +function h = plot_pdf (pd, ax, DistType, Discrete) + + ## Handle special case of multinomial distribution + if (strcmpi (pd.DistributionCode, "mn")) + y = pd.ParameterValues'; + x = [1:numel(y)]'; + if (Discrete) + h = stem (ax, x, y, "color", "b"); + else + h = plot (ax, x, y, ";;b-"); + endif + xlim ([0.5, max(x)+0.5]); + xlabel ("Data"); + ylabel ("Probability"); + return + endif + + ## Handle special case of piecewise linear distribution + if (strcmpi (pd.DistributionCode, "pl")) + x = pd.ParameterValues(:,1); + y = pd.ParameterValues(:,2); + h = plot (ax, x, y, ";;b-"); + xgap = (x(end) - x(1)) * 0.1; + xlim ([x(1)-xgap, x(end)+xgap]); + xlabel ("Data"); + ylabel ("Probability"); + return + endif + + ## Handle special case of triangular distribution + if (strcmpi (pd.DistributionCode, "tri")) + lb = pd.A; + ub = pd.C; + xmin = lb - (ub - lb) * 0.1; + xmax = ub + (ub - lb) * 0.1; + x = [lb:(ub-lb)/100:ub]'; + y = pdf (pd, x); + h = plot (ax, x, y, ";;r-", "linewidth", 2); + xlim ([xmin, xmax]); + xlabel ("Data"); + ylabel ("PDF"); + return + endif + + ## Handle special case of log-uniform and uniform distributions + if (any (strcmpi (pd.DistributionCode, {"logu", "unif"}))) + lb = pd.Lower; + ub = pd.Upper; + xmin = lb - (ub - lb) * 0.1; + xmax = ub + (ub - lb) * 0.1; + x = [lb:(ub-lb)/100:ub]'; + y = pdf (pd, x); + h = plot (ax, x, y, ";;r-", "linewidth", 2); + xlim ([xmin, xmax]); + xlabel ("Data"); + ylabel ("PDF"); + return + endif + + ## Check for fitted distribution + if (isempty (pd.InputData)) # fixed parameters, no data + + ## Compute moments to determine plot boundaries + m = mean (pd); + s = std (pd); + lb = m - 3 * s; + ub = m + 3 * s; + xmin = m - 3.5 * s; + xmax = m + 3.5 * s; + + ## Fix boundaries for specific distributions + PD = {"bino", "bisa", "burr", "exp", "gam", "invg", "logl", ... + "logn", "naka", "nbin", "poiss", "rayl", "rice", "wbl"}; + if (strcmpi (pd.DistributionCode, "beta")) + lb = xmin = 0; + ub = xmax = 1; + elseif (any (strcmpi (pd.DistributionCode, PD))) + lb = max (m - 3 * s, 0); + xmin = max (m - 3.5 * s, 0); + elseif (strcmpi (pd.DistributionCode, "gev")) + + elseif (strcmpi (pd.DistributionCode, "gp")) + + elseif (strcmpi (pd.DistributionCode, "hn")) + lb = max (m - 3 * s, m); + xmin = max (m - 3.5 * s, m); + endif + + ## Compute stem or line for PDF + if (DistType) + x = [floor(lb):ceil(ub)]'; + y = pdf (pd, x); + else + x = [lb:(ub-lb)/100:ub]'; + y = pdf (pd, x); + endif + + ## Plot + if (Discrete) + h = stem (ax, x, y, "color", "r"); + xlim ([min(y)-0.5, max(y)+0.5]); + xlabel ("Data"); + ylabel ("Probability"); + else + h = plot (ax, x, y, ";;r-", "linewidth", 2); + xlim ([xmin, xmax]); + xlabel ("Data"); + ylabel ("PDF"); + endif + + else # fitted distribution, data available + + ## Expand frequency vector (if necessary) + if (any (pd.InputData.freq != 1)) + x = expand_freq (pd.InputData.data, pd.InputData.freq); + else + x = pd.InputData.data; + endif + + ## Compute the patch or histogram for data + if (DistType) + binwidth = 1; + xmin = min (x) - 1; + xmax = max (x) + 1; + [binsize, bincenter] = hist (x, [xmin:xmax]); + else + xsize = numel (x); + nbins = ceil (sqrt (xsize)); + [binsize, bincenter] = hist (x, nbins); + binwidth = max (diff (bincenter)); + xmin = min (x) - binwidth / 2; + xmax = max (x) + binwidth / 2; + endif + + ## Compute stem or line for PDF + if (DistType) + x = [min(x):max(x)]'; + y = pdf (pd, x); + else + x = [xmin:(xmax-xmin)/100:xmax]'; + y = pdf (pd, x); + endif + + ## Normalize density line + y = xsize * y * binwidth; + + ## Plot + if (DistType) + h(2) = patch (ax, bincenter, binsize, 1, "facecolor", "b"); + hold on; + if (Discrete) + h(1) = stem (ax, x, y, "color", "r"); + else + h(1) = plot (ax, x, y, ";;r-"); + endif + xlim ([xmin, xmax]); + xlabel ("Data"); + ylabel ("Probability"); + hold off; + else + h(2) = bar (ax, bincenter, binsize, 1, "facecolor", "b"); + hold on; + h(1) = plot (ax, x, y, ";;r-", "linewidth", 2); + xlim ([xmin, xmax]); + xlabel ("Data"); + ylabel ("PDF"); + hold off; + endif + endif endfunction + + diff --git a/inst/dist_wrap/fitdist.m b/inst/dist_wrap/fitdist.m index 3925f9b..ef333d8 100644 --- a/inst/dist_wrap/fitdist.m +++ b/inst/dist_wrap/fitdist.m @@ -69,7 +69,7 @@ ## @qcode{"By"}, @var{groupvar})} creates probability distribution objects by ## fitting the distribution specified by @var{distname} to the data in @var{x} ## based on the grouping variable @var{groupvar}. It returns a cell array of -## fitted probability distribution objec@var{pdca}pdca, a cell array of group +## fitted probability distribution object, @var{pdca}, a cell array of group ## labels, @var{gn}, and a cell array of grouping variable levels, @var{gl}. ## ## @code{[@var{pdca}, @var{gn}, @var{gl}] = fitdist (@var{x}, @var{distname}, @@ -77,7 +77,10 @@ ## output arguments using additional options specified by one or more ## @qcode{Name-Value} pair arguments mentioned above. ## -## @seealso{fitdist} +## Note: calling @code{fitdist} without any input arguments will return a cell +## array of character vectors listing all supported distributions. +## +## @seealso{makedist} ## @end deftypefn function [varargout] = fitdist (varargin) diff --git a/inst/fillmissing.m b/inst/fillmissing.m index 9713bac..d4a4d94 100644 --- a/inst/fillmissing.m +++ b/inst/fillmissing.m @@ -16,7 +16,7 @@ ## this program; if not, see <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn {statistics} {@var{B} =} fillmissing (@var{A}, 'constant', @var{v}) +## @deftypefn {statistics} {@var{B} =} fillmissing (@var{A}, "constant", @var{v}) ## @deftypefnx {statistics} {@var{B} =} fillmissing (@var{A}, @var{method}) ## @deftypefnx {statistics} {@var{B} =} fillmissing (@var{A}, @var{move_method}, @var{window_size}) ## @deftypefnx {statistics} {@var{B} =} fillmissing (@var{A}, @var{fill_function}, @var{window_size}) @@ -193,7 +193,7 @@ function [A, idx_out] = fillmissing (A, varargin) - if (nargin < 2)|| (nargin > 12) + if ((nargin < 2)|| (nargin > 12)) print_usage (); endif @@ -226,11 +226,12 @@ function [A, idx_out] = fillmissing (A, varargin) idx_out = false (sz_A); endif - ## process input arguments + ## Process input arguments. if (is_function_handle (method)) - ## verify function handle and window + + ## Verify function handle and window. if ((nargin < 3) || ! isnumeric (varargin{2}) || ... - ! any( numel (varargin{2})==[1 2])) + ! any (numel (varargin{2}) == [1, 2])) error (["fillmissing: fill function handle must be followed by ", ... "a numeric scalar or two-element vector window size."]); elseif (nargin (method) < 3) @@ -260,7 +261,7 @@ function [A, idx_out] = fillmissing (A, varargin) endif v = varargin{2}; - if ! (isscalar (v) || isempty (v)) + if (! (isscalar (v) || isempty (v))) v = v(:); endif @@ -268,7 +269,7 @@ function [A, idx_out] = fillmissing (A, varargin) error ("fillmissing: a numeric fill value cannot be emtpy."); endif - ## type check v against A + ## Type check v against A. if (iscellstr (A) && ischar (v) && ! iscellstr (v)) v = {v}; endif @@ -280,7 +281,7 @@ function [A, idx_out] = fillmissing (A, varargin) error ("fillmissing: fill value must be the same data type as 'A'."); endif - ## v can't be size checked until after processing rest of inputs + ## v can't be size checked until after processing rest of inputs. next_varg = 3; case {"movmean", "movmedian"} @@ -290,7 +291,7 @@ function [A, idx_out] = fillmissing (A, varargin) endif if ((nargin < 3) || ! isnumeric (varargin{2}) || ... - ! any( numel (varargin{2})==[1 2])) + ! any (numel (varargin{2}) == [1, 2])) error (["fillmissing: moving window method must be followed by ", ... "a numeric scalar or two-element vector."]); endif @@ -302,19 +303,19 @@ function [A, idx_out] = fillmissing (A, varargin) endswitch endif - ## process any more parameters + ## Process any more parameters. if (next_varg < nargin) - #set dim. if specified, it is the only numeric option that can appear next - if isnumeric (varargin{next_varg}) + ## Set dim. If specified, it is the only numeric option allowed next. + if (isnumeric (varargin{next_varg})) dim = varargin{next_varg}; if (! (isscalar (dim) && (dim > 0))) error ("fillmissing: DIM must be a positive scalar."); endif next_varg++; else - ## default dim is first nonsingleton dimension of A - if isscalar (A) + ## Default dim is first nonsingleton dimension of A. + if (isscalar (A)) dim = 1; else dim = find (sz_A > 1, 1, "first"); @@ -322,12 +323,12 @@ function [A, idx_out] = fillmissing (A, varargin) endif sz_A_dim = size (A, dim); - ## process any remaining inputs, must be name-value pairs + ## Process any remaining inputs, must be name-value pairs. while (next_varg < nargin) propname = varargin{next_varg}; if (next_varg + 1 == nargin) - ## must be at least one more input with 1st containing value + ## Must be at least one more input with 1st containing value. error ("fillmissing: properties must be given as name-value pairs."); else @@ -340,11 +341,11 @@ function [A, idx_out] = fillmissing (A, varargin) propname = lower (propname); endif - ## input validation for names and values + ## Input validation for names and values. switch (propname) case "samplepoints" ## val must be sorted, unique, numeric vector the same size - ## as size(A,dim) + ## as size(A,dim). if (! (isnumeric (propval) && isvector (propval) && (numel (propval) == sz_A_dim) && issorted (propval) && (numel (propval) == numel (unique (propval))))) @@ -356,11 +357,11 @@ function [A, idx_out] = fillmissing (A, varargin) standard_samplepoints = all (diff (samplepoints, 1, 1) == 1); case "endvalues" - ## for numeric A, val must be numeric scalar, a numeric + ## For numeric A, val must be numeric scalar, a numeric ## array with numel equal to the elements orthogonal to ## the dim or certain string methads. For non-numeric A, ## "constant" method is not valid. - if ischar (propval) + if (ischar (propval)) switch (lower (propval)) case {"extrap", "previous", "next", "nearest", "none", ... "linear", "spline", "pchip", "makima"} @@ -384,8 +385,8 @@ function [A, idx_out] = fillmissing (A, varargin) case "missinglocations" - if !(isnumeric (A) || islogical (A) || isinteger (A) || ... - ischar (A) || iscellstr (A)) + if (! (isnumeric (A) || islogical (A) || isinteger (A) || ... + ischar (A) || iscellstr (A))) error (["fillmissing: MissingLocations option is not ", ... "compatible with data type '%s'."], class (A)); endif @@ -395,7 +396,7 @@ function [A, idx_out] = fillmissing (A, varargin) "cannot be used simultaneously."]); endif - ## val must be logical array same size as A + ## val must be logical array same size as A. if (! (islogical (propval) && isequal (sz_A, size (propval)))) error (["fillmissing: MissingLocations must be a logical ", ... "array the same size as A."]); @@ -405,7 +406,7 @@ function [A, idx_out] = fillmissing (A, varargin) missing_locs = propval; case "maxgap" - ## val must be positive numeric scalar + ## val must be positive numeric scalar. if (! (isnumeric (propval) && isscalar (propval) && (propval > 0))) error ("fillmissing: MaxGap must be a positive numeric scalar."); endif @@ -427,9 +428,10 @@ function [A, idx_out] = fillmissing (A, varargin) endwhile else - ## no inputs after method - ## set default dim - if isscalar (A) + ## No inputs after method. + + ## Set default dim. + if (isscalar (A)) dim = 1; else dim = find (sz_A > 1, 1, "first"); @@ -437,29 +439,28 @@ function [A, idx_out] = fillmissing (A, varargin) sz_A_dim = size (A, dim); endif - ## reduce calls to size and avoid overruns checking sz_A for high dims - if dim > ndims_A + ## Reduce calls to size and avoid overruns checking sz_A for high dims. + if (dim > ndims_A) sz_A = [sz_A, ones(1, dim - ndims_A)]; ndims_A = numel (sz_A); endif - ## set defaults for any unspecified parameters + ## Set defaults for any unspecified parameters. if (isempty (samplepoints)) samplepoints = [1 : sz_A_dim]'; endif - if isempty (missing_locs) + if (isempty (missing_locs)) missing_locs = ismissing (A); endif - ## endvalues treated separately from interior missing_locs + ## endvalues treated separately from interior missing_locs. if (isempty (endgap_method) || strcmp (endgap_method, "extrap")) endgap_method = method; - if strcmp(endgap_method, "constant") + if (strcmp(endgap_method, "constant")) endgap_val = v; endif endif - ## missingvalues option not compatible with some methods and inputs: if (isinteger (A) || islogical (A)) if (any (ismember (method, ... @@ -474,10 +475,9 @@ function [A, idx_out] = fillmissing (A, varargin) endif endif - - ## verify size of v and endgap_val for 'constant' methods, resize for A - orthogonal_size = [sz_A(1:dim-1), 1, sz_A(dim+1:end)]; # orthog. to dim size - numel_orthogonal = prod (orthogonal_size); # numel perpen. to dim + ## Verify size of v and endgap_val for 'constant' methods, resize for A. + orthogonal_size = [sz_A(1:dim-1), 1, sz_A(dim+1:end)]; # orthog. to dim size. + numel_orthogonal = prod (orthogonal_size); # numel perpen. to dim. if (strcmp (method, "constant") && (! isscalar (v))) if (numel (v) != numel_orthogonal) error (["fillmissing: fill value 'V' must be a scalar or a %d ", ... @@ -496,10 +496,10 @@ function [A, idx_out] = fillmissing (A, varargin) endif endif - ## simplify processing by temporarily permuting A so operation always on dim1 - ## revert permutation at the end + ## Simplify processing by temporarily permuting A so operation always on dim1. + ## Revert permutation at the end. dim_idx_perm = [1 : ndims_A]; - dim_idx_flip(1 : max(dim, ndims_A)) = {':'}; + dim_idx_flip(1 : max(dim, ndims_A)) = {":"}; dim_idx_flip(1) = [sz_A_dim:-1:1]; if (dim != 1) @@ -520,75 +520,77 @@ function [A, idx_out] = fillmissing (A, varargin) endif endif - ## precalculate fill data for several methods + ## Precalculate fill data for several methods. zero_padding = zeros (orthogonal_size); samplepoints_expand = samplepoints(:, ones (1, prod (sz_A(2:end)))); - ##find endgap locations + ## Find endgap locations. if (sz_A_dim < 3) - ## all missing are endgaps + ## All missing are endgaps. endgap_locs = missing_locs; else - ## use cumsums starting from first and last part in dim to find missing + ## Use cumsums starting from first and last part in dim to find missing ## values in and adjacent to end locations. endgap_locs = cumprod (missing_locs,1) | ... (cumprod (missing_locs(dim_idx_flip{:}),1))(dim_idx_flip{:}); endif - ## remove endgap_locs from missing_locs to avoid double processing + ## Remove endgap_locs from missing_locs to avoid double processing. missing_locs(endgap_locs) = false; - ## remove elements from missing and end location arrays if maxgap is specified + ## Remove elements from missing and end location arrays if maxgap is specified. if (! isempty (maxgap)) - ## missing_locs: if samplepoints value diff on either side of missing + ## missing_locs: If samplepoints value diff on either side of missing ## elements is > maxgap, remove those values. - ## for endgaps, use diff of inside and missing end samplepoint values - ## and remove from endgaps + ## For endgaps, use diff of inside and missing end samplepoint values + ## and remove from endgaps. - ## First check gapsize of any interior missings in missing_locs + ## First check gapsize of any interior missings in missing_locs. if (any (missing_locs(:))) - ## locations in front of gaps + ## Locations in front of gaps loc_before = [diff(missing_locs,1,1); zero_padding] == 1; - ## locations in back of gaps + ## Locations in back of gaps loc_after = diff ([zero_padding; missing_locs],1,1) == -1; - ## value of samplepoints at front and back locs + ## Value of samplepoints at front and back locs sampvals_before = samplepoints_expand(loc_before); sampvals_after = samplepoints_expand(loc_after); - ## evaluate which gaps are too big to fill + ## Evaluate which gaps are too big to fill. gaps_to_remove = (sampvals_after - sampvals_before) > maxgap; - ## convert those gaps into an array element list - idxs_to_remove = arrayfun ('colon', ... + ## Convert those gaps into an array element list. + idxs_to_remove = arrayfun ("colon", ... ((find (loc_before))(gaps_to_remove ) + 1), ... ((find (loc_after))(gaps_to_remove ) - 1), ... "UniformOutput", false); - ## remove those elements from missing_locs + ## Remove those elements from missing_locs. missing_locs([idxs_to_remove{:}]) = false; endif - ##then do any endgaps + ## Then do any endgaps. if (any (endgap_locs(:))) - ## if any are all missing, remove for any value of maxgap + ## If any are all missing, remove for any value of maxgap. endgap_locs &= ! prod (endgap_locs, 1); if ((sz_A_dim < 3) && (abs (samplepoints(2) - samplepoints(1)) > maxgap)) - ## shortcut - all missings are ends and exceed maxgap. + ## Shortcut - all missings are ends and exceed maxgap. endgap_locs(:) = false; else - ## check gap size of front endgaps + ## Check gap size of front endgaps. - ##find loc element after gap + ## Find loc element after gap. nextvals = sum (cumprod (endgap_locs,1)) + 1; - ## compare diff between values at those points and at base with maxgap + + ## Compare diff between values at those points and at base with maxgap. ends_to_remove = abs (samplepoints(nextvals) - samplepoints(1)) ... > maxgap; - ## remove any with gap>maxgap + + ## Remove any with gap>maxgap. endgap_locs((cumprod (endgap_locs,1)) & ends_to_remove) = false; - ## flip, repeat for back endgaps, then unflip and remove. + ## Flip, repeat for back endgaps, then unflip and remove. nextvals = sum (cumprod (endgap_locs(dim_idx_flip{:}),1)) + 1; ends_to_remove = abs (samplepoints(end:-1:1)(nextvals) ... - samplepoints(end)) > maxgap; @@ -607,11 +609,11 @@ function [A, idx_out] = fillmissing (A, varargin) endif - ## Actaully fill the missing data + ## Actaully fill the missing data. - ## process central missing values (all gaps bound by two valid datapoints) - ## for each method, calcualte fill_vals, which will be used in assignment - ## A(missing_locs) = fill_vals, and if idx_flag, populate idx_out + ## Process central missing values (all gaps bound by two valid datapoints). + ## For each method, calcualte fill_vals, which will be used in assignment + ## A(missing_locs) = fill_vals, and if idx_flag, populate idx_out. if (any (missing_locs(:))) switch (method) case "constant" @@ -623,9 +625,9 @@ function [A, idx_out] = fillmissing (A, varargin) endif if (idx_flag) - ## if any v are the missing type, those get removed from idx_out - ## unless using 'missinglocations' - if (! missinglocations) && any (miss_v = ismissing (v)) + ## If any v are the missing type, those get removed from idx_out + ## unless using 'missinglocations'. + if ((! missinglocations) && any (miss_v = ismissing (v))) idx_out(missing_locs) = true; idx_out(missing_locs & miss_v) = false; @@ -635,7 +637,7 @@ function [A, idx_out] = fillmissing (A, varargin) endif case {"previous", "next", "nearest", "linear"} - ## find element locations bounding each gap + ## Find element locations bounding each gap. loc_before = [diff(missing_locs, 1, 1); zero_padding] == 1; loc_after = diff ([zero_padding; missing_locs], 1, 1) == -1; gapsizes = find (loc_after) - find (loc_before) - 1; @@ -649,33 +651,33 @@ function [A, idx_out] = fillmissing (A, varargin) fill_vals = repelems (A(loc_after), gap_count_idx)'; case {"nearest", "linear"} - ## determine which missings go with values before or after - ## gap based on samplevalue distance. (equal dist goes to after) + ## Determine which missings go with values before or after + ## gap based on samplevalue distance. (Equal dist goes to after.) - ## find sample values before and after gaps + ## Find sample values before and after gaps. sampvals_before = samplepoints_expand(loc_before); sampvals_after = samplepoints_expand(loc_after); - ## build cell with linear indices of elements in each gap - gap_locations = arrayfun ('colon', (find (loc_before)) + 1, ... + ## Build cell with linear indices of elements in each gap. + gap_locations = arrayfun ("colon", (find (loc_before)) + 1, ... (find (loc_after)) - 1, "UniformOutput", false); - ## get sample values at those elements + ## Get sample values at those elements. [sampvals_in_gaps, ~] = ind2sub (sz_A, [gap_locations{:}]); sampvals_in_gaps = samplepoints(sampvals_in_gaps); - ## expand first and last vectors for each gap point + ## Expand first and last vectors for each gap point. Avals_before = repelems (A(loc_before), gap_count_idx)'; Avals_after = repelems (A(loc_after), gap_count_idx)'; switch (method) case "nearest" - ## calculate gap mid point for each gap element + ## Calculate gap mid point for each gap element. sampvals_midgap = repelems ( ... (sampvals_before + sampvals_after)/2, gap_count_idx)'; - ## generate fill vectors sorting elements into nearest before - ## or after + ## Generate fill vectors sorting elements into nearest before + ## or after. prev_fill = (sampvals_in_gaps < sampvals_midgap); next_fill = (sampvals_in_gaps >= sampvals_midgap); fill_vals = A(missing_locs); @@ -683,11 +685,11 @@ function [A, idx_out] = fillmissing (A, varargin) fill_vals(next_fill) = Avals_after(next_fill); case "linear" - ## expand samplepoint values for interpolation x-values + ## Expand samplepoint values for interpolation x-values. sampvals_before = repelems (sampvals_before, gap_count_idx)'; sampvals_after = repelems (sampvals_after, gap_count_idx)'; - ## linearly interpolate + ## Linearly interpolate: fill_vals = ((Avals_after - Avals_before) ... ./ (sampvals_after - sampvals_before)) ... .* (sampvals_in_gaps - sampvals_before) ... @@ -696,22 +698,22 @@ function [A, idx_out] = fillmissing (A, varargin) endswitch if (idx_flag) - ## mid gaps will always be filled by above methods. + ## Mid gaps will always be filled by above methods. idx_out(missing_locs) = true; endif case {"spline", "pchip", "makima"} - ## pass more complex interpolations to interp1 + ## Pass more complex interpolations to interp1. - ## TODO: vectorized 'linear' is ~10-100x faster than using interp1. - ## look to speed these up as well. + ## FIXME: vectorized 'linear' is ~10-100x faster than using interp1. + ## Look to speed these up as well. - ## identify columns needing interpolation to reduce empty operations + ## Identify columns needing interpolation to reduce empty operations. cols_to_use = any (missing_locs, 1); ## missinglocations may send columns with NaN and less than 2 - ## real values resulting in interp1 error. Trim those columns, - ## prepopulate fill_vals with NaN, mark as filled. + ## real values resulting in interp1 error. Trim those columns, + ## pre-populate fill_vals with NaN, mark as filled. if (missinglocations) fill_vals = NaN (sum (missing_locs(:, cols_to_use)(:)), 1); @@ -738,8 +740,8 @@ function [A, idx_out] = fillmissing (A, varargin) idx_out(missing_locs) = true; endif - case {"movmean","movmedian"} - ## check window size versus smallest sample gaps. if window smaller, + case {"movmean", "movmedian"} + ## Check window size versus smallest sample gaps. If window smaller, ## nothing to do, break out early. if ((isscalar (window_size) && ... (window_size/2 >= min (diff (samplepoints)))) || ... @@ -748,29 +750,29 @@ function [A, idx_out] = fillmissing (A, varargin) switch (method) case "movmean" - if sz_A_dim > 1 + if (sz_A_dim > 1) allmissing = (missing_locs | endgap_locs)(:,:); - ## create temporary flattened array for processing, + ## Create temporary flattened array for processing, A_sum = A(:,:); A_sum (allmissing) = 0; if (standard_samplepoints && ... all (round (window_size) == window_size)) - ## window size based on vector elements + ## Window size based on vector elements. - ## faster codepath for uniform, unit-spacing samplepoints + ## Faster codepath for uniform, unit-spacing samplepoints ## and integer valued window sizes. if (isscalar (window_size)) window_width = window_size; if (mod (window_size, 2)) - ## odd window size - ## equal number of values on either side of gap + ## Odd window size: + ## Equal number of values on either side of gap. window_size = (window_width - 1) .* [0.5, 0.5]; else - ## even window size - ## one extra element on previous side of gap + ## Even window size: + ## One extra element on previous side of gap. window_size(1) = window_width/2; window_size(2) = window_size(1) - 1; endif @@ -778,22 +780,22 @@ function [A, idx_out] = fillmissing (A, varargin) window_width = window_size(1) + window_size(2) + 1; endif - ## use columnwise convolution of windowing vector and A for + ## Use columnwise convolution of windowing vector and A for ## vectorized summation. conv_vector = ones (window_width, 1); A_sum = convn (A_sum, conv_vector, ... "full")(1 + window_size(2):end - window_size(1), :); - ## get count of values contributing to convolution to account + ## Get count of values contributing to convolution to account ## for missing elements and to calculate mean. A_sum_count = convn (! allmissing, conv_vector, ... "full")(1 + window_size(2):end - window_size(1), :); else - ## window size based on sample point distance. Works for non + ## Window size based on sample point distance. Works for non ## integer, non uniform values. - ## use A_sum (flattened to 2D), project slice windows in dim3 + ## Use A_sum (flattened to 2D), project slice windows in dim3 ## automatic broadcasting to get window summations & counts samplepoints_shift = ... @@ -819,10 +821,10 @@ function [A, idx_out] = fillmissing (A, varargin) ## FIXME: when sum can handle nanflag, the 'else' path ## should be able to be made to handle the vectorized - ## summation even with 'missinglocations' + ## summation even with 'missinglocations'. A_nan = isnan (A_sum); A_temp = A_sum .* samplepoints_slice_windows; - A_temp(!samplepoints_slice_windows & A_nan) = 0; + A_temp(! samplepoints_slice_windows & A_nan) = 0; A_sum = permute (sum (A_temp, 1), [3,2,1]); else @@ -835,8 +837,8 @@ function [A, idx_out] = fillmissing (A, varargin) [3,2,1]); endif - ## build fill values - fill_vals = A(missing_locs); # prefill to include missing vals + ## Build fill values. + fill_vals = A(missing_locs); # Prefill to include missing vals. fillable_gaps = missing_locs(:,:) & A_sum_count; fill_vals(fillable_gaps(missing_locs(:,:))) = ... A_sum(fillable_gaps) ./ A_sum_count(fillable_gaps); @@ -844,7 +846,14 @@ function [A, idx_out] = fillmissing (A, varargin) case "movmedian" - if sz_A_dim > 1 + if (sz_A_dim > 1) + + if (missinglocations) + ## Median assumes empty locs have NaN. Missinglocations + ## may point to a non-NaN number that will be assumed valid. + ## Replace with NaNs. + A(missing_locs) = NaN; + endif cols_to_use = any (missing_locs(:,:), 1); @@ -866,8 +875,8 @@ function [A, idx_out] = fillmissing (A, varargin) samplepoints_shift <= window_size(2), [1,3,2]); endif - ## use moving window slices to project A and use - ## custom function for vectorized full array median computation + ## Use moving window slices to project A and use + ## custom function for vectorized full array median computation. A_med = A(:, cols_to_use); nan_slice_windows = double (samplepoints_slice_windows); nan_slice_windows(! samplepoints_slice_windows) = NaN; @@ -892,19 +901,19 @@ function [A, idx_out] = fillmissing (A, varargin) case "movfcn" - ## for each gap construct: + ## For each gap construct: ## xval - data values in window on either side of gap, including ## other missing values ## xloc - sample point values for those xval ## gap_loc - sample point values for gap elements - ## if window has xval fully empty skip processing gap + ## If window has xval fully empty skip processing gap. - ## missing_locs might include endgap_locs - ## need to build gap locations accounting for both types + ## missing_locs might include endgap_locs. + ## Need to build gap locations accounting for both types. - ## missing values can include more than just numeric inputs + ## Missing values can include more than just numeric inputs. - ## windows containing no data points (e.g., endgaps when window + ## Windows containing no data points (e.g., endgaps when window ## is one sided [3 0] or [0 2], will be dropped from processing, ## not being passed to the mov_fcn. @@ -914,11 +923,11 @@ function [A, idx_out] = fillmissing (A, varargin) window_size(1) = -window_size(1); endif - ## midgap bounds + ## Midgap bounds loc_before = [diff(missing_locs, 1, 1); zero_padding] == 1; loc_after = diff ([zero_padding; missing_locs], 1, 1) == -1; - ## front/back endgap locations and bounds + ## Front/back endgap locations and bounds front_gap_locs = logical (cumprod (missing_locs, 1)); front_next_locs = diff ([zero_padding; front_gap_locs], 1, 1) == -1; @@ -926,13 +935,13 @@ function [A, idx_out] = fillmissing (A, varargin) cumprod (missing_locs(dim_idx_flip{:}), 1)(dim_idx_flip{:})); back_prev_locs = [diff(back_gap_locs, 1, 1); zero_padding] == 1; - ## remove gap double counting + ## Remove gap double counting. back_gap_locs &= ! front_gap_locs; loc_before &= ! back_prev_locs; loc_after &= ! front_next_locs; - ## build gap location array using gap starts and lengths. - ## simplest to use front / mid / back ordering, track later with sort. + ## Build gap location array using gap starts and lengths. + ## Simplest to use front / mid / back ordering, track later with sort. gap_start_locs = ... [find(front_gap_locs & [true; false(sz_A_dim-1,1)])(:); ... find(circshift (loc_before, 1, 1))(:); @@ -942,29 +951,29 @@ function [A, idx_out] = fillmissing (A, varargin) find(loc_after) - find(loc_before) - 1;... (sum (back_gap_locs, 1))(any (back_gap_locs, 1))(:)]; - ## separate arrayfun/cellfun faster than single fun with - ## composite anonymous function - gap_locations = arrayfun ('colon', gap_start_locs, ... + ## Separate arrayfun/cellfun faster than single fun with + ## composite anonymous function. + gap_locations = arrayfun ("colon", gap_start_locs, ... gap_start_locs + gapsizes - 1, "UniformOutput", false); - gap_locations = cellfun('transpose', ... + gap_locations = cellfun("transpose", ... gap_locations, "UniformOutput", false); - ## sorting index to bridge front-mid-back and linear index ordering + ## Sorting index to bridge front-mid-back and linear index ordering. [~, gap_full_sort_idx] = sort (vertcat (gap_locations{:})); - ## remove front or back gaps from gapsizes & gap_locations - ## if front/back window size = 0, or if full column is missing + ## Remove front or back gaps from gapsizes & gap_locations. + ## If front/back window size = 0, or if full column is missing. - ## index to track empty/removed elements + ## Index to track empty/removed elements. removed_element_idx = true (numel (gap_full_sort_idx), 1); removed_front_elements = 0; removed_back_elements = 0; - ## simple front/back gap trimming for either window size = 0 + ## Simple front/back gap trimming for either window size = 0. if (! window_size(2)) - ## if no back facing window, ignore front gaps + ## If no back facing window, ignore front gaps. removed_front_gap_count = sum (front_gap_locs(1,:)); removed_front_elements = sum (gapsizes(1 : removed_front_gap_count)); removed_element_idx(1 : removed_front_elements) = false; @@ -981,7 +990,7 @@ function [A, idx_out] = fillmissing (A, varargin) endif if (! window_size(1)) - ## if no front facing window, ignore back gaps. + ## If no front facing window, ignore back gaps. removed_back_gap_count = sum (back_gap_locs(end,:)); removed_back_elements = sum (... gapsizes(end - removed_back_gap_count + 1 : end)); @@ -994,7 +1003,7 @@ function [A, idx_out] = fillmissing (A, varargin) gap_sample_values = cellfun_subsref (gap_locations, false, ... {samplepoints_expand}); - ## build [row,column] locations array for windows around each gap + ## Build [row,column] locations array for windows around each gap. window_points_r_c = cell (numel (gapsizes), 2); window_points_r_c(:,1) = cellfun (@(x) ... ([1:sz_A_dim]')((samplepoints<x(1) & samplepoints >= ... @@ -1004,11 +1013,11 @@ function [A, idx_out] = fillmissing (A, varargin) gap_sample_values, "UniformOutput", false); window_points_r_c(:,2) = cellfun ( ... @(x,y) (fix ((x(1)-1)/sz_A_dim)+1)(ones (size(y))), ... - gap_locations, window_points_r_c(:,1),"UniformOutput",false); + gap_locations, window_points_r_c(:,1), "UniformOutput",false); - ## if any window is emtpy, do not pass that gap to the move_fcn - empty_gaps = cellfun ('isempty', window_points_r_c(:,1)); + ## If any window is emtpy, do not pass that gap to the move_fcn. + empty_gaps = cellfun ("isempty", window_points_r_c(:,1)); if (any (empty_gaps)) removed_element_idx(... repelems (empty_gaps, [1:numel(gapsizes); gapsizes'])')... @@ -1022,19 +1031,19 @@ function [A, idx_out] = fillmissing (A, varargin) if (! isempty (gapsizes)) ## Aval = A values at window locations ## Aloc = sample values at window locations - A_window_indexes = cellfun ('sub2ind', {sz_A}, ... + A_window_indexes = cellfun ("sub2ind", {sz_A}, ... window_points_r_c(:,1), window_points_r_c(:,2), ... "UniformOutput", false); Aval = cellfun_subsref (A_window_indexes, false, {A}); Aloc = cellfun_subsref (window_points_r_c(:,1), false, ... {samplepoints}); - ##build fill values + ## Build fill values. fill_vals_C = cellfun (move_fcn, Aval, Aloc, ... gap_sample_values(:,1), "UniformOutput", false); - ## check for output of move_fcn having different size than gaps - if (! all (cellfun ('numel', fill_vals_C) == gapsizes)) + ## Check for output of move_fcn having different size than gaps. + if (! all (cellfun ("numel", fill_vals_C) == gapsizes)) error (["fillmissing: fill function return values must be ", ... "the same size as the gaps."]); endif @@ -1047,14 +1056,14 @@ function [A, idx_out] = fillmissing (A, varargin) fill_vals_trim(gap_trim_sort_idx); if (idx_flag) - ## for movfcn with A of type having missing: - ## any outputs still containing class's 'missing' values + ## For movfcn with A of type having missing: + ## Any outputs still containing class's 'missing' values ## are counted as not filled in idx_out, even if the value ## was put there by the movfcn. This is true even if ## missinglocations is used. If missinglocations changed ## a value with no apparent change, it still shows up ## as filled. - ## if A has no missing value (int or logical), then without + ## If A has no missing value (int or logical), then without ## missinglocations, idx_out is always empty. With ## missinglocations, compatible behavior is undefined as ## Matlab 2022a has an apparent bug producing a error message @@ -1067,7 +1076,7 @@ function [A, idx_out] = fillmissing (A, varargin) idx_out(missing_locs) = ! ismissing (fill_vals); elseif (missinglocations) - ## any missing_loc processed and not skipped must become true + ## Any missing_locs processed and not skipped must become true. idx_out(missing_locs) = removed_element_idx(gap_full_sort_idx); endif endif @@ -1084,7 +1093,7 @@ function [A, idx_out] = fillmissing (A, varargin) endif - ## process endgaps + ## Process endgaps: if (any (endgap_locs(:))) switch (endgap_method) case "none" @@ -1097,8 +1106,8 @@ function [A, idx_out] = fillmissing (A, varargin) fill_vals = (endgap_locs .* endgap_val)(endgap_locs); endif if (idx_flag) - ## if any v are the missing type, those get removed from idx_out - ## unless using 'missinglocations' + ## If any v are the missing type, those get removed from idx_out + ## unless using 'missinglocations'. idx_out(endgap_locs) = true; if (! missinglocations) && any (miss_ev = ismissing (endgap_val)) idx_out(endgap_locs & miss_ev) = false; @@ -1107,79 +1116,79 @@ function [A, idx_out] = fillmissing (A, varargin) case {"previous", "next", "nearest", "linear", ... "spline", "pchip", "makima"} - ## all of these methods require sz_A_dim >= 2. shortcut path otherwise + ## All of these methods require sz_A_dim >= 2. shortcut path otherwise. if (sz_A_dim < 2) endgap_locs(:) = false; else switch (endgap_method) case "previous" - ## remove any gaps at front of array, includes all-missing cols + ## Remove any gaps at front of array, includes all-missing cols. endgap_locs (logical (cumprod (endgap_locs,1))) = false; if (any (endgap_locs(:))) - ##find locations of the 'prev' value to use for filling + ## Find locations of the 'prev' value to use for filling. subsval_loc = [diff(endgap_locs, 1, 1); zero_padding] == 1; - ##calculate the number of spots each 'prev' needs to fill + ## Calculate the number of spots each 'prev' needs to fill. gapsizes = (sum (endgap_locs, 1))(any (endgap_locs, 1))(:); - ## construct substitution value vector + ## Construct substitution value vector. fill_vals = repelems (A(subsval_loc), ... [1:numel(gapsizes); gapsizes'])'; endif case "next" - ## remove any gaps at back of array from endgap_locs - ## includes any all-missing columns + ## Remove any gaps at back of array from endgap_locs + ## including any all-missing columns. endgap_locs(logical (cumprod ( ... endgap_locs(dim_idx_flip{:}), 1)(dim_idx_flip{:}))) ... = false; if (any (endgap_locs(:))) - ##find locations of the 'next' value to use for filling + ## Find locations of the 'next' value to use for filling. subsval_loc = diff ([zero_padding; endgap_locs],1,1) == -1; - ##calculate the number of spots each 'next' needs to fill + ## Calculate the number of spots each 'next' needs to fill. gapsizes = (sum (endgap_locs, 1))(any (endgap_locs, 1))(:); - ## construct substitution value vector + ## Construct substitution value vector. fill_vals = repelems (A(subsval_loc), ... [1:numel(gapsizes); gapsizes'])'; endif case "nearest" - ## remove any all-missing columns + ## Remove any all-missing columns. endgap_locs &= (! prod (endgap_locs, 1)); if (any (endgap_locs(:))) - ## find front end info + ## Find front end info. front_gap_locs = logical (cumprod (endgap_locs, 1)); front_next_loc = diff ( ... [zero_padding; front_gap_locs], 1, 1) == -1; front_gapsizes = (sum (front_gap_locs, 1))(any ... (front_gap_locs,1)); - ## find back end info + ## Find back end info. back_gap_locs = logical ( ... cumprod (endgap_locs(dim_idx_flip{:}), 1)(dim_idx_flip{:})); back_prev_loc = [diff(back_gap_locs, 1, 1); zero_padding] == 1; back_gapsizes = (sum (back_gap_locs, 1))(any (back_gap_locs,1)); - ## combine into fill variables + ## Combine into fill variables. [~, fb_sort_idx] = sort ... ([find(front_gap_locs); find(back_gap_locs)]); fillval_loc = [find(front_next_loc); find(back_prev_loc)]; gapsizes = [front_gapsizes; back_gapsizes]; - ## construct substitution value vector with sort order to mix - ## fronts and backs in column order + ## Construct substitution value vector with sort order to mix + ## fronts and backs in column order. fill_vals = (repelems (A(fillval_loc), ... [1:numel(gapsizes); gapsizes'])')(fb_sort_idx); endif case "linear" - ## endgaps not guaranteed to have enough points to interpolate + ## Endgaps not guaranteed to have enough points to interpolate. cols_to_use = (sum (! (missing_locs | endgap_locs), 1) > 1) ... & any (endgap_locs, 1); interp_locs = ! (missing_locs | endgap_locs) & cols_to_use; @@ -1187,18 +1196,18 @@ function [A, idx_out] = fillmissing (A, varargin) if (any (endgap_locs(:))) - ## process front endgaps + ## Process front endgaps: front_gap_locs = logical (cumprod (endgap_locs, 1)); fill_vals_front = []; if (any (front_gap_locs(:))) front_gapsizes = (sum (front_gap_locs, 1))(any ... (front_gap_locs,1)); - ## collect first data point after gap & expand to gapsize + ## Collect first data point after gap & expand to gapsize. front_interppoint_1 = repelems ( find (... diff ([zero_padding; front_gap_locs], 1, 1) == -1), ... [1:numel(front_gapsizes); front_gapsizes'])'; - ## collect second data point after gap & expand to gapsize + ## Collect second data point after gap & expand to gapsize. front_interppoint_2 = repelems ( find ( ... diff ([zero_padding; ((cumsum (interp_locs, 1) .* ... any (front_gap_locs, 1)) == 2)], 1, 1) == 1), ... @@ -1209,7 +1218,7 @@ function [A, idx_out] = fillmissing (A, varargin) [front_interppoint_1, front_interppoint_2]); front_gap_loc_sampvals = samplepoints_expand(front_gap_locs); - ## hack for vector automatic orientation forcing col vector + ## Hack for vector automatic orientation forcing col vector. if (isvector (front_interp_Avals)) front_interp_Avals = (front_interp_Avals(:)).'; endif @@ -1217,7 +1226,7 @@ function [A, idx_out] = fillmissing (A, varargin) front_interp_sampvals = (front_interp_sampvals(:)).'; endif - ## perform interpolation for every gap point + ## Perform interpolation for every gap point. interp_slopes_front = diff (front_interp_Avals, 1, 2) ... ./ diff (front_interp_sampvals, 1, 2); fill_vals_front = interp_slopes_front .* ... @@ -1226,7 +1235,7 @@ function [A, idx_out] = fillmissing (A, varargin) front_interp_Avals(:,1); endif - ## process back endgaps + ## Process back endgaps: back_gap_locs = logical ( ... cumprod (endgap_locs(dim_idx_flip{:}), 1)(dim_idx_flip{:})); fill_vals_back = []; @@ -1235,12 +1244,12 @@ function [A, idx_out] = fillmissing (A, varargin) back_gapsizes = (sum ( ... back_gap_locs, 1))(any (back_gap_locs,1)); - ## collect last data point before gap & expand to gapsize + ## Collect last data point before gap & expand to gapsize. back_interppoint_2 = repelems ( ... find ([diff(back_gap_locs, 1, 1); zero_padding] == 1), ... [1:numel(back_gapsizes); back_gapsizes'])'; - ## collect 2nd to last data point before gap & expand to gap + ## Collect 2nd to last data point before gap & expand to gap. back_interppoint_1 = repelems ( ... find ((diff ([zero_padding; ... ((cumsum (interp_locs(dim_idx_flip{:}), 1) .* ... @@ -1248,14 +1257,14 @@ function [A, idx_out] = fillmissing (A, varargin) 1, 1) == 1)(dim_idx_flip{:})), ... [1:numel(back_gapsizes); back_gapsizes'])'; - ## build linear interpolant vectors + ## Build linear interpolant vectors. back_interp_Avals = A([back_interppoint_1, ... back_interppoint_2]); back_interp_sampvals = samplepoints_expand( ... [back_interppoint_1, back_interppoint_2]); back_gap_loc_sampvals = samplepoints_expand(back_gap_locs); - ## hack for vector automatic orientation forcing col vector + ## Hack for vector automatic orientation forcing col vector. if (isvector (back_interp_Avals)) back_interp_Avals = (back_interp_Avals(:)).'; endif @@ -1263,7 +1272,7 @@ function [A, idx_out] = fillmissing (A, varargin) back_interp_sampvals = (back_interp_sampvals(:)).'; endif - ## perform interpolation for every gap point + ## Perform interpolation for every gap point. interp_slopes_back = diff (back_interp_Avals, 1, 2) ... ./ diff (back_interp_sampvals, 1, 2); fill_vals_back = interp_slopes_back .* ... @@ -1279,10 +1288,10 @@ function [A, idx_out] = fillmissing (A, varargin) case {"spline", "pchip", "makima"} ## endgap_locs not guaranteed to have 2 points. - ## need to ignore columns with < 2 values, or with nothing to do + ## Need to ignore columns with < 2 values, or with nothing to do. cols_to_use = (sum (! (endgap_locs | missing_locs), 1) > 1) ... & any (endgap_locs, 1); - ## trim out unused cols from endgap_locs + ## Trim out unused cols from endgap_locs. endgap_locs &= cols_to_use; if (missinglocations) @@ -1319,15 +1328,15 @@ function [A, idx_out] = fillmissing (A, varargin) endif endswitch - ## some methods remove fill locations, only process if not empty + ## Some methods remove fill locations, only process if not empty. if (any (endgap_locs(:))) - ## replace missings with appropriate fill values + ## Replace missings with appropriate fill values. A(endgap_locs) = fill_vals; endif endif if (reshape_flag) - ## revert permutation + ## Revert permutation: A = permute (A, dim_idx_perm); if (idx_flag) idx_out = permute (idx_out, dim_idx_perm); @@ -1338,28 +1347,27 @@ endfunction function varargout = cellfun_subsref (x, TF, varargin) - ## utility fcn for cellfun (@(x) A(x), x, "UniformOutput", true/false) - ## ~50% faster than anonymous function call + ## Utility fcn for cellfun (@(x) A(x), x, "UniformOutput", true/false). + ## ~50% faster than anonymous function call. ## pass A, x, and truefalse. - ## if nargaut > 1, repeat for C2 with B(x), C3 with C(x), etc. + ## If nargout > 1, repeat for C2 with B(x), C3 with C(x), etc. x_C = num2cell (struct ("type", "()", "subs", num2cell (x))); for (idx = 1 : numel (varargin)) - varargout{idx} = cellfun ('subsref', varargin{idx}, x_C, ... + varargout{idx} = cellfun ("subsref", varargin{idx}, x_C, ... "UniformOutput", TF); endfor endfunction - function fill_vals = other_interpolants (data_array, primary_locs, secondary_locs, method, samplepoints) - ## use interp1 to perform more complex interpolations. will only be performed + ## Use interp1 to perform more complex interpolations. Will only be performed ## on numerical data. ## primary_locs is missing_locs or endgap_locs, whichever the fill_vals are ## being returned for. secondary_locs is the other. ## - ## TODO: splitting out from columnwise cellfun to interp1 would increase + ## FIXME: splitting out from columnwise cellfun to interp1 would increase ## speed a lot, but cannot count on same number of elements being processed ## in each column. ## @@ -1370,31 +1378,30 @@ function fill_vals = other_interpolants (data_array, primary_locs, ## data_array values with NaN, interp1 will ignore those and interpolate with ## other data points. Matlab will instead return NaN. - ## find logical data and empty location indices for each column to be - ## used in columnwise call to interp1 (cast as columnwise cell arrays) + ## Find logical data and empty location indices for each column to be + ## used in columnwise call to interp1 (cast as columnwise cell arrays). interp_data_locs = num2cell ((! (primary_locs | secondary_locs)), 1); interp_locs_tofill = num2cell (primary_locs, 1); - ## build cell arrays with sample and interp values to pass to interp1 + ## Build cell arrays with sample and interp values to pass to interp1. [A_interpvalues, interp_samplevals] = cellfun_subsref (interp_data_locs, ... false, num2cell (data_array, 1), {samplepoints}); interp_empty_samplevals = cellfun_subsref (interp_locs_tofill, false, ... {samplepoints}); - ## generate fill_vals using interp1 for missing locations. - fill_vals = vertcat (cellfun ('interp1', interp_samplevals, ... + ## Generate fill_vals using interp1 for missing locations. + fill_vals = vertcat (cellfun ("interp1", interp_samplevals, ... A_interpvalues, interp_empty_samplevals, {method}, ... - {'extrap'}, 'UniformOutput', false){:}); + {"extrap"}, "UniformOutput", false){:}); endfunction - function med = columnwise_median (x) - ## takes a column of values, ignores any NaN values, retuns the median - ## of what's left. returns NaN if no values. - ## uses only built-in fns to avoid 3x 'median' slowdown + ## Take a column of values, ignore any NaN values, return the median + ## of what's left. Return NaN if no values. + ## Uses only built-in fns to avoid 3x 'median' slowdown. szx = size (x); @@ -1412,14 +1419,14 @@ function med = columnwise_median (x) ## even med = (x(n/2) + x((n/2)+1))/2; else - ## only called for types with missing = NaN + ## Only called for types with missing = NaN. med = NaN; endif else - x = sort (x, 1); # NaNs sent to bottom + x = sort (x, 1); # NaNs sent to bottom. n = sum (! isnan (x), 1); - m_idx_odd = logical (mod (n, 2)); # 0 even or zero, 1 odd + m_idx_odd = logical (mod (n, 2)); # 0 even or zero, 1 odd. m_idx_even = !m_idx_odd & (n != 0); k = floor ((n + 1) ./ 2); @@ -1429,15 +1436,15 @@ function med = columnwise_median (x) szx = [szx(1), prod(szx(2:end))]; endif - if any (m_idx_odd(:)) - x_idx_odd = sub2ind (szx, k(m_idx_odd)(:), find(m_idx_odd)(:));; + if (any (m_idx_odd(:))) + x_idx_odd = sub2ind (szx, k(m_idx_odd)(:), find(m_idx_odd)(:)); med(m_idx_odd) = x(x_idx_odd); endif - if any (m_idx_even(:)) + if (any (m_idx_even(:))) k_even = k(m_idx_even)(:); x_idx_even = sub2ind (szx, [k_even, k_even+1], ... - (find (m_idx_even))(:,[1 1]));; + (find (m_idx_even))(:, [1, 1])); med(m_idx_even) = sum (x(x_idx_even), 2) / 2; endif endif @@ -1445,15 +1452,15 @@ function med = columnwise_median (x) endfunction -%!assert (fillmissing ([1 2 3], "constant", 99), [1 2 3]) -%!assert (fillmissing ([1 2 NaN], "constant", 99), [1 2 99]) -%!assert (fillmissing ([NaN 2 NaN], "constant", 99), [99 2 99]) -%!assert (fillmissing ([1 2 3]', "constant", 99), [1 2 3]') -%!assert (fillmissing ([1 2 NaN]', "constant", 99), [1 2 99]') +%!assert (fillmissing ([1, 2, 3], "constant", 99), [1, 2, 3]) +%!assert (fillmissing ([1, 2, NaN], "constant", 99), [1, 2, 99]) +%!assert (fillmissing ([NaN, 2, NaN], "constant", 99), [99, 2, 99]) +%!assert (fillmissing ([1, 2, 3]', "constant", 99), [1, 2, 3]') +%!assert (fillmissing ([1, 2, NaN]', "constant", 99), [1, 2, 99]') -%!assert (fillmissing ([1 2 3; 4 5 6], "constant", 99), [1 2 3; 4 5 6]) -%!assert (fillmissing ([1 2 NaN; 4 NaN 6], "constant", 99), [1 2 99; 4 99 6]) -%!assert (fillmissing ([NaN 2 NaN; 4 NaN 6], "constant", [97, 98, 99]), [97 2 99; 4 98 6]) +%!assert (fillmissing ([1, 2, 3; 4, 5, 6], "constant", 99), [1, 2, 3; 4, 5, 6]) +%!assert (fillmissing ([1, 2, NaN; 4, NaN, 6], "constant", 99), [1, 2, 99; 4, 99, 6]) +%!assert (fillmissing ([NaN, 2, NaN; 4, NaN, 6], "constant", [97, 98, 99]), [97, 2, 99; 4, 98, 6]) %!test %! x = cat (3, [1, 2, NaN; 4, NaN, 6], [NaN, 2, 3; 4, 5, NaN]); @@ -1473,553 +1480,572 @@ endfunction %! assert (fillmissing (x, "constant", [88:99], 99), y); %!test -%! x = reshape([1:24],4,3,2); +%! x = reshape ([1:24], 4, 3, 2); %! x([1, 6, 7, 9, 12, 14, 16, 19, 22, 23]) = NaN; %! y = x; -%! y([1,6,7,9 12, 14, 16, 19, 22, 23]) = [94 95 95 96 96 97 97 98 99 99]; +%! y([1, 6, 7, 9, 12, 14, 16, 19, 22, 23]) = [94, 95, 95, 96, 96, 97, 97, 98, 99, 99]; %! assert (fillmissing (x, "constant", [94:99], 1), y); -%! y([1,6,7,9 12, 14, 16, 19, 22, 23]) = [92 93 94 92 95 97 99 98 97 98]; +%! y([1, 6, 7, 9, 12, 14, 16, 19, 22, 23]) = [92, 93, 94, 92, 95, 97, 99, 98, 97, 98]; %! assert (fillmissing (x, "constant", [92:99], 2), y); -%! y([1,6,7,9 12, 14, 16, 19, 22, 23]) = [88 93 94 96 99 89 91 94 97 98]; +%! y([1, 6, 7, 9, 12, 14, 16, 19, 22, 23]) = [88, 93, 94, 96, 99, 89, 91, 94, 97, 98]; %! assert (fillmissing (x, "constant", [88:99], 3), y); -%! y([1,6,7,9 12, 14, 16, 19, 22, 23]) = [76 81 82 84 87 89 91 94 97 98]; +%! y([1, 6, 7, 9, 12, 14, 16, 19, 22, 23]) = [76, 81, 82, 84, 87, 89, 91, 94, 97, 98]; %! assert (fillmissing (x, "constant", [76:99], 99), y); -## tests with different endvalues behavior -%!assert (fillmissing ([1 2 3], "constant", 99, "endvalues", 88), [1 2 3]) -%!assert (fillmissing ([1 NaN 3], "constant", 99, "endvalues", 88), [1 99 3]) -%!assert (fillmissing ([1 2 NaN], "constant", 99, "endvalues", 88), [1 2 88]) -%!assert (fillmissing ([NaN 2 3], "constant", 99, "endvalues", 88), [88 2 3]) -%!assert (fillmissing ([NaN NaN 3], "constant", 99, "endvalues", 88), [88 88 3]) -%!assert (fillmissing ([1 NaN NaN], "constant", 99, "endvalues", 88), [1 88 88]) -%!assert (fillmissing ([NaN 2 NaN], "constant", 99, "endvalues", 88), [88 2 88]) -%!assert (fillmissing ([NaN 2 NaN]', "constant", 99, "endvalues", 88), [88 2 88]') -%!assert (fillmissing ([1 NaN 3 NaN 5], "constant", 99, "endvalues", 88), [1 99 3 99 5]) -%!assert (fillmissing ([1 NaN NaN NaN 5], "constant", 99, "endvalues", 88), [1 99 99 99 5]) -%!assert (fillmissing ([NaN NaN NaN NaN 5], "constant", 99, "endvalues", 88), [88 88 88 88 5]) -%!assert (fillmissing ([1 NaN 3 4 NaN], "constant", 99, "endvalues", 88), [1 99 3 4 88]) -%!assert (fillmissing ([1 NaN 3 4 NaN], "constant", 99, 1, "endvalues", 88), [1 88 3 4 88]) -%!assert (fillmissing ([1 NaN 3 4 NaN], "constant", 99, 1, "endvalues", "extrap"), [1 99 3 4 99]) +## Tests with different endvalues behavior +%!assert (fillmissing ([1, 2, 3], "constant", 99, "endvalues", 88), [1, 2, 3]) +%!assert (fillmissing ([1, NaN, 3], "constant", 99, "endvalues", 88), [1, 99, 3]) +%!assert (fillmissing ([1, 2, NaN], "constant", 99, "endvalues", 88), [1, 2, 88]) +%!assert (fillmissing ([NaN, 2, 3], "constant", 99, "endvalues", 88), [88, 2, 3]) +%!assert (fillmissing ([NaN, NaN, 3], "constant", 99, "endvalues", 88), [88, 88, 3]) +%!assert (fillmissing ([1, NaN, NaN], "constant", 99, "endvalues", 88), [1, 88, 88]) +%!assert (fillmissing ([NaN, 2, NaN], "constant", 99, "endvalues", 88), [88, 2, 88]) +%!assert (fillmissing ([NaN, 2, NaN]', "constant", 99, "endvalues", 88), [88, 2, 88]') +%!assert (fillmissing ([1, NaN, 3, NaN, 5], "constant", 99, "endvalues", 88), [1, 99, 3, 99, 5]) +%!assert (fillmissing ([1, NaN, NaN, NaN, 5], "constant", 99, "endvalues", 88), [1, 99, 99, 99, 5]) +%!assert (fillmissing ([NaN, NaN, NaN, NaN, 5], "constant", 99, "endvalues", 88), [88, 88, 88, 88, 5]) +%!assert (fillmissing ([1, NaN, 3, 4, NaN], "constant", 99, "endvalues", 88), [1, 99, 3, 4, 88]) +%!assert (fillmissing ([1, NaN, 3, 4, NaN], "constant", 99, 1, "endvalues", 88), [1, 88, 3, 4, 88]) +%!assert (fillmissing ([1, NaN, 3, 4, NaN], "constant", 99, 1, "endvalues", "extrap"), [1, 99, 3, 4, 99]) %!test %! x = reshape ([1:24], 3, 4, 2); %! y = x; -%! x([1,2,5,6,8,10,13,16,18,19,20,21,22]) = NaN; -%! y([1,2,5,6,10,13,16,18,19,20,21,22])= 88; y([8])=99; +%! x([1, 2, 5, 6, 8, 10, 13, 16, 18, 19, 20, 21, 22]) = NaN; +%! y([1, 2, 5, 6, 10, 13, 16, 18, 19, 20, 21, 22]) = 88; +%! y([8]) = 99; %! assert (fillmissing (x, "constant", 99, "endvalues", 88), y); %! assert (fillmissing (x, "constant", 99, 1, "endvalues", 88), y); -%! y = x; y([1,2,5,8,10,13,16,19,22])= 88; y([6,18,20,21])=99; +%! y = x; +%! y([1, 2, 5, 8, 10, 13, 16, 19, 22]) = 88; +%! y([6, 18, 20, 21]) = 99; %! assert (fillmissing (x, "constant", 99, 2, "endvalues", 88), y); -%! y(y==99) = 88; +%! y(y == 99) = 88; %! assert (fillmissing (x, "constant", 99, 3, "endvalues", 88), y); %! assert (fillmissing (x, "constant", 99, 4, "endvalues", 88), y); %! assert (fillmissing (x, "constant", 99, 99, "endvalues", 88), y); %! y([8]) = 94; %! assert (fillmissing (x, "constant", [92:99], 1, "endvalues", 88), y); -%! y([6,8,18,20,21]) = [96,88,99,98,99]; +%! y([6, 8, 18, 20, 21]) = [96, 88, 99, 98, 99]; %! assert (fillmissing (x, "constant", [94:99], 2, "endvalues", 88), y); -%! y = x; y(isnan(y)) = 88; +%! y = x; +%! y(isnan (y)) = 88; %! assert (fillmissing (x, "constant", [88:99], 3, "endvalues", 88), y); -%! y = x; y(isnan(y)) = [82,82,83,83,94,85,86,87,87,88,88,88,89]; +%! y = x; +%! y(isnan (y)) = [82, 82, 83, 83, 94, 85, 86, 87, 87, 88, 88, 88, 89]; %! assert (fillmissing (x, "constant", [92:99], 1, "endvalues", [82:89]), y); -%! y = x; y(isnan(y)) = [84,85,85,96,85,84,87,87,99,87,98,99,87]; +%! y = x; +%! y(isnan (y)) = [84, 85, 85, 96, 85, 84, 87, 87, 99, 87, 98, 99, 87]; %! assert (fillmissing (x, "constant", [94:99], 2, "endvalues", [84:89]), y); -%! y = x; y(isnan(y)) = [68,69,72,73,75,77,68,71,73,74,75,76,77]; +%! y = x; +%! y(isnan (y)) = [68, 69, 72, 73, 75, 77, 68, 71, 73, 74, 75, 76, 77]; %! assert (fillmissing (x, "constant", [88:99], 3, "endvalues", [68:79]), y); -%! assert (fillmissing (x, "constant", [88:93;94:99]', 3, "endvalues", [68:73;74:79]'), y) +%! assert (fillmissing (x, "constant", [88:93; 94:99]', 3, "endvalues", [68:73; 74:79]'), y) %!test -%! x = reshape([1:24],4,3,2); +%! x = reshape ([1:24],4,3,2); %! x([1, 6, 7, 9, 12, 14, 16, 19, 22, 23]) = NaN; %! y = x; -%! y([1,6,7,9 12, 14, 16, 19, 22, 23]) = [94 95 95 96 96 97 97 98 99 99]; +%! y([1, 6, 7, 9, 12, 14, 16, 19, 22, 23]) = [94, 95, 95, 96, 96, 97, 97, 98, 99, 99]; %! assert (fillmissing (x, "constant", [94:99], 1), y); -%! y([1,6,7,9 12, 14, 16, 19, 22, 23]) = [92 93 94 92 95 97 99 98 97 98]; +%! y([1, 6, 7, 9, 12, 14, 16, 19, 22, 23]) = [92, 93, 94, 92, 95, 97, 99, 98, 97, 98]; %! assert (fillmissing (x, "constant", [92:99], 2), y); -%! y([1,6,7,9 12, 14, 16, 19, 22, 23]) = [88 93 94 96 99 89 91 94 97 98]; +%! y([1, 6, 7, 9, 12, 14, 16, 19, 22, 23]) = [88, 93, 94, 96, 99, 89, 91, 94, 97, 98]; %! assert (fillmissing (x, "constant", [88:99], 3), y); -%! y([1,6,7,9 12, 14, 16, 19, 22, 23]) = [76 81 82 84 87 89 91 94 97 98]; +%! y([1, 6, 7, 9, 12, 14, 16, 19, 22, 23]) = [76, 81, 82, 84, 87, 89, 91, 94, 97, 98]; %! assert (fillmissing (x, "constant", [76:99], 99), y); ## next/previous tests -%!assert (fillmissing ([1 2 3], "previous"), [1 2 3]) -%!assert (fillmissing ([1 2 3], "next"), [1 2 3]) -%!assert (fillmissing ([1 2 3]', "previous"), [1 2 3]') -%!assert (fillmissing ([1 2 3]', "next"), [1 2 3]') -%!assert (fillmissing ([1 2 NaN], "previous"), [1 2 2]) -%!assert (fillmissing ([1 2 NaN], "next"), [1 2 NaN]) -%!assert (fillmissing ([NaN 2 NaN], "previous"), [NaN 2 2]) -%!assert (fillmissing ([NaN 2 NaN], "next"), [2 2 NaN]) -%!assert (fillmissing ([1 NaN 3], "previous"), [1 1 3]) -%!assert (fillmissing ([1 NaN 3], "next"), [1 3 3]) -%!assert (fillmissing ([1 2 NaN; 4 NaN 6], "previous", 1), [1 2 NaN; 4 2 6]) -%!assert (fillmissing ([1 2 NaN; 4 NaN 6], "previous", 2), [1 2 2; 4 4 6]) -%!assert (fillmissing ([1 2 NaN; 4 NaN 6], "previous", 3), [1 2 NaN; 4 NaN 6]) -%!assert (fillmissing ([1 2 NaN; 4 NaN 6], "next", 1), [1 2 6; 4 NaN 6]) -%!assert (fillmissing ([1 2 NaN; 4 NaN 6], "next", 2), [1 2 NaN; 4 6 6]) -%!assert (fillmissing ([1 2 NaN; 4 NaN 6], "next", 3), [1 2 NaN; 4 NaN 6]) +%!assert (fillmissing ([1, 2, 3], "previous"), [1, 2, 3]) +%!assert (fillmissing ([1, 2, 3], "next"), [1, 2, 3]) +%!assert (fillmissing ([1, 2, 3]', "previous"), [1, 2, 3]') +%!assert (fillmissing ([1, 2, 3]', "next"), [1, 2, 3]') +%!assert (fillmissing ([1, 2, NaN], "previous"), [1, 2, 2]) +%!assert (fillmissing ([1, 2, NaN], "next"), [1, 2, NaN]) +%!assert (fillmissing ([NaN, 2, NaN], "previous"), [NaN, 2, 2]) +%!assert (fillmissing ([NaN, 2, NaN], "next"), [2, 2, NaN]) +%!assert (fillmissing ([1, NaN, 3], "previous"), [1, 1, 3]) +%!assert (fillmissing ([1, NaN, 3], "next"), [1, 3, 3]) +%!assert (fillmissing ([1, 2, NaN; 4, NaN, 6], "previous", 1), [1, 2, NaN; 4, 2, 6]) +%!assert (fillmissing ([1, 2, NaN; 4, NaN, 6], "previous", 2), [1, 2, 2; 4, 4, 6]) +%!assert (fillmissing ([1, 2, NaN; 4, NaN, 6], "previous", 3), [1, 2, NaN; 4, NaN, 6]) +%!assert (fillmissing ([1, 2, NaN; 4, NaN, 6], "next", 1), [1, 2, 6; 4, NaN, 6]) +%!assert (fillmissing ([1, 2, NaN; 4, NaN, 6], "next", 2), [1, 2, NaN; 4, 6, 6]) +%!assert (fillmissing ([1, 2, NaN; 4, NaN, 6], "next", 3), [1, 2, NaN; 4, NaN, 6]) %!test -%! x = reshape([1:24],4,3,2); +%! x = reshape ([1:24], 4, 3, 2); %! x([1, 6, 7, 9, 12, 14, 16, 19, 22, 23]) = NaN; %! y = x; -%! y([1, 6, 7, 9, 14, 19, 22, 23]) = [2 8 8 10 15 20 24 24]; +%! y([1, 6, 7, 9, 14, 19, 22, 23]) = [2, 8, 8, 10, 15, 20, 24, 24]; %! assert (fillmissing (x, "next", 1), y); %! y = x; %! y([1, 6, 7, 14, 16]) = [5, 10, 11, 18, 20]; %! assert (fillmissing (x, "next", 2), y); %! y = x; -%! y([1, 6, 9, 12]) = [13 18 21 24]; +%! y([1, 6, 9, 12]) = [13, 18, 21, 24]; %! assert (fillmissing (x, "next", 3), y); %! assert (fillmissing (x, "next", 99), x); %! y = x; -%! y([6, 7, 12, 14, 16, 19, 22, 23]) = [5 5 11 13 15 18 21 21]; +%! y([6, 7, 12, 14, 16, 19, 22, 23]) = [5, 5, 11, 13, 15, 18, 21, 21]; %! assert (fillmissing (x, "previous", 1), y); %! y = x; -%! y([6, 7, 9, 12, 19, 22, 23]) = [2 3 5 8 15 18 15]; +%! y([6, 7, 9, 12, 19, 22, 23]) = [2, 3, 5, 8, 15, 18, 15]; %! assert (fillmissing (x, "previous", 2), y); %! y = x; -%! y([14, 16, 22, 23]) = [2 4 10 11]; +%! y([14, 16, 22, 23]) = [2, 4, 10, 11]; %! assert (fillmissing (x, "previous", 3), y); %! assert (fillmissing (x, "previous", 99), x); ## next/previous tests with different endvalue behavior -%!assert (fillmissing ([1 2 3], "constant", 0, "endvalues", "previous"), [1 2 3]) -%!assert (fillmissing ([1 2 3], "constant", 0, "endvalues", "next"), [1 2 3]) -%!assert (fillmissing ([1 NaN 3], "constant", 0, "endvalues", "previous"), [1 0 3]) -%!assert (fillmissing ([1 NaN 3], "constant", 0, "endvalues", "next"), [1 0 3]) -%!assert (fillmissing ([1 2 NaN], "constant", 0, "endvalues", "previous"), [1 2 2]) -%!assert (fillmissing ([1 2 NaN], "constant", 0, "endvalues", "next"), [1 2 NaN]) -%!assert (fillmissing ([1 NaN NaN], "constant", 0, "endvalues", "previous"), [1 1 1]) -%!assert (fillmissing ([1 NaN NaN], "constant", 0, "endvalues", "next"), [1 NaN NaN]) -%!assert (fillmissing ([NaN 2 3], "constant", 0, "endvalues", "previous"), [NaN 2 3]) -%!assert (fillmissing ([NaN 2 3], "constant", 0, "endvalues", "next"), [2 2 3]) -%!assert (fillmissing ([NaN NaN 3], "constant", 0, "endvalues", "previous"), [NaN NaN 3]) -%!assert (fillmissing ([NaN NaN 3], "constant", 0, "endvalues", "next"), [3 3 3]) -%!assert (fillmissing ([NaN NaN NaN], "constant", 0, "endvalues", "previous"), [NaN NaN NaN]) -%!assert (fillmissing ([NaN NaN NaN], "constant", 0, "endvalues", "next"), [NaN NaN NaN]) -%!assert (fillmissing ([NaN 2 NaN 4 NaN], "constant", 0, "endvalues", "previous"), [NaN 2 0 4 4]) -%!assert (fillmissing ([NaN 2 NaN 4 NaN], "constant", 0, "endvalues", "next"), [2 2 0 4 NaN]) -%!assert (fillmissing ([NaN 2 NaN 4 NaN], "constant", 0, 1, "endvalues", "previous"), [NaN 2 NaN 4 NaN]) -%!assert (fillmissing ([NaN 2 NaN 4 NaN], "constant", 0, 1, "endvalues", "next"), [NaN 2 NaN 4 NaN]) -%!assert (fillmissing ([NaN 2 NaN 4 NaN], "constant", 0, 2, "endvalues", "previous"), [NaN 2 0 4 4]) -%!assert (fillmissing ([NaN 2 NaN 4 NaN], "constant", 0, 2, "endvalues", "next"), [2 2 0 4 NaN]) -%!assert (fillmissing ([NaN 2 NaN 4 NaN], "constant", 0, 3, "endvalues", "previous"), [NaN 2 NaN 4 NaN]) -%!assert (fillmissing ([NaN 2 NaN 4 NaN], "constant", 0, 3, "endvalues", "next"), [NaN 2 NaN 4 NaN]) +%!assert (fillmissing ([1, 2, 3], "constant", 0, "endvalues", "previous"), [1, 2, 3]) +%!assert (fillmissing ([1, 2, 3], "constant", 0, "endvalues", "next"), [1, 2, 3]) +%!assert (fillmissing ([1, NaN, 3], "constant", 0, "endvalues", "previous"), [1, 0, 3]) +%!assert (fillmissing ([1, NaN, 3], "constant", 0, "endvalues", "next"), [1, 0, 3]) +%!assert (fillmissing ([1, 2, NaN], "constant", 0, "endvalues", "previous"), [1, 2, 2]) +%!assert (fillmissing ([1, 2, NaN], "constant", 0, "endvalues", "next"), [1, 2, NaN]) +%!assert (fillmissing ([1, NaN, NaN], "constant", 0, "endvalues", "previous"), [1, 1, 1]) +%!assert (fillmissing ([1, NaN, NaN], "constant", 0, "endvalues", "next"), [1, NaN, NaN]) +%!assert (fillmissing ([NaN, 2, 3], "constant", 0, "endvalues", "previous"), [NaN, 2, 3]) +%!assert (fillmissing ([NaN, 2, 3], "constant", 0, "endvalues", "next"), [2, 2, 3]) +%!assert (fillmissing ([NaN, NaN, 3], "constant", 0, "endvalues", "previous"), [NaN, NaN, 3]) +%!assert (fillmissing ([NaN, NaN, 3], "constant", 0, "endvalues", "next"), [3, 3, 3]) +%!assert (fillmissing ([NaN, NaN, NaN], "constant", 0, "endvalues", "previous"), [NaN, NaN, NaN]) +%!assert (fillmissing ([NaN, NaN, NaN], "constant", 0, "endvalues", "next"), [NaN, NaN, NaN]) +%!assert (fillmissing ([NaN, 2, NaN, 4, NaN], "constant", 0, "endvalues", "previous"), [NaN, 2, 0, 4, 4]) +%!assert (fillmissing ([NaN, 2, NaN, 4, NaN], "constant", 0, "endvalues", "next"), [2, 2, 0, 4, NaN]) +%!assert (fillmissing ([NaN, 2, NaN, 4, NaN], "constant", 0, 1, "endvalues", "previous"), [NaN, 2, NaN, 4, NaN]) +%!assert (fillmissing ([NaN, 2, NaN, 4, NaN], "constant", 0, 1, "endvalues", "next"), [NaN, 2, NaN, 4, NaN]) +%!assert (fillmissing ([NaN, 2, NaN, 4, NaN], "constant", 0, 2, "endvalues", "previous"), [NaN, 2, 0, 4, 4]) +%!assert (fillmissing ([NaN, 2, NaN, 4, NaN], "constant", 0, 2, "endvalues", "next"), [2, 2, 0, 4, NaN]) +%!assert (fillmissing ([NaN, 2, NaN, 4, NaN], "constant", 0, 3, "endvalues", "previous"), [NaN, 2, NaN, 4, NaN]) +%!assert (fillmissing ([NaN, 2, NaN, 4, NaN], "constant", 0, 3, "endvalues", "next"), [NaN, 2, NaN, 4, NaN]) %!test %! x = reshape ([1:24], 3, 4, 2); -%! x([1,2,5,6,8,10,13,16,18,19,20,21,22]) = NaN; +%! x([1, 2, 5, 6, 8, 10, 13, 16, 18, 19, 20, 21, 22]) = NaN; %! y = x; -%! y([5,6,8,18])=[4,4,0,17]; +%! y([5, 6, 8, 18]) = [4, 4, 0, 17]; %! assert (fillmissing (x, "constant", 0, "endvalues", "previous"), y); %! assert (fillmissing (x, "constant", 0, 1, "endvalues", "previous"), y); %! y = x; -%! y([6,10,18,20,21])=[0,7,0,0,0]; +%! y([6, 10, 18, 20, 21]) = [0, 7, 0, 0, 0]; %! assert (fillmissing (x, "constant", 0, 2, "endvalues", "previous"), y); %! y = x; -%! y([16,19,21])=[4,7,9]; +%! y([16, 19, 21]) = [4, 7, 9]; %! assert (fillmissing (x, "constant", 0, 3, "endvalues", "previous"), y); %! assert (fillmissing (x, "constant", 0, 4, "endvalues", "previous"), x); %! assert (fillmissing (x, "constant", 0, 99, "endvalues", "previous"), x); %! y = x; -%! y([1,2,8,10,13,16,22])=[3,3,0,11,14,17,23]; +%! y([1, 2, 8, 10, 13, 16, 22]) = [3, 3, 0, 11, 14, 17, 23]; %! assert (fillmissing (x, "constant", 0, "endvalues", "next"), y); %! assert (fillmissing (x, "constant", 0, 1, "endvalues", "next"), y); %! y = x; -%! y([1,2,5,6,8,18,20,21])=[4,11,11,0,11,0,0,0]; +%! y([1, 2, 5, 6, 8, 18, 20, 21]) = [4, 11, 11, 0, 11, 0, 0, 0]; %! assert (fillmissing (x, "constant", 0, 2, "endvalues", "next"), y); %! y = x; -%! y([2,5])=[14,17]; +%! y([2, 5]) = [14, 17]; %! assert (fillmissing (x, "constant", 0, 3, "endvalues", "next"), y); %! assert (fillmissing (x, "constant", 0, 4, "endvalues", "next"), x); %! assert (fillmissing (x, "constant", 0, 99, "endvalues", "next"), x); -##tests for nearest -%!assert (fillmissing ([1 2 3], "nearest"), [1 2 3]) -%!assert (fillmissing ([1 2 3]', "nearest"), [1 2 3]') -%!assert (fillmissing ([1 2 NaN], "nearest"), [1 2 2]) -%!assert (fillmissing ([NaN 2 NaN], "nearest"), [2 2 2]) -%!assert (fillmissing ([1 NaN 3], "nearest"), [1 3 3]) -%!assert (fillmissing ([1 2 NaN; 4 NaN 6], "nearest", 1), [1 2 6; 4 2 6]) -%!assert (fillmissing ([1 2 NaN; 4 NaN 6], "nearest", 2), [1 2 2; 4 6 6]) -%!assert (fillmissing ([1 2 NaN; 4 NaN 6], "nearest", 3), [1 2 NaN; 4 NaN 6]) -%!assert (fillmissing ([1 NaN 3 NaN 5], "nearest"), [1 3 3 5 5]) -%!assert (fillmissing ([1 NaN 3 NaN 5], "nearest", "samplepoints", [0 1 2 3 4]), [1 3 3 5 5]) -%!assert (fillmissing ([1 NaN 3 NaN 5], "nearest", "samplepoints", [0.5 1 2 3 5]), [1 1 3 3 5]) +## Tests for nearest +%!assert (fillmissing ([1, 2, 3], "nearest"), [1, 2, 3]) +%!assert (fillmissing ([1, 2, 3]', "nearest"), [1, 2, 3]') +%!assert (fillmissing ([1, 2, NaN], "nearest"), [1, 2, 2]) +%!assert (fillmissing ([NaN, 2, NaN], "nearest"), [2, 2, 2]) +%!assert (fillmissing ([1, NaN, 3], "nearest"), [1, 3, 3]) +%!assert (fillmissing ([1, 2, NaN; 4, NaN, 6], "nearest", 1), [1, 2, 6; 4, 2, 6]) +%!assert (fillmissing ([1, 2, NaN; 4, NaN, 6], "nearest", 2), [1, 2, 2; 4, 6, 6]) +%!assert (fillmissing ([1, 2, NaN; 4, NaN, 6], "nearest", 3), [1, 2, NaN; 4, NaN, 6]) +%!assert (fillmissing ([1, NaN, 3, NaN, 5], "nearest"), [1, 3, 3, 5, 5]) +%!assert (fillmissing ([1, NaN, 3, NaN, 5], "nearest", "samplepoints", [0, 1, 2, 3, 4]), [1, 3, 3, 5, 5]) +%!assert (fillmissing ([1, NaN, 3, NaN, 5], "nearest", "samplepoints", [0.5, 1, 2, 3, 5]), [1, 1, 3, 3, 5]) %!test -%! x = reshape([1:24],4,3,2); +%! x = reshape ([1:24], 4, 3, 2); %! x([1, 6, 7, 9, 12, 14, 16, 19, 22, 23]) = NaN; %! y = x; -%! y([1, 6, 7, 9, 12, 14, 16, 19, 22, 23]) = [2 5 8 10 11 15 15 20 21 24]; +%! y([1, 6, 7, 9, 12, 14, 16, 19, 22, 23]) = [2, 5, 8, 10, 11, 15, 15, 20, 21, 24]; %! assert (fillmissing (x, "nearest", 1), y); %! y = x; -%! y([1, 6, 7, 9, 12, 14, 16, 19, 22, 23]) = [5 10 11 5 8 18 20 15 18 15]; +%! y([1, 6, 7, 9, 12, 14, 16, 19, 22, 23]) = [5, 10, 11, 5, 8, 18, 20, 15, 18, 15]; %! assert (fillmissing (x, "nearest", 2), y); %! y = x; -%! y([1, 6, 9, 12, 14, 16, 22, 23]) = [13 18 21 24 2 4 10 11]; +%! y([1, 6, 9, 12, 14, 16, 22, 23]) = [13, 18, 21, 24, 2, 4, 10, 11]; %! assert (fillmissing (x, "nearest", 3), y); %! assert (fillmissing (x, "nearest", 99), x); -##tests for nearest with diff endvalue behavior -%!assert (fillmissing ([1 2 3], "constant", 0, "endvalues", "nearest"), [1 2 3]) -%!assert (fillmissing ([1 NaN 3], "constant", 0, "endvalues", "nearest"), [1 0 3]) -%!assert (fillmissing ([1 2 NaN], "constant", 0, "endvalues", "nearest"), [1 2 2]) -%!assert (fillmissing ([1 NaN NaN], "constant", 0, "endvalues", "nearest"), [1 1 1]) -%!assert (fillmissing ([NaN 2 3], "constant", 0, "endvalues", "nearest"), [2 2 3]) -%!assert (fillmissing ([NaN NaN 3], "constant", 0, "endvalues", "nearest"), [3 3 3]) -%!assert (fillmissing ([NaN NaN NaN], "constant", 0, "endvalues", "nearest"), [NaN NaN NaN]) -%!assert (fillmissing ([NaN 2 NaN 4 NaN], "constant", 0, "endvalues", "nearest"), [2 2 0 4 4]) -%!assert (fillmissing ([NaN 2 NaN 4 NaN], "constant", 0, 1, "endvalues", "nearest"), [NaN 2 NaN 4 NaN]) -%!assert (fillmissing ([NaN 2 NaN 4 NaN], "constant", 0, 2, "endvalues", "nearest"), [2 2 0 4 4]) -%!assert (fillmissing ([NaN 2 NaN 4 NaN], "constant", 0, 3, "endvalues", "nearest"), [NaN 2 NaN 4 NaN]) +## Tests for nearest with diff endvalue behavior +%!assert (fillmissing ([1, 2, 3], "constant", 0, "endvalues", "nearest"), [1, 2, 3]) +%!assert (fillmissing ([1, NaN, 3], "constant", 0, "endvalues", "nearest"), [1 0 3]) +%!assert (fillmissing ([1, 2, NaN], "constant", 0, "endvalues", "nearest"), [1, 2, 2]) +%!assert (fillmissing ([1, NaN, NaN], "constant", 0, "endvalues", "nearest"), [1, 1, 1]) +%!assert (fillmissing ([NaN, 2, 3], "constant", 0, "endvalues", "nearest"), [2, 2, 3]) +%!assert (fillmissing ([NaN, NaN, 3], "constant", 0, "endvalues", "nearest"), [3, 3, 3]) +%!assert (fillmissing ([NaN, NaN, NaN], "constant", 0, "endvalues", "nearest"), [NaN, NaN, NaN]) +%!assert (fillmissing ([NaN, 2, NaN, 4, NaN], "constant", 0, "endvalues", "nearest"), [2, 2, 0, 4, 4]) +%!assert (fillmissing ([NaN, 2, NaN, 4, NaN], "constant", 0, 1, "endvalues", "nearest"), [NaN, 2, NaN, 4, NaN]) +%!assert (fillmissing ([NaN, 2, NaN, 4, NaN], "constant", 0, 2, "endvalues", "nearest"), [2, 2, 0, 4, 4]) +%!assert (fillmissing ([NaN, 2, NaN, 4, NaN], "constant", 0, 3, "endvalues", "nearest"), [NaN, 2, NaN, 4, NaN]) %!test %! x = reshape ([1:24], 3, 4, 2); -%! x([1,2,5,6,8,10,13,16,18,19,20,21,22]) = NaN; +%! x([1, 2, 5, 6, 8, 10, 13, 16, 18, 19, 20, 21, 22]) = NaN; %! y = x; -%! y([1,2,5,6,8,10,13,16,18,22])=[3 3 4 4 0 11 14 17 17 23]; +%! y([1, 2, 5, 6, 8, 10, 13, 16, 18, 22]) = [3, 3, 4, 4, 0, 11, 14, 17, 17, 23]; %! assert (fillmissing (x, "constant", 0, "endvalues", "nearest"), y); %! assert (fillmissing (x, "constant", 0, 1, "endvalues", "nearest"), y); %! y = x; -%! y([1,2,5,6,8,10,18,20,21])=[4 11 11 0 11 7 0 0 0]; +%! y([1, 2, 5, 6, 8, 10, 18, 20, 21]) = [4, 11, 11, 0, 11, 7, 0, 0, 0]; %! assert (fillmissing (x, "constant", 0, 2, "endvalues", "nearest"), y); %! y = x; -%! y([2,5,16,19,21])=[14 17 4 7 9]; +%! y([2, 5, 16, 19, 21]) = [14, 17, 4, 7, 9]; %! assert (fillmissing (x, "constant", 0, 3, "endvalues", "nearest"), y); %! assert (fillmissing (x, "constant", 0, 99, "endvalues", "nearest"), x); -##tests for linear -%!assert (fillmissing ([1 2 3], "linear"), [1 2 3]) -%!assert (fillmissing ([1 2 3]', "linear"), [1 2 3]') -%!assert (fillmissing ([1 2 NaN], "linear"), [1 2 3]) -%!assert (fillmissing ([NaN 2 NaN], "linear"), [NaN 2 NaN]) -%!assert (fillmissing ([1 NaN 3], "linear"), [1 2 3]) -%!assert (fillmissing ([1 2 NaN; 4 NaN 6], "linear", 1), [1 2 NaN; 4 NaN 6]) -%!assert (fillmissing ([1 2 NaN; 4 NaN 6], "linear", 2), [1 2 3; 4 5 6]) -%!assert (fillmissing ([1 2 NaN; 4 NaN 6], "linear", 3), [1 2 NaN; 4 NaN 6]) -%!assert (fillmissing ([1 NaN 3 NaN 5], "linear"), [1 2 3 4 5]) -%!assert (fillmissing ([1 NaN 3 NaN 5], "linear", "samplepoints", [0 1 2 3 4]), [1 2 3 4 5]) -%!assert (fillmissing ([1 NaN 3 NaN 5], "linear", "samplepoints", [0 1.5 2 5 14]), [1 2.5 3 3.5 5], eps) +## Tests for linear +%!assert (fillmissing ([1, 2, 3], "linear"), [1, 2, 3]) +%!assert (fillmissing ([1, 2, 3]', "linear"), [1, 2, 3]') +%!assert (fillmissing ([1, 2, NaN], "linear"), [1, 2, 3]) +%!assert (fillmissing ([NaN, 2, NaN], "linear"), [NaN, 2, NaN]) +%!assert (fillmissing ([1, NaN, 3], "linear"), [1, 2, 3]) +%!assert (fillmissing ([1, 2, NaN; 4, NaN, 6], "linear", 1), [1, 2, NaN; 4, NaN, 6]) +%!assert (fillmissing ([1, 2, NaN; 4, NaN, 6], "linear", 2), [1, 2, 3; 4, 5, 6]) +%!assert (fillmissing ([1, 2, NaN; 4, NaN, 6], "linear", 3), [1, 2, NaN; 4, NaN, 6]) +%!assert (fillmissing ([1, NaN, 3, NaN, 5], "linear"), [1, 2, 3, 4, 5]) +%!assert (fillmissing ([1, NaN, 3, NaN, 5], "linear", "samplepoints", [0, 1, 2, 3, 4]), [1, 2, 3, 4, 5]) +%!assert (fillmissing ([1, NaN, 3, NaN, 5], "linear", "samplepoints", [0, 1.5, 2, 5, 14]), [1, 2.5, 3, 3.5, 5], eps) %!test -%! x = reshape([1:24],4,3,2); +%! x = reshape ([1:24], 4, 3, 2); %! x([1, 6, 7, 9, 12, 14, 16, 19, 22, 23]) = NaN; -%! assert (fillmissing (x, "linear", 1), reshape([1:24],4,3,2)); -%! y = reshape([1:24],4,3,2); -%! y([1 9 14 19 22 23]) = NaN; +%! assert (fillmissing (x, "linear", 1), reshape ([1:24], 4, 3, 2)); +%! y = reshape ([1:24], 4, 3, 2); +%! y([1, 9, 14, 19, 22, 23]) = NaN; %! assert (fillmissing (x, "linear", 2), y); -%! y = reshape([1:24],4,3,2); +%! y = reshape ([1:24], 4, 3, 2); %! y([1, 6, 7, 9, 12, 14, 16, 19, 22, 23]) = NaN; %! assert (fillmissing (x, "linear", 3), y); %! assert (fillmissing (x, "linear", 99), x); -##tests for linear with diff endvalue behavior -%!assert (fillmissing ([1 2 3], "linear", "endvalues", 0), [1 2 3]) -%!assert (fillmissing ([1 NaN 3], "linear", "endvalues", 0), [1 2 3]) -%!assert (fillmissing ([1 2 NaN], "linear", "endvalues", 0), [1 2 0]) -%!assert (fillmissing ([1 NaN NaN], "linear", "endvalues", 0), [1 0 0]) -%!assert (fillmissing ([NaN 2 3], "linear", "endvalues", 0), [0 2 3]) -%!assert (fillmissing ([NaN NaN 3], "linear", "endvalues", 0), [0 0 3]) -%!assert (fillmissing ([NaN NaN NaN], "linear", "endvalues", 0), [0 0 0]) -%!assert (fillmissing ([NaN 2 NaN 4 NaN], "linear", "endvalues", 0), [0 2 3 4 0]) -%!assert (fillmissing ([NaN 2 NaN 4 NaN], "linear", 1, "endvalues", 0), [0 2 0 4 0]) -%!assert (fillmissing ([NaN 2 NaN 4 NaN], "linear", 2, "endvalues", 0), [0 2 3 4 0]) -%!assert (fillmissing ([NaN 2 NaN 4 NaN], "linear", 3, "endvalues", 0), [0 2 0 4 0]) +## Tests for linear with diff endvalue behavior +%!assert (fillmissing ([1, 2, 3], "linear", "endvalues", 0), [1, 2, 3]) +%!assert (fillmissing ([1, NaN, 3], "linear", "endvalues", 0), [1, 2, 3]) +%!assert (fillmissing ([1, 2, NaN], "linear", "endvalues", 0), [1, 2, 0]) +%!assert (fillmissing ([1, NaN, NaN], "linear", "endvalues", 0), [1, 0, 0]) +%!assert (fillmissing ([NaN, 2, 3], "linear", "endvalues", 0), [0, 2, 3]) +%!assert (fillmissing ([NaN, NaN, 3], "linear", "endvalues", 0), [0, 0, 3]) +%!assert (fillmissing ([NaN, NaN, NaN], "linear", "endvalues", 0), [0, 0, 0]) +%!assert (fillmissing ([NaN, 2, NaN, 4, NaN], "linear", "endvalues", 0), [0, 2, 3, 4, 0]) +%!assert (fillmissing ([NaN, 2, NaN, 4, NaN], "linear", 1, "endvalues", 0), [0, 2, 0, 4, 0]) +%!assert (fillmissing ([NaN, 2, NaN, 4, NaN], "linear", 2, "endvalues", 0), [0, 2, 3, 4, 0]) +%!assert (fillmissing ([NaN, 2, NaN, 4, NaN], "linear", 3, "endvalues", 0), [0, 2, 0, 4, 0]) %!test %! x = reshape ([1:24], 3, 4, 2); -%! x([1,2,5,6,8,10,13,16,18,19,20,21,22]) = NaN; +%! x([1, 2, 5, 6, 8, 10, 13, 16, 18, 19, 20, 21, 22]) = NaN; %! y = x; -%! y([1,2,5,6,10,13,16,18,19,20,21,22])=0; y(8)=8; +%! y([1, 2, 5, 6, 10, 13, 16, 18, 19, 20, 21, 22]) = 0; +%! y(8) = 8; %! assert (fillmissing (x, "linear", "endvalues", 0), y); %! assert (fillmissing (x, "linear", 1, "endvalues", 0), y); %! y = x; -%! y([1,2,5,8,10,13,16,19,22])=0; y([6,18,20,21])=[6,18,20,21]; +%! y([1, 2, 5, 8, 10, 13, 16, 19, 22]) = 0; +%! y([6, 18, 20, 21]) = [6, 18, 20, 21]; %! assert (fillmissing (x, "linear", 2, "endvalues", 0), y); %! y = x; -%! y(isnan(y))=0; +%! y(isnan(y)) = 0; %! assert (fillmissing (x, "linear", 3, "endvalues", 0), y); %! assert (fillmissing (x, "linear", 99, "endvalues", 0), y); -##tests with linear only on endvalues -%!assert (fillmissing ([1 2 3], "constant", 99, "endvalues", "linear"), [1 2 3]) -%!assert (fillmissing ([1 NaN 3], "constant", 99, "endvalues", "linear"), [1 99 3]) -%!assert (fillmissing ([1 NaN 3 NaN], "constant", 99, "endvalues", "linear"), [1 99 3 4]) -%!assert (fillmissing ([NaN 2 NaN 4 NaN], "constant", 99, "endvalues", "linear"), [1 2 99 4 5]) -%!assert (fillmissing ([NaN 2 NaN NaN], "constant", 99, "endvalues", "linear"), [NaN 2 NaN NaN]) -%!assert (fillmissing ([NaN 2 NaN 4 NaN], "constant", 99, "endvalues", "linear", "samplepoints", [1 2 3 4 5]), [1 2 99 4 5]) -%!assert (fillmissing ([NaN 2 NaN 4 NaN], "constant", 99, "endvalues", "linear", "samplepoints", [0 2 3 4 10]), [0 2 99 4 10]) +## Tests with linear only on endvalues +%!assert (fillmissing ([1, 2, 3], "constant", 99, "endvalues", "linear"), [1, 2, 3]) +%!assert (fillmissing ([1, NaN, 3], "constant", 99, "endvalues", "linear"), [1, 99, 3]) +%!assert (fillmissing ([1, NaN, 3, NaN], "constant", 99, "endvalues", "linear"), [1, 99, 3, 4]) +%!assert (fillmissing ([NaN, 2, NaN, 4, NaN], "constant", 99, "endvalues", "linear"), [1, 2, 99, 4, 5]) +%!assert (fillmissing ([NaN, 2, NaN, NaN], "constant", 99, "endvalues", "linear"), [NaN, 2, NaN, NaN]) +%!assert (fillmissing ([NaN, 2, NaN, 4, NaN], "constant", 99, "endvalues", "linear", "samplepoints", [1, 2, 3, 4, 5]), [1, 2, 99, 4, 5]) +%!assert (fillmissing ([NaN, 2, NaN, 4, NaN], "constant", 99, "endvalues", "linear", "samplepoints", [0, 2, 3, 4, 10]), [0, 2, 99, 4, 10]) -##test other interpolants +## Test other interpolants +%!test %! x = reshape ([1:24], 3, 4, 2); -%! x([1,2,5,6,8,10,13,16,18,19,20,21,22]) = NaN; +%! x([1, 2, 5, 6, 8, 10, 13, 16, 18, 19, 20, 21, 22]) = NaN; %! y = x; -%! y([1,6,10,18,20,21]) = [2.5, 5, 8.5, 17.25, 21, 21.75]; +%! y([1, 6, 10, 18, 20, 21]) = [2.5, 5, 8.5, 17.25, 21, 21.75]; %! assert (fillmissing (x, "linear", 2, "samplepoints", [2 4 8 10]), y, eps); -%! y([1,6,10,18,20,21]) = [2.5, 4.5, 8.5, 17.25, 21.5, 21.75]; -%! assert (fillmissing (x, "spline", 2, "samplepoints", [2 4 8 10]), y, eps); -%! y([1,6,10,18,20,21]) = [2.5, 4.559386973180077, 8.5, 17.25, 21.440613026819925, 21.75]; -%! assert (fillmissing (x, "pchip", 2, "samplepoints", [2 4 8 10]), y, 10*eps); +%! y([1, 6, 10, 18, 20, 21]) = [2.5, 4.5, 8.5, 17.25, 21.5, 21.75]; +%! assert (fillmissing (x, "spline", 2, "samplepoints", [2, 4, 8, 10]), y, eps); +%! y([1, 6, 10, 18, 20, 21]) = [2.5, 4.559386973180077, 8.5, 17.25, 21.440613026819925, 21.75]; +%! assert (fillmissing (x, "pchip", 2, "samplepoints", [2, 4, 8, 10]), y, 10*eps); ## known fail: makima method not yet implemented in interp1 %!test <60965> %! x = reshape ([1:24], 3, 4, 2); -%! x([1,2,5,6,8,10,13,16,18,19,20,21,22]) = NaN; +%! x([1, 2, 5, 6, 8, 10, 13, 16, 18, 19, 20, 21, 22]) = NaN; %! y = x; -%! y([1,6,10,18,20,21]) = [2.5, 4.609523809523809, 8.5, 17.25, 21.390476190476186, 21.75]; -%! assert (fillmissing (x, "makima", 2, "samplepoints", [2 4 8 10]), y, 10*eps); - -##test other interpolants code path on endvalues -%!assert (fillmissing ([1 2 3], "constant", 99, "endvalues", "spline"), [1 2 3]) -%!assert (fillmissing ([1 NaN 3], "constant", 99, "endvalues", "spline"), [1 99 3]) -%!assert (fillmissing ([1 NaN 3 NaN], "constant", 99, "endvalues", "spline"), [1 99 3 4]) -%!assert (fillmissing ([NaN 2 NaN 4 NaN], "constant", 99, "endvalues", "spline"), [1 2 99 4 5]) -%!assert (fillmissing ([NaN 2 NaN NaN], "constant", 99, "endvalues", "spline"), [NaN 2 NaN NaN]) -%!assert (fillmissing ([NaN 2 NaN 4 NaN], "constant", 99, "endvalues", "spline", "samplepoints", [1 2 3 4 5]), [1 2 99 4 5]) -%!assert (fillmissing ([NaN 2 NaN 4 NaN], "constant", 99, "endvalues", "spline", "samplepoints", [0 2 3 4 10]), [0 2 99 4 10]) - - -## test movmean -%!assert (fillmissing ([1 2 3], "movmean", 1), [1 2 3]) -%!assert (fillmissing ([1 2 NaN], "movmean", 1), [1 2 NaN]) -%!assert (fillmissing ([1 2 3], "movmean", 2), [1 2 3]) -%!assert (fillmissing ([1 2 3], "movmean", [1 0]), [1 2 3]) -%!assert (fillmissing ([1 2 3]', "movmean", 2), [1 2 3]') -%!assert (fillmissing ([1 2 NaN], "movmean", 2), [1 2 2]) -%!assert (fillmissing ([1 2 NaN], "movmean", [1 0]), [1 2 2]) -%!assert (fillmissing ([1 2 NaN], "movmean", [1 0]'), [1 2 2]) -%!assert (fillmissing ([NaN 2 NaN], "movmean", 2), [NaN 2 2]) -%!assert (fillmissing ([NaN 2 NaN], "movmean", [1 0]), [NaN 2 2]) -%!assert (fillmissing ([NaN 2 NaN], "movmean", [0 1]), [2 2 NaN]) -%!assert (fillmissing ([NaN 2 NaN], "movmean", [0 1.1]), [2 2 NaN]) -%!assert (fillmissing ([1 NaN 3 NaN 5], "movmean", [3 0]), [1 1 3 2 5]) -%!assert (fillmissing ([1 2 NaN; 4 NaN 6], "movmean", 3, 1), [1 2 6; 4 2 6]) -%!assert (fillmissing ([1 2 NaN; 4 NaN 6], "movmean", 3, 2), [1 2 2; 4 5 6]) -%!assert (fillmissing ([1 2 NaN; 4 NaN 6], "movmean", 3, 3), [1 2 NaN; 4 NaN 6]) -%!assert (fillmissing ([1 NaN 3 NaN 5], "movmean", 99), [1 3 3 3 5]) -%!assert (fillmissing ([1 NaN 3 NaN 5], "movmean", 99, 1), [1 NaN 3 NaN 5]) -%!assert (fillmissing ([1 NaN 3 NaN 5]', "movmean", 99, 1), [1 3 3 3 5]') -%!assert (fillmissing ([1 NaN 3 NaN 5], "movmean", 99, 2), [1 3 3 3 5]) -%!assert (fillmissing ([1 NaN 3 NaN 5]', "movmean", 99, 2), [1 NaN 3 NaN 5]') - -%!assert (fillmissing ([1 NaN NaN NaN 5], "movmean", 3, "samplepoints", [1 2 3 4 5]), [1 1 NaN 5 5]) -%!assert (fillmissing ([1 NaN NaN NaN 5], "movmean", [1 1], "samplepoints", [1 2 3 4 5]), [1 1 NaN 5 5]) -%!assert (fillmissing ([1 NaN NaN NaN 5], "movmean", [1.5 1.5], "samplepoints", [1 2 3 4 5]), [1 1 NaN 5 5]) -%!assert (fillmissing ([1 NaN NaN NaN 5], "movmean", 4, "samplepoints", [1 2 3 4 5]), [1 1 1 5 5]) -%!assert (fillmissing ([1 NaN NaN NaN 5], "movmean", [2 2], "samplepoints", [1 2 3 4 5]), [1 1 3 5 5]) -%!assert (fillmissing ([1 NaN NaN NaN 5], "movmean", 4.0001, "samplepoints", [1 2 3 4 5]), [1 1 3 5 5]) -%!assert (fillmissing ([1 NaN NaN NaN 5], "movmean", 3, "samplepoints", [1.5 2 3 4 5]), [1 1 1 5 5]) -%!assert (fillmissing ([1 NaN NaN NaN 5], "movmean", 3, "samplepoints", [1 2 3 4 4.5]), [1 1 NaN 5 5]) -%!assert (fillmissing ([1 NaN NaN NaN 5], "movmean", 3, "samplepoints", [1.5 2 3 4 4.5]), [1 1 1 5 5]) -%!assert (fillmissing ([1 NaN NaN NaN 5], "movmean", [1.5 1.5], "samplepoints", [1.5 2 3 4 5]), [1 1 1 5 5]) -%!assert (fillmissing ([1 NaN NaN NaN 5], "movmean", [1.5 1.5], "samplepoints", [1 2 3 4 4.5]), [1 1 5 5 5]) -%!assert (fillmissing ([1 NaN NaN NaN 5], "movmean", [1.5 1.5], "samplepoints", [1.5 2 3 4 4.5]), [1 1 3 5 5]) +%! y([1, 6, 10, 18, 20, 21]) = [2.5, 4.609523809523809, 8.5, 17.25, 21.390476190476186, 21.75]; +%! assert (fillmissing (x, "makima", 2, "samplepoints", [2, 4, 8, 10]), y, 10*eps); + +## Test other interpolants code path on endvalues +%!assert (fillmissing ([1, 2, 3], "constant", 99, "endvalues", "spline"), [1, 2, 3]) +%!assert (fillmissing ([1, NaN, 3], "constant", 99, "endvalues", "spline"), [1, 99, 3]) +%!assert (fillmissing ([1, NaN, 3, NaN], "constant", 99, "endvalues", "spline"), [1, 99, 3, 4]) +%!assert (fillmissing ([NaN, 2, NaN, 4, NaN], "constant", 99, "endvalues", "spline"), [1, 2, 99, 4, 5]) +%!assert (fillmissing ([NaN, 2, NaN, NaN], "constant", 99, "endvalues", "spline"), [NaN, 2, NaN, NaN]) +%!assert (fillmissing ([NaN, 2, NaN, 4, NaN], "constant", 99, "endvalues", "spline", "samplepoints", [1, 2, 3, 4, 5]), [1, 2, 99, 4, 5]) +%!assert (fillmissing ([NaN, 2, NaN, 4, NaN], "constant", 99, "endvalues", "spline", "samplepoints", [0, 2, 3, 4, 10]), [0, 2, 99, 4, 10]) + +## Test movmean +%!assert (fillmissing ([1, 2, 3], "movmean", 1), [1, 2, 3]) +%!assert (fillmissing ([1, 2, NaN], "movmean", 1), [1, 2, NaN]) +%!assert (fillmissing ([1, 2, 3], "movmean", 2), [1, 2, 3]) +%!assert (fillmissing ([1, 2, 3], "movmean", [1, 0]), [1, 2, 3]) +%!assert (fillmissing ([1, 2, 3]', "movmean", 2), [1, 2, 3]') +%!assert (fillmissing ([1, 2, NaN], "movmean", 2), [1, 2, 2]) +%!assert (fillmissing ([1, 2, NaN], "movmean", [1, 0]), [1, 2, 2]) +%!assert (fillmissing ([1, 2, NaN], "movmean", [1, 0]'), [1, 2, 2]) +%!assert (fillmissing ([NaN, 2, NaN], "movmean", 2), [NaN, 2, 2]) +%!assert (fillmissing ([NaN, 2, NaN], "movmean", [1, 0]), [NaN, 2, 2]) +%!assert (fillmissing ([NaN, 2, NaN], "movmean", [0, 1]), [2, 2, NaN]) +%!assert (fillmissing ([NaN, 2, NaN], "movmean", [0, 1.1]), [2, 2, NaN]) +%!assert (fillmissing ([1, NaN, 3, NaN, 5], "movmean", [3, 0]), [1, 1, 3, 2, 5]) +%!assert (fillmissing ([1, 2, NaN; 4, NaN, 6], "movmean", 3, 1), [1, 2, 6; 4, 2, 6]) +%!assert (fillmissing ([1, 2, NaN; 4, NaN, 6], "movmean", 3, 2), [1, 2, 2; 4, 5, 6]) +%!assert (fillmissing ([1, 2, NaN; 4, NaN, 6], "movmean", 3, 3), [1, 2, NaN; 4, NaN, 6]) +%!assert (fillmissing ([1, NaN, 3, NaN, 5], "movmean", 99), [1, 3, 3, 3, 5]) +%!assert (fillmissing ([1, NaN, 3, NaN, 5], "movmean", 99, 1), [1, NaN, 3, NaN, 5]) +%!assert (fillmissing ([1, NaN, 3, NaN, 5]', "movmean", 99, 1), [1, 3, 3, 3, 5]') +%!assert (fillmissing ([1, NaN, 3, NaN, 5], "movmean", 99, 2), [1, 3, 3, 3, 5]) +%!assert (fillmissing ([1, NaN, 3, NaN, 5]', "movmean", 99, 2), [1, NaN, 3, NaN, 5]') + +%!assert (fillmissing ([1, NaN, NaN, NaN, 5], "movmean", 3, "samplepoints", [1, 2, 3, 4, 5]), [1, 1, NaN, 5, 5]) +%!assert (fillmissing ([1, NaN, NaN, NaN, 5], "movmean", [1, 1], "samplepoints", [1, 2, 3, 4, 5]), [1, 1, NaN, 5, 5]) +%!assert (fillmissing ([1, NaN, NaN, NaN, 5], "movmean", [1.5, 1.5], "samplepoints", [1, 2, 3, 4, 5]), [1, 1, NaN, 5, 5]) +%!assert (fillmissing ([1, NaN, NaN, NaN, 5], "movmean", 4, "samplepoints", [1, 2, 3, 4, 5]), [1, 1, 1, 5, 5]) +%!assert (fillmissing ([1, NaN, NaN, NaN, 5], "movmean", [2, 2], "samplepoints", [1, 2, 3, 4, 5]), [1, 1, 3, 5, 5]) +%!assert (fillmissing ([1, NaN, NaN, NaN, 5], "movmean", 4.0001, "samplepoints", [1, 2, 3, 4, 5]), [1, 1, 3, 5, 5]) +%!assert (fillmissing ([1, NaN, NaN, NaN, 5], "movmean", 3, "samplepoints", [1.5, 2, 3, 4, 5]), [1, 1, 1, 5, 5]) +%!assert (fillmissing ([1, NaN, NaN, NaN, 5], "movmean", 3, "samplepoints", [1 2, 3, 4, 4.5]), [1, 1, NaN, 5, 5]) +%!assert (fillmissing ([1, NaN, NaN, NaN, 5], "movmean", 3, "samplepoints", [1.5, 2, 3, 4, 4.5]), [1, 1, 1, 5, 5]) +%!assert (fillmissing ([1, NaN, NaN, NaN, 5], "movmean", [1.5, 1.5], "samplepoints", [1.5, 2, 3, 4, 5]), [1, 1, 1, 5, 5]) +%!assert (fillmissing ([1, NaN, NaN, NaN, 5], "movmean", [1.5, 1.5], "samplepoints", [1, 2, 3, 4, 4.5]), [1, 1, 5, 5, 5]) +%!assert (fillmissing ([1, NaN, NaN, NaN, 5], "movmean", [1.5, 1.5], "samplepoints", [1.5, 2 3, 4, 4.5]), [1, 1, 3, 5, 5]) %!test %! x = reshape ([1:24], 3, 4, 2); -%! x([1,2,5,6,8,10,13,16,18,19,20,21,22]) = NaN; +%! x([1, 2, 5, 6, 8, 10, 13, 16, 18, 19, 20, 21, 22]) = NaN; %! y = x; -%! y([2,5,8,10,13,16,18,22]) = [3,4,8,11,14,17,17,23]; +%! y([2, 5, 8, 10, 13, 16, 18, 22]) = [3, 4, 8, 11, 14, 17, 17, 23]; %! assert (fillmissing (x, "movmean", 3), y); -%! assert (fillmissing (x, "movmean", [1 1]), y); +%! assert (fillmissing (x, "movmean", [1, 1]), y); %! assert (fillmissing (x, "movmean", 3, "endvalues", "extrap"), y); -%! assert (fillmissing (x, "movmean", 3, "samplepoints", [1 2 3]), y); +%! assert (fillmissing (x, "movmean", 3, "samplepoints", [1, 2, 3]), y); %! y = x; -%! y([1,6,8,10,18,20,21]) = [4,6,11,7,15,20,24]; +%! y([1, 6, 8, 10, 18, 20, 21]) = [4, 6, 11, 7, 15, 20, 24]; %! assert (fillmissing (x, "movmean", 3, 2), y); -%! assert (fillmissing (x, "movmean", [1 1], 2), y); +%! assert (fillmissing (x, "movmean", [1, 1], 2), y); %! assert (fillmissing (x, "movmean", 3, 2, "endvalues", "extrap"), y); -%! assert (fillmissing (x, "movmean", 3, 2, "samplepoints", [1 2 3 4]), y); -%! y([1,18]) = NaN; y(6) = 9; -%! assert (fillmissing (x, "movmean", 3, 2, "samplepoints", [0 2 3 4]), y); +%! assert (fillmissing (x, "movmean", 3, 2, "samplepoints", [1, 2, 3, 4]), y); +%! y([1, 18]) = NaN; +%! y(6) = 9; +%! assert (fillmissing (x, "movmean", 3, 2, "samplepoints", [0, 2, 3, 4]), y); %! y = x; -%! y([1,2,5,6,10,13,16,18,19,20,21,22]) = 99; y(8) = 8; +%! y([1, 2, 5, 6, 10, 13, 16, 18, 19, 20, 21, 22]) = 99; +%! y(8) = 8; %! assert (fillmissing (x, "movmean", 3, "endvalues", 99), y); %! y = x; -%! y([1,2,5,8,10,13,16,19,22]) = 99; y([6,18,20,21]) = [6,15,20,24]; +%! y([1, 2, 5, 8, 10, 13, 16, 19, 22]) = 99; +%! y([6, 18, 20, 21]) = [6, 15, 20, 24]; %! assert (fillmissing (x, "movmean", 3, 2, "endvalues", 99), y); -## test movmedian -%!assert (fillmissing ([1 2 3], "movmedian", 1), [1 2 3]) -%!assert (fillmissing ([1 2 NaN], "movmedian", 1), [1 2 NaN]) -%!assert (fillmissing ([1 2 3], "movmedian", 2), [1 2 3]) -%!assert (fillmissing ([1 2 3], "movmedian", [1 0]), [1 2 3]) -%!assert (fillmissing ([1 2 3]', "movmedian", 2), [1 2 3]') -%!assert (fillmissing ([1 2 NaN], "movmedian", 2), [1 2 2]) -%!assert (fillmissing ([1 2 NaN], "movmedian", [1 0]), [1 2 2]) -%!assert (fillmissing ([1 2 NaN], "movmedian", [1 0]'), [1 2 2]) -%!assert (fillmissing ([NaN 2 NaN], "movmedian", 2), [NaN 2 2]) -%!assert (fillmissing ([NaN 2 NaN], "movmedian", [1 0]), [NaN 2 2]) -%!assert (fillmissing ([NaN 2 NaN], "movmedian", [0 1]), [2 2 NaN]) -%!assert (fillmissing ([NaN 2 NaN], "movmedian", [0 1.1]), [2 2 NaN]) -%!assert (fillmissing ([1 NaN 3 NaN 5], "movmedian", [3 0]), [1 1 3 2 5]) -%!assert (fillmissing ([1 2 NaN; 4 NaN 6], "movmedian", 3, 1), [1 2 6; 4 2 6]) -%!assert (fillmissing ([1 2 NaN; 4 NaN 6], "movmedian", 3, 2), [1 2 2; 4 5 6]) -%!assert (fillmissing ([1 2 NaN; 4 NaN 6], "movmedian", 3, 3), [1 2 NaN; 4 NaN 6]) -%!assert (fillmissing ([1 NaN 3 NaN 5], "movmedian", 99), [1 3 3 3 5]) -%!assert (fillmissing ([1 NaN 3 NaN 5], "movmedian", 99, 1), [1 NaN 3 NaN 5]) -%!assert (fillmissing ([1 NaN 3 NaN 5]', "movmedian", 99, 1), [1 3 3 3 5]') -%!assert (fillmissing ([1 NaN 3 NaN 5], "movmedian", 99, 2), [1 3 3 3 5]) -%!assert (fillmissing ([1 NaN 3 NaN 5]', "movmedian", 99, 2), [1 NaN 3 NaN 5]') - -%!assert (fillmissing ([1 NaN NaN NaN 5], "movmedian", 3, "samplepoints", [1 2 3 4 5]), [1 1 NaN 5 5]) -%!assert (fillmissing ([1 NaN NaN NaN 5], "movmedian", [1 1], "samplepoints", [1 2 3 4 5]), [1 1 NaN 5 5]) -%!assert (fillmissing ([1 NaN NaN NaN 5], "movmedian", [1.5 1.5], "samplepoints", [1 2 3 4 5]), [1 1 NaN 5 5]) -%!assert (fillmissing ([1 NaN NaN NaN 5], "movmedian", 4, "samplepoints", [1 2 3 4 5]), [1 1 1 5 5]) -%!assert (fillmissing ([1 NaN NaN NaN 5], "movmedian", [2 2], "samplepoints", [1 2 3 4 5]), [1 1 3 5 5]) -%!assert (fillmissing ([1 NaN NaN NaN 5], "movmedian", 4.0001, "samplepoints", [1 2 3 4 5]), [1 1 3 5 5]) -%!assert (fillmissing ([1 NaN NaN NaN 5], "movmedian", 3, "samplepoints", [1.5 2 3 4 5]), [1 1 1 5 5]) -%!assert (fillmissing ([1 NaN NaN NaN 5], "movmedian", 3, "samplepoints", [1 2 3 4 4.5]), [1 1 NaN 5 5]) -%!assert (fillmissing ([1 NaN NaN NaN 5], "movmedian", 3, "samplepoints", [1.5 2 3 4 4.5]), [1 1 1 5 5]) -%!assert (fillmissing ([1 NaN NaN NaN 5], "movmedian", [1.5 1.5], "samplepoints", [1.5 2 3 4 5]), [1 1 1 5 5]) -%!assert (fillmissing ([1 NaN NaN NaN 5], "movmedian", [1.5 1.5], "samplepoints", [1 2 3 4 4.5]), [1 1 5 5 5]) -%!assert (fillmissing ([1 NaN NaN NaN 5], "movmedian", [1.5 1.5], "samplepoints", [1.5 2 3 4 4.5]), [1 1 3 5 5]) +## Test movmedian +%!assert (fillmissing ([1, 2, 3], "movmedian", 1), [1, 2, 3]) +%!assert (fillmissing ([1, 2, NaN], "movmedian", 1), [1, 2, NaN]) +%!assert (fillmissing ([1, 2, 3], "movmedian", 2), [1, 2, 3]) +%!assert (fillmissing ([1, 2, 3], "movmedian", [1, 0]), [1, 2, 3]) +%!assert (fillmissing ([1, 2, 3]', "movmedian", 2), [1, 2, 3]') +%!assert (fillmissing ([1, 2, NaN], "movmedian", 2), [1, 2, 2]) +%!assert (fillmissing ([1, 2, NaN], "movmedian", [1, 0]), [1, 2, 2]) +%!assert (fillmissing ([1, 2, NaN], "movmedian", [1, 0]'), [1, 2, 2]) +%!assert (fillmissing ([NaN, 2, NaN], "movmedian", 2), [NaN, 2, 2]) +%!assert (fillmissing ([NaN, 2, NaN], "movmedian", [1, 0]), [NaN, 2, 2]) +%!assert (fillmissing ([NaN, 2, NaN], "movmedian", [0, 1]), [2, 2, NaN]) +%!assert (fillmissing ([NaN, 2, NaN], "movmedian", [0, 1.1]), [2, 2, NaN]) +%!assert (fillmissing ([1, NaN, 3, NaN, 5], "movmedian", [3, 0]), [1, 1, 3, 2, 5]) +%!assert (fillmissing ([1, 2, NaN; 4, NaN, 6], "movmedian", 3, 1), [1, 2, 6; 4, 2, 6]) +%!assert (fillmissing ([1, 2, NaN; 4, NaN, 6], "movmedian", 3, 2), [1, 2, 2; 4, 5, 6]) +%!assert (fillmissing ([1, 2, NaN; 4, NaN, 6], "movmedian", 3, 3), [1, 2, NaN; 4, NaN, 6]) +%!assert (fillmissing ([1, NaN, 3, NaN, 5], "movmedian", 99), [1, 3, 3, 3, 5]) +%!assert (fillmissing ([1, NaN, 3, NaN, 5], "movmedian", 99, 1), [1, NaN, 3, NaN, 5]) +%!assert (fillmissing ([1, NaN, 3, NaN, 5]', "movmedian", 99, 1), [1, 3, 3, 3, 5]') +%!assert (fillmissing ([1, NaN, 3, NaN, 5], "movmedian", 99, 2), [1, 3, 3, 3, 5]) +%!assert (fillmissing ([1, NaN, 3, NaN, 5]', "movmedian", 99, 2), [1, NaN, 3, NaN, 5]') + +%!assert (fillmissing ([1, NaN, NaN, NaN, 5], "movmedian", 3, "samplepoints", [1, 2, 3, 4, 5]), [1, 1, NaN, 5, 5]) +%!assert (fillmissing ([1, NaN, NaN, NaN, 5], "movmedian", [1, 1], "samplepoints", [1, 2, 3, 4, 5]), [1, 1, NaN, 5, 5]) +%!assert (fillmissing ([1, NaN, NaN, NaN, 5], "movmedian", [1.5, 1.5], "samplepoints", [1, 2, 3, 4, 5]), [1, 1, NaN, 5, 5]) +%!assert (fillmissing ([1, NaN, NaN, NaN, 5], "movmedian", 4, "samplepoints", [1, 2, 3, 4, 5]), [1, 1, 1, 5, 5]) +%!assert (fillmissing ([1, NaN, NaN, NaN, 5], "movmedian", [2, 2], "samplepoints", [1, 2, 3, 4, 5]), [1, 1, 3, 5, 5]) +%!assert (fillmissing ([1, NaN, NaN, NaN, 5], "movmedian", 4.0001, "samplepoints", [1, 2, 3, 4, 5]), [1, 1, 3, 5, 5]) +%!assert (fillmissing ([1, NaN, NaN, NaN, 5], "movmedian", 3, "samplepoints", [1.5 2 3 4 5]), [1, 1, 1, 5, 5]) +%!assert (fillmissing ([1, NaN, NaN, NaN, 5], "movmedian", 3, "samplepoints", [1 2 3 4 4.5]), [1, 1, NaN, 5, 5]) +%!assert (fillmissing ([1, NaN, NaN, NaN, 5], "movmedian", 3, "samplepoints", [1.5 2 3 4 4.5]), [1, 1, 1, 5, 5]) +%!assert (fillmissing ([1, NaN, NaN, NaN, 5], "movmedian", [1.5, 1.5], "samplepoints", [1.5 2 3 4 5]), [1, 1, 1, 5, 5]) +%!assert (fillmissing ([1, NaN, NaN, NaN, 5], "movmedian", [1.5, 1.5], "samplepoints", [1 2 3 4 4.5]), [1, 1, 5, 5, 5]) +%!assert (fillmissing ([1, NaN, NaN, NaN, 5], "movmedian", [1.5, 1.5], "samplepoints", [1.5 2 3 4 4.5]), [1, 1, 3, 5, 5]) %!test %! x = reshape ([1:24], 3, 4, 2); -%! x([1,2,5,6,8,10,13,16,18,19,20,21,22]) = NaN; +%! x([1, 2, 5, 6, 8, 10, 13, 16, 18, 19, 20, 21, 22]) = NaN; %! y = x; -%! y([2 5 8 10 13 16 18 22]) = [3 4 8 11 14 17 17 23]; +%! y([2, 5, 8, 10, 13, 16, 18, 22]) = [3, 4, 8, 11, 14, 17, 17, 23]; %! assert (fillmissing (x, "movmedian", 3), y); -%! assert (fillmissing (x, "movmedian", [1 1]), y); +%! assert (fillmissing (x, "movmedian", [1, 1]), y); %! assert (fillmissing (x, "movmedian", 3, "endvalues", "extrap"), y); -%! assert (fillmissing (x, "movmedian", 3, "samplepoints", [1 2 3]), y); +%! assert (fillmissing (x, "movmedian", 3, "samplepoints", [1, 2, 3]), y); %! y = x; -%! y([1 6 8 10 18 20 21]) = [4 6 11 7 15 20 24]; +%! y([1, 6, 8, 10, 18, 20, 21]) = [4, 6, 11, 7, 15, 20, 24]; %! assert (fillmissing (x, "movmedian", 3, 2), y); -%! assert (fillmissing (x, "movmedian", [1 1], 2), y); +%! assert (fillmissing (x, "movmedian", [1, 1], 2), y); %! assert (fillmissing (x, "movmedian", 3, 2, "endvalues", "extrap"), y); -%! assert (fillmissing (x, "movmedian", 3, 2, "samplepoints", [1 2 3 4]), y); -%! y([1,18]) = NaN; y(6) = 9; -%! assert (fillmissing (x, "movmedian", 3, 2, "samplepoints", [0 2 3 4]), y); +%! assert (fillmissing (x, "movmedian", 3, 2, "samplepoints", [1, 2, 3, 4]), y); +%! y([1,18]) = NaN; +%! y(6) = 9; +%! assert (fillmissing (x, "movmedian", 3, 2, "samplepoints", [0, 2, 3, 4]), y); %! y = x; -%! y([1,2,5,6,10,13,16,18,19,20,21,22]) = 99; y(8) = 8; +%! y([1, 2, 5, 6, 10, 13, 16, 18, 19, 20, 21, 22]) = 99; +%! y(8) = 8; %! assert (fillmissing (x, "movmedian", 3, "endvalues", 99), y); %! y = x; -%! y([1,2,5,8,10,13,16,19,22]) = 99; y([6,18,20,21]) = [6,15,20,24]; +%! y([1, 2, 5, 8, 10, 13, 16, 19, 22]) = 99; +%! y([6, 18, 20, 21]) = [6, 15, 20, 24]; %! assert (fillmissing (x, "movmedian", 3, 2, "endvalues", 99), y); -## test movfcn -%!assert (fillmissing ([1 2 3], @(x,y,z) x+y+z, 2), [1 2 3]) -%!assert (fillmissing ([1 2 NaN], @(x,y,z) x+y+z, 1), [1 2 NaN]) -%!assert (fillmissing ([1 2 3], @(x,y,z) x+y+z, 2), [1 2 3]) -%!assert (fillmissing ([1 2 3], @(x,y,z) x+y+z, [1 0]), [1 2 3]) -%!assert (fillmissing ([1 2 3]', @(x,y,z) x+y+z, 2), [1 2 3]') -%!assert (fillmissing ([1 2 NaN], @(x,y,z) x+y+z, 2), [1 2 7]) -%!assert (fillmissing ([1 2 NaN], @(x,y,z) x+y+z, [1 0]), [1 2 7]) -%!assert (fillmissing ([1 2 NaN], @(x,y,z) x+y+z, [1 0]'), [1 2 7]) -%!assert (fillmissing ([NaN 2 NaN], @(x,y,z) x+y+z, 2), [5 2 7]) -%!assert (fillmissing ([NaN 2 NaN], @(x,y,z) x+y+z, [1 0]), [NaN 2 7]) -%!assert (fillmissing ([NaN 2 NaN], @(x,y,z) x+y+z, [0 1]), [5 2 NaN]) -%!assert (fillmissing ([NaN 2 NaN], @(x,y,z) x+y+z, [0 1.1]), [5 2 NaN]) -%!assert (fillmissing ([1 2 NaN NaN 3 4], @(x,y,z) x+y+z, 2),[1 2 7 12 3 4]) -%!assert (fillmissing ([1 2 NaN NaN 3 4], @(x,y,z) x+y+z, 0.5),[1 2 NaN NaN 3 4]) - -%!function A = testfcn (x,y,z) -%! if isempty (y) +## Test movfcn +%!assert (fillmissing ([1, 2, 3], @(x,y,z) x+y+z, 2), [1, 2, 3]) +%!assert (fillmissing ([1, 2, NaN], @(x,y,z) x+y+z, 1), [1, 2, NaN]) +%!assert (fillmissing ([1, 2, 3], @(x,y,z) x+y+z, 2), [1, 2, 3]) +%!assert (fillmissing ([1, 2, 3], @(x,y,z) x+y+z, [1, 0]), [1, 2, 3]) +%!assert (fillmissing ([1, 2, 3]', @(x,y,z) x+y+z, 2), [1, 2, 3]') +%!assert (fillmissing ([1, 2, NaN], @(x,y,z) x+y+z, 2), [1, 2, 7]) +%!assert (fillmissing ([1, 2, NaN], @(x,y,z) x+y+z, [1, 0]), [1, 2, 7]) +%!assert (fillmissing ([1, 2, NaN], @(x,y,z) x+y+z, [1, 0]'), [1, 2, 7]) +%!assert (fillmissing ([NaN, 2, NaN], @(x,y,z) x+y+z, 2), [5, 2, 7]) +%!assert (fillmissing ([NaN, 2, NaN], @(x,y,z) x+y+z, [1, 0]), [NaN, 2, 7]) +%!assert (fillmissing ([NaN, 2, NaN], @(x,y,z) x+y+z, [0, 1]), [5, 2, NaN]) +%!assert (fillmissing ([NaN, 2, NaN], @(x,y,z) x+y+z, [0, 1.1]), [5, 2, NaN]) +%!assert (fillmissing ([1, 2, NaN, NaN, 3, 4], @(x,y,z) x+y+z, 2), [1, 2, 7, 12, 3, 4]) +%!assert (fillmissing ([1, 2, NaN, NaN, 3, 4], @(x,y,z) x+y+z, 0.5), [1, 2, NaN, NaN, 3, 4]) + +%!function A = testfcn (x, y, z) +%! if (isempty (y)) %! A = z; %! elseif (numel (y) == 1) %! A = repelem (x(1), numel(z)); %! else -%! A = interp1 (y, x, z, "linear","extrap"); +%! A = interp1 (y, x, z, "linear", "extrap"); %! endif %!endfunction -%!assert (fillmissing ([1 NaN 3 NaN 5], @testfcn, [3 0]), [1 1 3 NaN 5]) -%!assert (fillmissing ([1 2 NaN; 4 NaN 6], @testfcn, 3, 1), [1 2 6; 4 2 6]) -%!assert (fillmissing ([1 2 NaN; 4 NaN 6], @testfcn, 3, 2), [1 2 2; 4 5 6]) -%!assert (fillmissing ([1 2 NaN; 4 NaN 6], @testfcn, 3, 3), [1 2 NaN; 4 NaN 6]) -%!assert (fillmissing ([1 NaN 3 NaN 5], @testfcn, 99), [1 2 3 4 5]) -%!assert (fillmissing ([1 NaN 3 NaN 5], @testfcn, 99, 1), [1 NaN 3 NaN 5]) ##known not-compatible. matlab bug ML2022a: [1 1 3 1 5] -%!assert (fillmissing ([1 NaN 3 NaN 5]', @testfcn, 99, 1), [1 2 3 4 5]') -%!assert (fillmissing ([1 NaN 3 NaN 5], @testfcn, 99, 2), [1 2 3 4 5]) -%!assert (fillmissing ([1 NaN 3 NaN 5]', @testfcn, 99, 2), [1 NaN 3 NaN 5]') ##known not-compatible. matlab bug ML2022a: [1 1 3 1 5]' -%!assert (fillmissing ([1 NaN 3 NaN 5], @testfcn, 99, 3), [1 NaN 3 NaN 5]) -%!assert (fillmissing ([1 NaN 3 NaN 5]', @testfcn, 99, 3), [1 NaN 3 NaN 5]') -%!assert (fillmissing ([1 NaN NaN NaN 5], @testfcn, 3, "samplepoints", [1 2 3 4 5]), [1 2 3 4 5]) -%!assert (fillmissing ([1 NaN NaN NaN 5], @testfcn, [1 1], "samplepoints", [1 2 3 4 5]), [1 2 3 4 5]) -%!assert (fillmissing ([1 NaN NaN NaN 5], @testfcn, [1.5 1.5], "samplepoints", [1 2 3 4 5]), [1 2 3 4 5]) -%!assert (fillmissing ([1 NaN NaN NaN 5], @testfcn, 4, "samplepoints", [1 2 3 4 5]), [1 2 3 4 5]) -%!assert (fillmissing ([1 NaN NaN NaN 5], @testfcn, [2 2], "samplepoints", [1 2 3 4 5]), [1 2 3 4 5]) -%!assert (fillmissing ([1 NaN NaN NaN 5], @testfcn, 3, "samplepoints", [1 2 2.5 3 3.5]), [1 2.6 3.4 4.2 5], 10*eps) -%!assert (fillmissing ([NaN NaN 3 NaN 5], @testfcn, 99, 1), [NaN NaN 3 NaN 5]) ##known not-compatible. matlab bug ML2022a: [1 1 3 1 5] - -## known noncompatible. for move_fcn method, ML2021b (1) ignores windowsize +%!assert (fillmissing ([1, NaN, 3, NaN, 5], @testfcn, [3, 0]), [1, 1, 3, NaN, 5]) +%!assert (fillmissing ([1, 2, NaN; 4, NaN, 6], @testfcn, 3, 1), [1, 2, 6; 4, 2, 6]) +%!assert (fillmissing ([1, 2, NaN; 4, NaN, 6], @testfcn, 3, 2), [1, 2, 2; 4, 5, 6]) +%!assert (fillmissing ([1, 2, NaN; 4, NaN, 6], @testfcn, 3, 3), [1, 2, NaN; 4, NaN, 6]) +%!assert (fillmissing ([1, NaN, 3, NaN, 5], @testfcn, 99), [1, 2, 3, 4, 5]) +%!assert (fillmissing ([1, NaN, 3, NaN, 5], @testfcn, 99, 1), [1, NaN, 3, NaN, 5]) ##known not-compatible. matlab bug ML2022a: [1, 1, 3, 1, 5] +%!assert (fillmissing ([1, NaN, 3, NaN, 5]', @testfcn, 99, 1), [1, 2, 3, 4, 5]') +%!assert (fillmissing ([1, NaN, 3, NaN, 5], @testfcn, 99, 2), [1, 2, 3, 4, 5]) +%!assert (fillmissing ([1, NaN, 3, NaN, 5]', @testfcn, 99, 2), [1, NaN, 3, NaN, 5]') ##known not-compatible. matlab bug ML2022a: [1, 1, 3, 1, 5]' +%!assert (fillmissing ([1, NaN, 3, NaN, 5], @testfcn, 99, 3), [1, NaN, 3, NaN, 5]) +%!assert (fillmissing ([1, NaN, 3, NaN, 5]', @testfcn, 99, 3), [1, NaN, 3, NaN, 5]') +%!assert (fillmissing ([1, NaN, NaN, NaN, 5], @testfcn, 3, "samplepoints", [1, 2, 3, 4, 5]), [1, 2, 3, 4, 5]) +%!assert (fillmissing ([1, NaN, NaN, NaN, 5], @testfcn, [1, 1], "samplepoints", [1, 2, 3, 4, 5]), [1, 2, 3, 4, 5]) +%!assert (fillmissing ([1, NaN, NaN, NaN, 5], @testfcn, [1.5, 1.5], "samplepoints", [1, 2, 3, 4, 5]), [1, 2, 3, 4, 5]) +%!assert (fillmissing ([1, NaN, NaN, NaN, 5], @testfcn, 4, "samplepoints", [1, 2, 3, 4, 5]), [1, 2, 3, 4, 5]) +%!assert (fillmissing ([1, NaN, NaN, NaN, 5], @testfcn, [2, 2], "samplepoints", [1, 2, 3, 4, 5]), [1, 2, 3, 4, 5]) +%!assert (fillmissing ([1, NaN, NaN, NaN, 5], @testfcn, 3, "samplepoints", [1, 2, 2.5, 3, 3.5]), [1, 2.6, 3.4, 4.2, 5], 10*eps) +%!assert (fillmissing ([NaN, NaN, 3, NaN, 5], @testfcn, 99, 1), [NaN, NaN, 3, NaN, 5]) ##known not-compatible. matlab bug ML2022a: [1, 1, 3, 1, 5] + +## Known noncompatible. For move_fcn method, ML2021b (1) ignores windowsize ## for full missing column and processes it anyway, (2) doesn't consider it ## part of endvalues unlike all other methods, (3) ignores samplepoint values -## when calcuating move_fcn results. should review against future versions. +## when calcuating move_fcn results. should review against future versions. %!test -%!function A = testfcn (x,y,z) -%! if isempty (y) +%!function A = testfcn (x, y, z) +%! if (isempty (y)) %! A = z; %! elseif (numel (y) == 1) %! A = repelem (x(1), numel(z)); %! else -%! A = interp1 (y, x, z, "linear","extrap"); +%! A = interp1 (y, x, z, "linear", "extrap"); %! endif %!endfunction %! x = reshape ([1:24], 3, 4, 2); -%! x([1,2,5,6,8,10,13,16,18,19,20,21,22]) = NaN; +%! x([1, 2, 5, 6, 8, 10, 13, 16, 18, 19, 20, 21, 22]) = NaN; %! y = x; -%! y([1,2,5,6,8,10,13,16,18,22]) = [3,3,4,4,8,11,14,17,17,23]; +%! y([1, 2, 5, 6, 8, 10, 13, 16, 18, 22]) = [3, 3, 4, 4, 8, 11, 14, 17, 17, 23]; %! assert (fillmissing (x, @testfcn, 3), y); -%! assert (fillmissing (x, @testfcn, [1 1]), y); +%! assert (fillmissing (x, @testfcn, [1, 1]), y); %! assert (fillmissing (x, @testfcn, 3, "endvalues", "extrap"), y); -%! assert (fillmissing (x, @testfcn, 3, "samplepoints", [1 2 3]), y); +%! assert (fillmissing (x, @testfcn, 3, "samplepoints", [1, 2, 3]), y); %! y= x; -%! y(isnan(x)) = 99; y(8) = 8; +%! y(isnan (x)) = 99; +%! y(8) = 8; %! assert (fillmissing (x, @testfcn, 3, "endvalues", 99), y) %! y = x; -%! y([1,2,5,6,8,10,18,20,21]) = [4,11,11,6,11,7,18,20,21]; +%! y([1, 2, 5, 6, 8, 10, 18, 20, 21]) = [4, 11, 11, 6, 11, 7, 18, 20, 21]; %! assert (fillmissing (x, @testfcn, 3, 2), y); -%! assert (fillmissing (x, @testfcn, [1 1], 2), y); +%! assert (fillmissing (x, @testfcn, [1, 1], 2), y); %! assert (fillmissing (x, @testfcn, 3, 2, "endvalues", "extrap"), y); -%! assert (fillmissing (x, @testfcn, 3, 2, "samplepoints", [1 2 3 4]), y); -%! y(1) = NaN; y([6,18,21]) = [9,24,24]; -%! assert (fillmissing (x, @testfcn, 3, 2, "samplepoints", [0 2 3 4]), y); +%! assert (fillmissing (x, @testfcn, 3, 2, "samplepoints", [1, 2, 3, 4]), y); +%! y(1) = NaN; +%! y([6, 18, 21]) = [9, 24, 24]; +%! assert (fillmissing (x, @testfcn, 3, 2, "samplepoints", [0, 2, 3, 4]), y); %! y = x; -%! y([1,2,5,6,10,13,16,18,19,20,21,22]) = 99; y(8) = [8]; +%! y([1, 2, 5, 6, 10, 13, 16, 18, 19, 20, 21, 22]) = 99; +%! y(8) = 8; %! assert (fillmissing (x, @testfcn, 3, "endvalues", 99), y); -%! y([6,18,20,21]) = [6,18,20,21]; y(8)=99; +%! y([6, 18, 20, 21]) = [6, 18, 20, 21]; +%! y(8) = 99; %! assert (fillmissing (x, @testfcn, 3, 2, "endvalues", 99), y); -%! y([6,18,20,21]) = 99; +%! y([6, 18, 20, 21]) = 99; %! assert (fillmissing (x, @testfcn, 3, 3, "endvalues", 99), y); -##test maxgap for mid and end points -%!assert (fillmissing ([1 2 3], "constant", 0, "maxgap", 1), [1 2 3]) -%!assert (fillmissing ([1 2 3], "constant", 0, "maxgap", 99), [1 2 3]) -%!assert (fillmissing ([1 NaN 3], "constant", 0, "maxgap", 1), [1 NaN 3]) -%!assert (fillmissing ([1 NaN 3], "constant", 0, "maxgap", 1.999), [1 NaN 3]) -%!assert (fillmissing ([1 NaN 3], "constant", 0, "maxgap", 2), [1 0 3]) -%!assert (fillmissing ([1 NaN NaN 4], "constant", 0, "maxgap", 2), [1 NaN NaN 4]) -%!assert (fillmissing ([1 NaN NaN 4], "constant", 0, "maxgap", 3), [1 0 0 4]) -%!assert (fillmissing ([1 NaN 3 NaN 5], "constant", 0, "maxgap", 2), [1 0 3 0 5]) -%!assert (fillmissing ([NaN 2 NaN], "constant", 0, "maxgap", 0.999), [NaN 2 NaN]) -%!assert (fillmissing ([NaN 2 NaN], "constant", 0, "maxgap", 1), [0 2 0]) -%!assert (fillmissing ([NaN 2 NaN NaN], "constant", 0, "maxgap", 1), [0 2 NaN NaN]) -%!assert (fillmissing ([NaN 2 NaN NaN], "constant", 0, "maxgap", 2), [0 2 0 0]) -%!assert (fillmissing ([NaN NaN NaN], "constant", 0, "maxgap", 1), [NaN NaN NaN]) -%!assert (fillmissing ([NaN NaN NaN], "constant", 0, "maxgap", 3), [NaN NaN NaN]) -%!assert (fillmissing ([NaN NaN NaN], "constant", 0, "maxgap", 999), [NaN NaN NaN]) -%!assert (fillmissing ([1 NaN 3 NaN 5], "constant", 0, "maxgap", 2, "samplepoints", [0 1 2 3 5]), [1 0 3 NaN 5]) -%!assert (fillmissing ([1 NaN 3 NaN 5]', "constant", 0, "maxgap", 2, "samplepoints", [0 1 2 3 5]), [1 0 3 NaN 5]') -%!assert (fillmissing ([1 NaN 3 NaN 5], "constant", 0, "maxgap", 2, "samplepoints", [0 2 3 4 5]), [1 NaN 3 0 5]) -%!assert (fillmissing ([1 NaN 3 NaN 5; 1 NaN 3 NaN 5], "constant", 0, 2, "maxgap", 2, "samplepoints", [0 2 3 4 5]), [1 NaN 3 0 5; 1 NaN 3 0 5]) +## Test maxgap for mid and end points +%!assert (fillmissing ([1, 2, 3], "constant", 0, "maxgap", 1), [1, 2, 3]) +%!assert (fillmissing ([1, 2, 3], "constant", 0, "maxgap", 99), [1, 2, 3]) +%!assert (fillmissing ([1, NaN, 3], "constant", 0, "maxgap", 1), [1, NaN, 3]) +%!assert (fillmissing ([1, NaN, 3], "constant", 0, "maxgap", 1.999), [1, NaN, 3]) +%!assert (fillmissing ([1, NaN, 3], "constant", 0, "maxgap", 2), [1, 0, 3]) +%!assert (fillmissing ([1, NaN, NaN, 4], "constant", 0, "maxgap", 2), [1, NaN, NaN, 4]) +%!assert (fillmissing ([1, NaN, NaN, 4], "constant", 0, "maxgap", 3), [1, 0, 0, 4]) +%!assert (fillmissing ([1, NaN, 3, NaN, 5], "constant", 0, "maxgap", 2), [1, 0, 3, 0, 5]) +%!assert (fillmissing ([NaN, 2, NaN], "constant", 0, "maxgap", 0.999), [NaN, 2, NaN]) +%!assert (fillmissing ([NaN, 2, NaN], "constant", 0, "maxgap", 1), [0, 2, 0]) +%!assert (fillmissing ([NaN, 2, NaN, NaN], "constant", 0, "maxgap", 1), [0, 2, NaN, NaN]) +%!assert (fillmissing ([NaN, 2, NaN, NaN], "constant", 0, "maxgap", 2), [0, 2, 0, 0]) +%!assert (fillmissing ([NaN, NaN, NaN], "constant", 0, "maxgap", 1), [NaN, NaN, NaN]) +%!assert (fillmissing ([NaN, NaN, NaN], "constant", 0, "maxgap", 3), [NaN, NaN, NaN]) +%!assert (fillmissing ([NaN, NaN, NaN], "constant", 0, "maxgap", 999), [NaN, NaN, NaN]) +%!assert (fillmissing ([1, NaN, 3, NaN, 5], "constant", 0, "maxgap", 2, "samplepoints", [0, 1, 2, 3, 5]), [1, 0, 3, NaN, 5]) +%!assert (fillmissing ([1, NaN, 3, NaN, 5]', "constant", 0, "maxgap", 2, "samplepoints", [0, 1, 2, 3, 5]), [1, 0, 3, NaN, 5]') +%!assert (fillmissing ([1, NaN, 3, NaN, 5], "constant", 0, "maxgap", 2, "samplepoints", [0, 2, 3, 4, 5]), [1, NaN, 3, 0, 5]) +%!assert (fillmissing ([1, NaN, 3, NaN, 5; 1, NaN, 3, NaN, 5], "constant", 0, 2, "maxgap", 2, "samplepoints", [0, 2, 3, 4, 5]), [1, NaN, 3, 0, 5; 1, NaN, 3, 0, 5]) %!test %! x = cat (3, [1, 2, NaN; 4, NaN, NaN], [NaN, 2, 3; 4, 5, NaN]); %! assert (fillmissing (x, "constant", 0, "maxgap", 0.1), x); %! y = x; -%! y([4,7,12]) = 0; +%! y([4, 7, 12]) = 0; %! assert (fillmissing (x, "constant", 0, "maxgap", 1), y); %! assert (fillmissing (x, "constant", 0, 1, "maxgap", 1), y); %! y = x; -%! y([5,7,12]) = 0; +%! y([5, 7, 12]) = 0; %! assert (fillmissing (x, "constant", 0, 2, "maxgap", 1), y); %! y = x; -%! y([4,5,7]) = 0; +%! y([4, 5, 7]) = 0; %! assert (fillmissing (x, "constant", 0, 3, "maxgap", 1), y); ## 2nd output @@ -2027,223 +2053,225 @@ endfunction %!test %! x = cat (3, [1, 2, NaN; 4, NaN, NaN], [NaN, 2, 3; 4, 5, NaN]); %! [~, idx] = fillmissing (x, "constant", 0, "maxgap", 1); -%! assert (idx, logical (cat (3, [0 0 0; 0 1 0], [1 0 0; 0 0 1]))); +%! assert (idx, logical (cat (3, [0, 0, 0; 0, 1, 0], [1, 0, 0; 0, 0, 1]))); %! [~, idx] = fillmissing (x, "constant", 0, 1, "maxgap", 1); -%! assert (idx, logical (cat (3, [0 0 0; 0 1 0], [1 0 0; 0 0 1]))); +%! assert (idx, logical (cat (3, [0, 0, 0; 0, 1, 0], [1, 0, 0; 0, 0, 1]))); %! [~, idx] = fillmissing (x, "constant", 0, 2, "maxgap", 1); -%! assert (idx, logical (cat (3, [0 0 1; 0 0 0], [1 0 0; 0 0 1]))); +%! assert (idx, logical (cat (3, [0, 0, 1; 0, 0, 0], [1, 0, 0; 0, 0, 1]))); %! [~, idx] = fillmissing (x, "constant", 0, 3, "maxgap", 1); -%! assert (idx, logical (cat (3, [0 0 1; 0 1 0], [1 0 0; 0 0 0]))); +%! assert (idx, logical (cat (3, [0, 0, 1; 0, 1, 0], [1, 0, 0; 0, 0, 0]))); -## verify idx matches when methods leave gaps unfilled, or when fill looks -## the same +## Verify idx matches when methods leave gaps unfilled, or when fill looks +## the same. %!test %! x = [NaN, 2, 3]; -%! [~,idx] = fillmissing (x, "previous"); -%! assert (idx, logical ([0 0 0])); -%! [~,idx] = fillmissing (x, "movmean", 1); -%! assert (idx, logical ([0 0 0])); -%! x = [1:3;4:6;7:9]; -%! x([2,4,7,9]) = NaN; -%! [~,idx] = fillmissing (x, "linear"); -%! assert (idx, logical ([0 1 0;1 0 0;0 0 0])); -%! [~,idx] = fillmissing (x, "movmean", 2); -%! assert (idx, logical ([0 0 0;1 0 0;0 0 1])); -%! [A, idx] = fillmissing ([1 2 3 NaN NaN], 'movmean',2); -%! assert (A, [1 2 3 3 NaN]); -%! assert (idx, logical([0 0 0 1 0])); -%! [A, idx] = fillmissing ([1 2 3 NaN NaN], 'movmean',3); -%! assert (A, [1 2 3 3 NaN]); -%! assert (idx, logical([0 0 0 1 0])); -%! [A, idx] = fillmissing ([1 2 NaN NaN NaN], 'movmedian', 2); -%! assert (A, [1 2 2 NaN NaN]); -%! assert (idx, logical([0 0 1 0 0])); -%! [A, idx] = fillmissing ([1 2 3 NaN NaN], 'movmedian', 3); -%! assert (A, [1 2 3 3 NaN]); -%! assert (idx, logical([0 0 0 1 0])); -%! [A, idx] = fillmissing ([1 NaN 1 NaN 1], @(x,y,z) z, 3); -%! assert (A, [1 2 1 4 1]); -%! assert (idx, logical([0 1 0 1 0])); -%! [A, idx] = fillmissing ([1 NaN 1 NaN 1], @(x,y,z) NaN (size (z)), 3); -%! assert (A, [1 NaN 1 NaN 1]); -%! assert (idx, logical([0 0 0 0 0])); - -#test missinglocations -%!assert (fillmissing ([1 2 3], "constant", 99, "missinglocations", logical([0 0 0])), [1 2 3]) -%!assert (fillmissing ([1 2 3], "constant", 99, "missinglocations", logical([1 1 1])), [99 99 99]) -%!assert (fillmissing ([1 NaN 2 3 NaN], "constant", 99, "missinglocations", logical([1 0 1 0 1])), [99 NaN 99 3 99]) -%!assert (fillmissing ([1 NaN 3 NaN 5], "constant", NaN, "missinglocations", logical([0 1 1 1 0])), [1 NaN NaN NaN 5]) -%!assert (fillmissing (["foo ";" bar"], "constant", 'X', "missinglocations", logical([0 0 0 0; 0 0 0 0])), ["foo ";" bar"]) -%!assert (fillmissing (["foo ";" bar"], "constant", 'X', "missinglocations", logical([1 0 1 0; 0 1 1 0])), ["XoX ";" XXr"]) -%!assert (fillmissing ({"foo","", "bar"}, "constant", 'X', "missinglocations", logical([0 0 0])), {"foo","", "bar"}) -%!assert (fillmissing ({"foo","", "bar"}, "constant", 'X', "missinglocations", logical([1 1 0])), {"X","X","bar"}) +%! [~, idx] = fillmissing (x, "previous"); +%! assert (idx, logical ([0, 0, 0])); +%! [~, idx] = fillmissing (x, "movmean", 1); +%! assert (idx, logical ([0, 0, 0])); +%! x = [1:3; 4:6; 7:9]; +%! x([2, 4, 7, 9]) = NaN; +%! [~, idx] = fillmissing (x, "linear"); +%! assert (idx, logical ([0, 1, 0; 1, 0, 0; 0, 0, 0])); +%! [~, idx] = fillmissing (x, "movmean", 2); +%! assert (idx, logical ([0, 0, 0; 1, 0, 0; 0, 0, 1])); +%! [A, idx] = fillmissing ([1, 2, 3, NaN, NaN], "movmean",2); +%! assert (A, [1, 2, 3, 3, NaN]); +%! assert (idx, logical ([0, 0, 0, 1, 0])); +%! [A, idx] = fillmissing ([1, 2, 3, NaN, NaN], "movmean",3); +%! assert (A, [1, 2, 3, 3, NaN]); +%! assert (idx, logical ([0, 0, 0, 1, 0])); +%! [A, idx] = fillmissing ([1, 2, NaN, NaN, NaN], "movmedian", 2); +%! assert (A, [1, 2, 2, NaN, NaN]); +%! assert (idx, logical ([0, 0, 1, 0, 0])); +%! [A, idx] = fillmissing ([1, 2, 3, NaN, NaN], "movmedian", 3); +%! assert (A, [1, 2, 3, 3, NaN]); +%! assert (idx, logical ([0, 0, 0, 1, 0])); +%! [A, idx] = fillmissing ([1, NaN, 1, NaN, 1], @(x,y,z) z, 3); +%! assert (A, [1, 2, 1, 4, 1]); +%! assert (idx, logical ([0, 1, 0, 1, 0])); +%! [A, idx] = fillmissing ([1, NaN, 1, NaN, 1], @(x,y,z) NaN (size (z)), 3); +%! assert (A, [1, NaN, 1, NaN, 1]); +%! assert (idx, logical ([0, 0, 0, 0, 0])); + +## Test missinglocations +%!assert (fillmissing ([1, 2, 3], "constant", 99, "missinglocations", logical ([0, 0, 0])), [1, 2, 3]) +%!assert (fillmissing ([1, 2, 3], "constant", 99, "missinglocations", logical ([1, 1, 1])), [99, 99, 99]) +%!assert (fillmissing ([1, NaN, 2, 3, NaN], "constant", 99, "missinglocations", logical ([1, 0, 1, 0, 1])), [99, NaN, 99, 3, 99]) +%!assert (fillmissing ([1, NaN, 3, NaN, 5], "constant", NaN, "missinglocations", logical ([0, 1, 1, 1, 0])), [1, NaN, NaN, NaN, 5]) +%!assert (fillmissing (["foo "; " bar"], "constant", "X", "missinglocations", logical ([0, 0, 0, 0; 0, 0, 0, 0])), ["foo "; " bar"]) +%!assert (fillmissing (["foo "; " bar"], "constant", "X", "missinglocations", logical ([1, 0, 1, 0; 0, 1, 1, 0])), ["XoX "; " XXr"]) +%!assert (fillmissing ({"foo", "", "bar"}, "constant", "X", "missinglocations", logical ([0, 0, 0])), {"foo", "", "bar"}) +%!assert (fillmissing ({"foo", "", "bar"}, "constant", "X", "missinglocations", logical ([1, 1, 0])), {"X", "X", "bar"}) +%!test +%! [~, idx] = fillmissing ([1, NaN, 3, NaN, 5], "constant", NaN); +%! assert (idx, logical ([0, 0, 0, 0, 0])); +%! [~, idx] = fillmissing ([1 NaN 3 NaN 5], "constant", NaN, "missinglocations", logical ([0, 1, 1, 1, 0])); +%! assert (idx, logical ([0, 1, 1, 1, 0])); +%! [A, idx] = fillmissing ([1, 2, NaN, 1, NaN], "movmean", 3.1, "missinglocations", logical ([0, 0, 1, 1, 0])); +%! assert (A, [1, 2, 2, NaN, NaN]); +%! assert (idx, logical ([0, 0, 1, 0, 0])); +%! [A, idx] = fillmissing ([1, 2, NaN, NaN, NaN], "movmean", 2, "missinglocations", logical ([0, 0, 1, 1, 0])); +%! assert (A, [1, 2, 2, NaN, NaN]); +%! assert (idx, logical ([0, 0, 1, 0, 0])); +%! [A, idx] = fillmissing ([1, 2, NaN, 1, NaN], "movmean", 3, "missinglocations", logical ([0, 0, 1, 1, 0])); +%! assert (A, [1, 2, 2, NaN, NaN]); +%! assert (idx, logical ([0, 0, 1, 0, 0])); +%! [A, idx] = fillmissing ([1, 2, NaN, NaN, NaN], "movmean", 3, "missinglocations", logical ([0, 0, 1, 1, 0])); +%! assert (A, [1, 2, 2, NaN, NaN]); +%! assert (idx, logical ([0, 0, 1, 0, 0])); +%! [A, idx] = fillmissing ([1, 2, NaN, NaN, NaN], "movmedian", 2, "missinglocations", logical ([0, 0, 1, 1, 0])); +%! assert (A, [1, 2, 2, NaN, NaN]); +%! assert (idx, logical ([0, 0, 1, 0, 0])); +%! [A, idx] = fillmissing ([1, 2, NaN, NaN, NaN], "movmedian", 3, "missinglocations", logical ([0, 0, 1, 1, 0])); +%! assert (A, [1, 2, 2, NaN, NaN]); +%! assert (idx, logical ([0, 0, 1, 0, 0])); +%! [A, idx] = fillmissing ([1, 2, NaN, NaN, NaN], "movmedian", 3.1, "missinglocations", logical ([0, 0, 1, 1, 0])); +%! assert (A, [1, 2, 2, NaN, NaN]); +%! assert (idx, logical ([0, 0, 1, 0, 0])); +%! [A, idx] = fillmissing ([1, NaN, 1, NaN, 1], @(x,y,z) ones (size (z)), 3, "missinglocations", logical ([0, 1, 0, 1, 1])); +%! assert (A, [1, 1, 1, 1, 1]); +%! assert (idx, logical ([0, 1, 0, 1, 1])); +%! [A, idx] = fillmissing ([1, NaN, 1, NaN, 1], @(x,y,z) NaN (size (z)), 3, "missinglocations", logical ([0, 1, 0, 1, 1])); +%! assert (A, [1, NaN, 1, NaN, NaN]); +%! assert (idx, logical ([0, 0, 0, 0, 0])); %!test -%! [~,idx] = fillmissing ([1 NaN 3 NaN 5], "constant", NaN); -%! assert (idx, logical([0 0 0 0 0])); -%! [~,idx] = fillmissing ([1 NaN 3 NaN 5], "constant", NaN, "missinglocations", logical([0 1 1 1 0])); -%! assert (idx, logical([0 1 1 1 0])); -%! [A, idx] = fillmissing ([1 2 NaN 1 NaN], 'movmean', 3.1, 'missinglocations', logical([0 0 1 1 0])); -%! assert (A, [1 2 2 NaN NaN]); -%! assert (idx, logical([0 0 1 0 0])); -%! [A, idx] = fillmissing ([1 2 NaN NaN NaN], 'movmean', 2, 'missinglocations', logical([0 0 1 1 0])); -%! assert (A, [1 2 2 NaN NaN]); -%! assert (idx, logical([0 0 1 0 0])); -%! [A, idx] = fillmissing ([1 2 NaN 1 NaN], 'movmean', 3, 'missinglocations', logical([0 0 1 1 0])); -%! assert (A, [1 2 2 NaN NaN]); -%! assert (idx, logical([0 0 1 0 0])); -%! [A, idx] = fillmissing ([1 2 NaN NaN NaN], 'movmean', 3, 'missinglocations', logical([0 0 1 1 0])); -%! assert (A, [1 2 2 NaN NaN]); -%! assert (idx, logical([0 0 1 0 0])); -%! [A, idx] = fillmissing ([1 2 NaN NaN NaN], 'movmedian', 2, 'missinglocations', logical([0 0 1 1 0])); -%! assert (A, [1 2 2 NaN NaN]); -%! assert (idx, logical([0 0 1 0 0])); -%! [A, idx] = fillmissing ([1 2 NaN NaN NaN], 'movmedian', 3, 'missinglocations', logical([0 0 1 1 0])); -%! assert (A, [1 2 2 NaN NaN]); -%! assert (idx, logical([0 0 1 0 0])); -%! [A, idx] = fillmissing ([1 2 NaN NaN NaN], 'movmedian', 3.1, 'missinglocations', logical([0 0 1 1 0])); -%! assert (A, [1 2 2 NaN NaN]); -%! assert (idx, logical([0 0 1 0 0])); -%! [A, idx] = fillmissing ([1 NaN 1 NaN 1], @(x,y,z) ones (size (z)), 3, "missinglocations", logical([0 1 0 1 1])); -%! assert (A, [1 1 1 1 1]); -%! assert (idx, logical([0 1 0 1 1])); -%! [A, idx] = fillmissing ([1 NaN 1 NaN 1], @(x,y,z) NaN (size (z)), 3, "missinglocations", logical([0 1 0 1 1])); -%! assert (A, [1 NaN 1 NaN NaN]); -%! assert (idx, logical([0 0 0 0 0])); - - -##Test char and cellstr -%!assert (fillmissing (' foo bar ', "constant", 'X'), 'XfooXbarX') -%!assert (fillmissing ([' foo';'bar '], "constant", 'X'), ['Xfoo';'barX']) -%!assert (fillmissing ([' foo';'bar '], "next"), ['bfoo';'bar ']) -%!assert (fillmissing ([' foo';'bar '], "next", 1), ['bfoo';'bar ']) -%!assert (fillmissing ([' foo';'bar '], "previous"), [' foo';'baro']) -%!assert (fillmissing ([' foo';'bar '], "previous", 1), [' foo';'baro']) -%!assert (fillmissing ([' foo';'bar '], "nearest"), ['bfoo';'baro']) -%!assert (fillmissing ([' foo';'bar '], "nearest", 1), ['bfoo';'baro']) -%!assert (fillmissing ([' foo';'bar '], "next", 2), ['ffoo';'bar ']) -%!assert (fillmissing ([' foo';'bar '], "previous", 2), [' foo';'barr']) -%!assert (fillmissing ([' foo';'bar '], "nearest", 2), ['ffoo';'barr']) -%!assert (fillmissing ([' foo';'bar '], "next", 3), [' foo';'bar ']) -%!assert (fillmissing ([' foo';'bar '], "previous", 3), [' foo';'bar ']) -%!assert (fillmissing ([' foo';'bar '], "nearest", 3), [' foo';'bar ']) -%!assert (fillmissing ({'foo','bar'}, "constant", 'a'), {'foo','bar'}) -%!assert (fillmissing ({'foo','bar'}, "constant", {'a'}), {'foo','bar'}) -%!assert (fillmissing ({'foo', '', 'bar'}, "constant", 'a'), {'foo', 'a', 'bar'}) -%!assert (fillmissing ({'foo', '', 'bar'}, "constant", {'a'}), {'foo', 'a', 'bar'}) -%!assert (fillmissing ({'foo', '', 'bar'}, "previous"), {'foo', 'foo', 'bar'}) -%!assert (fillmissing ({'foo', '', 'bar'}, "next"), {'foo', 'bar', 'bar'}) -%!assert (fillmissing ({'foo', '', 'bar'}, "nearest"), {'foo', 'bar', 'bar'}) -%!assert (fillmissing ({'foo', '', 'bar'}, "previous", 2), {'foo', 'foo', 'bar'}) -%!assert (fillmissing ({'foo', '', 'bar'}, "next", 2), {'foo', 'bar', 'bar'}) -%!assert (fillmissing ({'foo', '', 'bar'}, "nearest", 2), {'foo', 'bar', 'bar'}) -%!assert (fillmissing ({'foo', '', 'bar'}, "previous", 1), {'foo', '', 'bar'}) -%!assert (fillmissing ({'foo', '', 'bar'}, "previous", 1), {'foo', '', 'bar'}) -%!assert (fillmissing ({'foo', '', 'bar'}, "next", 1), {'foo', '', 'bar'}) -%!assert (fillmissing ({'foo', '', 'bar'}, "nearest", 1), {'foo', '', 'bar'}) +%! [A, idx] = fillmissing ([1, 2, 5], "movmedian", 3, "missinglocations", logical ([0, 1, 0])); +%! assert (A, [1, 3, 5]); +%! assert (idx, logical ([0, 1, 0])); + +## Test char and cellstr +%!assert (fillmissing (" foo bar ", "constant", "X"), "XfooXbarX") +%!assert (fillmissing ([" foo"; "bar "], "constant", "X"), ["Xfoo"; "barX"]) +%!assert (fillmissing ([" foo"; "bar "], "next"), ["bfoo"; "bar "]) +%!assert (fillmissing ([" foo"; "bar "], "next", 1), ["bfoo"; "bar "]) +%!assert (fillmissing ([" foo"; "bar "], "previous"), [" foo"; "baro"]) +%!assert (fillmissing ([" foo"; "bar "], "previous", 1), [" foo"; "baro"]) +%!assert (fillmissing ([" foo"; "bar "], "nearest"), ["bfoo"; "baro"]) +%!assert (fillmissing ([" foo"; "bar "], "nearest", 1), ["bfoo"; "baro"]) +%!assert (fillmissing ([" foo"; "bar "], "next", 2), ["ffoo"; "bar "]) +%!assert (fillmissing ([" foo"; "bar "], "previous", 2), [" foo"; "barr"]) +%!assert (fillmissing ([" foo"; "bar "], "nearest", 2), ["ffoo"; "barr"]) +%!assert (fillmissing ([" foo"; "bar "], "next", 3), [" foo"; "bar "]) +%!assert (fillmissing ([" foo"; "bar "], "previous", 3), [" foo"; "bar "]) +%!assert (fillmissing ([" foo"; "bar "], "nearest", 3), [" foo"; "bar "]) +%!assert (fillmissing ({"foo", "bar"}, "constant", "a"), {"foo", "bar"}) +%!assert (fillmissing ({"foo", "bar"}, "constant", {"a"}), {"foo", "bar"}) +%!assert (fillmissing ({"foo", "", "bar"}, "constant", "a"), {"foo", "a", "bar"}) +%!assert (fillmissing ({"foo", "", "bar"}, "constant", {"a"}), {"foo", "a", "bar"}) +%!assert (fillmissing ({"foo", "", "bar"}, "previous"), {"foo", "foo", "bar"}) +%!assert (fillmissing ({"foo", "", "bar"}, "next"), {"foo", "bar", "bar"}) +%!assert (fillmissing ({"foo", "", "bar"}, "nearest"), {"foo", "bar", "bar"}) +%!assert (fillmissing ({"foo", "", "bar"}, "previous", 2), {"foo", "foo", "bar"}) +%!assert (fillmissing ({"foo", "", "bar"}, "next", 2), {"foo", "bar", "bar"}) +%!assert (fillmissing ({"foo", "", "bar"}, "nearest", 2), {"foo", "bar", "bar"}) +%!assert (fillmissing ({"foo", "", "bar"}, "previous", 1), {"foo", "", "bar"}) +%!assert (fillmissing ({"foo", "", "bar"}, "previous", 1), {"foo", "", "bar"}) +%!assert (fillmissing ({"foo", "", "bar"}, "next", 1), {"foo", "", "bar"}) +%!assert (fillmissing ({"foo", "", "bar"}, "nearest", 1), {"foo", "", "bar"}) %!assert (fillmissing ("abc ", @(x,y,z) x+y+z, 2), "abcj") -%!assert (fillmissing ({'foo', '', 'bar'}, @(x,y,z) x(1), 3), {'foo','foo','bar'}) +%!assert (fillmissing ({"foo", "", "bar"}, @(x,y,z) x(1), 3), {"foo", "foo", "bar"}) %!test %! [A, idx] = fillmissing (" a b c", "constant", " "); %! assert (A, " a b c"); -%! assert (idx, logical([0 0 0 0 0 0])); +%! assert (idx, logical ([0, 0, 0, 0, 0, 0])); %! [A, idx] = fillmissing ({"foo", "", "bar", ""}, "constant", ""); %! assert (A, {"foo", "", "bar", ""}); -%! assert (idx, logical([0 0 0 0])); +%! assert (idx, logical ([0, 0, 0, 0])); %! [A, idx] = fillmissing ({"foo", "", "bar", ""}, "constant", {""}); %! assert (A, {"foo", "", "bar", ""}); -%! assert (idx, logical([0 0 0 0])); -%! [A,idx] = fillmissing (' f o o ', @(x,y,z) repelem ("a", numel (z)), 3); +%! assert (idx, logical ([0, 0, 0, 0])); +%! [A,idx] = fillmissing (" f o o ", @(x,y,z) repelem ("a", numel (z)), 3); %! assert (A, "afaoaoa"); -%! assert (idx, logical([1 0 1 0 1 0 1])); -%! [A,idx] = fillmissing (' f o o ', @(x,y,z) repelem (" ", numel (z)), 3); +%! assert (idx, logical ([1, 0, 1, 0, 1, 0, 1])); +%! [A,idx] = fillmissing (" f o o ", @(x,y,z) repelem (" ", numel (z)), 3); %! assert (A, " f o o "); -%! assert (idx, logical([0 0 0 0 0 0 0])); -%! [A,idx] = fillmissing ({'','foo',''}, @(x,y,z) repelem ({'a'}, numel (z)), 3); -%! assert (A, {'a','foo','a'}); -%! assert (idx, logical([1 0 1])); -%! [A,idx] = fillmissing ({'','foo',''}, @(x,y,z) repelem ({''}, numel (z)), 3); -%! assert (A, {'','foo',''}); -%! assert (idx, logical([0 0 0])); - - -##types without a defined 'missing' (currently logical, int) that can be filled -%!assert (fillmissing (logical ([1 0 1 0 1]), "constant", true), logical ([1 0 1 0 1])) -%!assert (fillmissing (logical ([1 0 1 0 1]), "constant", false, 'missinglocations', logical([1 0 1 0 1])), logical ([0 0 0 0 0])) -%!assert (fillmissing (logical ([1 0 1 0 1]), "previous", 'missinglocations', logical([1 0 1 0 1])), logical ([1 0 0 0 0])) -%!assert (fillmissing (logical ([1 0 1 0 1]), "next", 'missinglocations', logical([1 0 1 0 1])), logical ([0 0 0 0 1])) -%!assert (fillmissing (logical ([1 0 1 0 1]), "nearest", 'missinglocations', logical([1 0 1 0 1])), logical ([0 0 0 0 0])) -%!assert (fillmissing (logical ([1 0 1 0 1]), @(x,y,z) false(size(z)), 3), logical ([1 0 1 0 1])) -%!assert (fillmissing (logical ([1 0 1 0 1]), @(x,y,z) false(size(z)), 3, 'missinglocations', logical([1 0 1 0 1])), logical ([0 0 0 0 0])) -%!assert (fillmissing (logical ([1 0 1 0 1]), @(x,y,z) false(size(z)), [2 0], 'missinglocations', logical([1 0 1 0 1])), logical ([1 0 0 0 0])) +%! assert (idx, logical ([0, 0, 0, 0, 0, 0, 0])); +%! [A,idx] = fillmissing ({"", "foo", ""}, @(x,y,z) repelem ({"a"}, numel (z)), 3); +%! assert (A, {"a", "foo", "a"}); +%! assert (idx, logical ([1, 0, 1])); +%! [A,idx] = fillmissing ({"", "foo", ""}, @(x,y,z) repelem ({""}, numel (z)), 3); +%! assert (A, {"", "foo", ""}); +%! assert (idx, logical ([0, 0, 0])); + +## Types without a defined 'missing' (currently logical, int) that can be filled +%!assert (fillmissing (logical ([1, 0, 1, 0, 1]), "constant", true), logical ([1, 0, 1, 0, 1])) +%!assert (fillmissing (logical ([1, 0, 1, 0, 1]), "constant", false, "missinglocations", logical ([1, 0, 1, 0, 1])), logical ([0, 0, 0, 0, 0])) +%!assert (fillmissing (logical ([1, 0, 1, 0, 1]), "previous", "missinglocations", logical ([1, 0, 1, 0, 1])), logical ([1, 0, 0, 0, 0])) +%!assert (fillmissing (logical ([1, 0, 1, 0, 1]), "next", "missinglocations", logical ([1, 0, 1, 0, 1])), logical ([0, 0, 0, 0, 1])) +%!assert (fillmissing (logical ([1, 0, 1, 0, 1]), "nearest", "missinglocations", logical ([1, 0, 1, 0, 1])), logical ([0, 0, 0, 0, 0])) +%!assert (fillmissing (logical ([1, 0, 1, 0, 1]), @(x,y,z) false(size(z)), 3), logical ([1, 0, 1, 0, 1])) +%!assert (fillmissing (logical ([1, 0, 1, 0, 1]), @(x,y,z) false(size(z)), 3, "missinglocations", logical ([1, 0, 1, 0, 1])), logical ([0, 0, 0, 0, 0])) +%!assert (fillmissing (logical ([1, 0, 1, 0, 1]), @(x,y,z) false(size(z)), [2, 0], "missinglocations", logical ([1, 0, 1, 0, 1])), logical ([1, 0, 0, 0, 0])) %!test -%! x = logical ([1 0 1 0 1]); -%! [~,idx] = fillmissing (x, "constant", true); -%! assert (idx, logical([0 0 0 0 0])); -%! [~,idx] = fillmissing (x, "constant", false, 'missinglocations', logical([1 0 1 0 1])); -%! assert (idx, logical([1 0 1 0 1])); -%! [~,idx] = fillmissing (x, "constant", true, 'missinglocations', logical([1 0 1 0 1])); -%! assert (idx, logical([1 0 1 0 1])); -%! [~,idx] = fillmissing (x, "previous", 'missinglocations', logical([1 0 1 0 1])); -%! assert (idx, logical([0 0 1 0 1])); -%! [~,idx] = fillmissing (x, "next", 'missinglocations', logical([1 0 1 0 1])); -%! assert (idx, logical([1 0 1 0 0])); -%! [~,idx] = fillmissing (x, "nearest", 'missinglocations', logical([1 0 1 0 1])); -%! assert (idx, logical([1 0 1 0 1])); -%! [~,idx] = fillmissing (x, @(x,y,z) false(size(z)), 3); -%! assert (idx, logical ([0 0 0 0 0])) -%! [~,idx] = fillmissing (x, @(x,y,z) false(size(z)), 3, 'missinglocations', logical([1 0 1 0 1])); -%! assert (idx, logical ([1 0 1 0 1])) -%! [~,idx] = fillmissing (x, @(x,y,z) false(size(z)), [2 0], 'missinglocations', logical([1 0 1 0 1])); -%! assert (idx, logical ([0 0 1 0 1])) - -%!assert (fillmissing (int32 ([1 2 3 4 5]), "constant", 0), int32 ([1 2 3 4 5])) -%!assert (fillmissing (int32 ([1 2 3 4 5]), "constant", 0,'missinglocations', logical([1 0 1 0 1])), int32 ([0 2 0 4 0])) -%!assert (fillmissing (int32 ([1 2 3 4 5]), "previous", 'missinglocations', logical([1 0 1 0 1])), int32 ([1 2 2 4 4])) -%!assert (fillmissing (int32 ([1 2 3 4 5]), "next", 'missinglocations', logical([1 0 1 0 1])), int32 ([2 2 4 4 5])) -%!assert (fillmissing (int32 ([1 2 3 4 5]), "nearest", 'missinglocations', logical([1 0 1 0 1])), int32 ([2 2 4 4 4])) -%!assert (fillmissing (int32 ([1 2 3 4 5]), @(x,y,z) z+10, 3), int32 ([1 2 3 4 5])) -%!assert (fillmissing (int32 ([1 2 3 4 5]), @(x,y,z) z+10, 3, 'missinglocations', logical([1 0 1 0 1])), int32 ([11 2 13 4 15])) -%!assert (fillmissing (int32 ([1 2 3 4 5]), @(x,y,z) z+10, [2 0], 'missinglocations', logical([1 0 1 0 1])), int32 ([1 2 13 4 15])) +%! x = logical ([1, 0, 1, 0, 1]); +%! [~, idx] = fillmissing (x, "constant", true); +%! assert (idx, logical ([0, 0, 0, 0, 0])); +%! [~, idx] = fillmissing (x, "constant", false, "missinglocations", logical ([1, 0, 1, 0, 1])); +%! assert (idx, logical ([1, 0, 1, 0, 1])); +%! [~, idx] = fillmissing (x, "constant", true, "missinglocations", logical ([1, 0, 1, 0, 1])); +%! assert (idx, logical ([1, 0, 1, 0, 1])); +%! [~, idx] = fillmissing (x, "previous", "missinglocations", logical ([1, 0, 1, 0, 1])); +%! assert (idx, logical ([0, 0, 1, 0, 1])); +%! [~, idx] = fillmissing (x, "next", "missinglocations", logical ([1, 0, 1, 0, 1])); +%! assert (idx, logical ([1, 0, 1, 0, 0])); +%! [~, idx] = fillmissing (x, "nearest", "missinglocations", logical ([1, 0, 1, 0, 1])); +%! assert (idx, logical ([1, 0, 1, 0, 1])); +%! [~, idx] = fillmissing (x, @(x,y,z) false(size(z)), 3); +%! assert (idx, logical ([0, 0, 0, 0, 0])) +%! [~, idx] = fillmissing (x, @(x,y,z) false(size(z)), 3, "missinglocations", logical ([1, 0, 1, 0, 1])); +%! assert (idx, logical ([1, 0, 1, 0, 1])) +%! [~, idx] = fillmissing (x, @(x,y,z) false(size(z)), [2 0], "missinglocations", logical ([1, 0, 1, 0, 1])); +%! assert (idx, logical ([0, 0, 1, 0, 1])) + +%!assert (fillmissing (int32 ([1, 2, 3, 4, 5]), "constant", 0), int32 ([1, 2, 3, 4, 5])) +%!assert (fillmissing (int32 ([1, 2, 3, 4, 5]), "constant", 0, "missinglocations", logical ([1, 0, 1, 0, 1])), int32 ([0, 2, 0, 4, 0])) +%!assert (fillmissing (int32 ([1, 2, 3, 4, 5]), "previous", "missinglocations", logical ([1, 0, 1, 0, 1])), int32 ([1, 2, 2, 4, 4])) +%!assert (fillmissing (int32 ([1, 2, 3, 4, 5]), "next", "missinglocations", logical ([1, 0, 1, 0, 1])), int32 ([2, 2, 4, 4, 5])) +%!assert (fillmissing (int32 ([1, 2, 3, 4, 5]), "nearest", "missinglocations", logical ([1, 0, 1, 0, 1])), int32 ([2, 2, 4, 4, 4])) +%!assert (fillmissing (int32 ([1, 2, 3, 4, 5]), @(x,y,z) z+10, 3), int32 ([1, 2, 3, 4, 5])) +%!assert (fillmissing (int32 ([1, 2, 3, 4, 5]), @(x,y,z) z+10, 3, "missinglocations", logical ([1, 0, 1, 0, 1])), int32 ([11, 2, 13, 4, 15])) +%!assert (fillmissing (int32 ([1, 2, 3, 4, 5]), @(x,y,z) z+10, [2, 0], "missinglocations", logical ([1, 0, 1, 0, 1])), int32 ([1, 2, 13, 4, 15])) %!test -%! x = int32 ([1 2 3 4 5]); -%! [~,idx] = fillmissing (x, "constant", 0); -%! assert (idx, logical([0 0 0 0 0])); -%! [~,idx] = fillmissing (x, "constant", 0, 'missinglocations', logical([1 0 1 0 1])); -%! assert (idx, logical([1 0 1 0 1])); -%! [~,idx] = fillmissing (x, "constant", 3, 'missinglocations', logical([0 0 1 0 0])); -%! assert (idx, logical([0 0 1 0 0])); -%! [~,idx] = fillmissing (x, "previous", 'missinglocations', logical([1 0 1 0 1])); -%! assert (idx, logical([0 0 1 0 1])); -%! [~,idx] = fillmissing (x, "next", 'missinglocations', logical([1 0 1 0 1])); -%! assert (idx, logical([1 0 1 0 0])); -%! [~,idx] = fillmissing (x, "nearest", 'missinglocations', logical([1 0 1 0 1])); -%! assert (idx, logical([1 0 1 0 1])); -%! [~,idx] = fillmissing (x, @(x,y,z) z+10, 3); -%! assert (idx, logical([0 0 0 0 0])); -%! [~,idx] = fillmissing (x, @(x,y,z) z+10, 3, 'missinglocations', logical([1 0 1 0 1])); -%! assert (idx, logical([1 0 1 0 1])); -%! [~,idx] = fillmissing (x, @(x,y,z) z+10, [2 0], 'missinglocations', logical([1 0 1 0 1])); -%! assert (idx, logical([0 0 1 0 1])); - -## other data type passthrough +%! x = int32 ([1, 2, 3, 4, 5]); +%! [~, idx] = fillmissing (x, "constant", 0); +%! assert (idx, logical ([0, 0, 0, 0, 0])); +%! [~, idx] = fillmissing (x, "constant", 0, "missinglocations", logical ([1, 0, 1, 0, 1])); +%! assert (idx, logical ([1, 0, 1, 0, 1])); +%! [~, idx] = fillmissing (x, "constant", 3, "missinglocations", logical ([0, 0, 1, 0, 0])); +%! assert (idx, logical ([0, 0, 1, 0, 0])); +%! [~, idx] = fillmissing (x, "previous", "missinglocations", logical ([1, 0, 1, 0, 1])); +%! assert (idx, logical ([0, 0, 1, 0, 1])); +%! [~, idx] = fillmissing (x, "next", "missinglocations", logical ([1, 0, 1, 0, 1])); +%! assert (idx, logical ([1, 0, 1, 0, 0])); +%! [~, idx] = fillmissing (x, "nearest", "missinglocations", logical ([1, 0, 1, 0, 1])); +%! assert (idx, logical ([1, 0, 1, 0, 1])); +%! [~, idx] = fillmissing (x, @(x,y,z) z+10, 3); +%! assert (idx, logical ([0, 0, 0, 0, 0])); +%! [~, idx] = fillmissing (x, @(x,y,z) z+10, 3, "missinglocations", logical ([1, 0, 1, 0, 1])); +%! assert (idx, logical ([1, 0, 1, 0, 1])); +%! [~, idx] = fillmissing (x, @(x,y,z) z+10, [2 0], "missinglocations", logical ([1, 0, 1, 0, 1])); +%! assert (idx, logical ([0, 0, 1, 0, 1])); + +## Other data type passthrough %!test -%! [A, idx] = fillmissing ([struct struct], "constant", 1); -%! assert (A, [struct struct]) -%! assert (idx, [false false]) +%! [A, idx] = fillmissing ([struct, struct], "constant", 1); +%! assert (A, [struct, struct]) +%! assert (idx, [false, false]) ## Test input validation and error messages %!error <Invalid call> fillmissing () %!error <Invalid call> fillmissing (1) -%!error <Invalid call> fillmissing (1,2,3,4,5,6,7,8,9,10,11,12,13) +%!error <Invalid call> fillmissing (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13) %!error <second input must be a> fillmissing (1, 2) %!error <unknown fill method 'foo'> fillmissing (1, "foo") %!error <fill function must accept at least> fillmissing (1, @(x) x, 1) %!error <fill function must accept at least> fillmissing (1, @(x,y) x+y, 1) %!error <interpolation methods only valid for numeric> fillmissing ("a b c", "linear") -%!error <interpolation methods only valid for numeric> fillmissing ({'a','b'}, "linear") +%!error <interpolation methods only valid for numeric> fillmissing ({"a", "b"}, "linear") %!error <'movmean' and 'movmedian' methods only valid for numeric> fillmissing ("a b c", "movmean", 2) -%!error <'movmean' and 'movmedian' methods only valid for numeric> fillmissing ({'a','b'}, "movmean", 2) +%!error <'movmean' and 'movmedian' methods only valid for numeric> fillmissing ({"a", "b"}, "movmean", 2) %!error <'constant' method must be followed by> fillmissing (1, "constant") %!error <a numeric fill value cannot be emtpy> fillmissing (1, "constant", []) %!error <fill value must be the same data type> fillmissing (1, "constant", "a") @@ -2254,49 +2282,49 @@ endfunction %!error <moving window method must be followed by> fillmissing (1, "movmedian") %!error <DIM must be a positive scalar> fillmissing (1, "constant", 1, 0) %!error <DIM must be a positive scalar> fillmissing (1, "constant", 1, -1) -%!error <DIM must be a positive scalar> fillmissing (1, "constant", 1, [1 2]) +%!error <DIM must be a positive scalar> fillmissing (1, "constant", 1, [1, 2]) %!error <properties must be given as> fillmissing (1, "constant", 1, "samplepoints") %!error <properties must be given as> fillmissing (1, "constant", 1, "foo") %!error <properties must be given as> fillmissing (1, "constant", 1, 1, "foo") %!error <invalid parameter name specified> fillmissing (1, "constant", 1, 2, {1}, 4) -%!error <SamplePoints must be a> fillmissing ([1 2 3], "constant", 1, 2, "samplepoints", [1 2]) -%!error <SamplePoints must be a> fillmissing ([1 2 3], "constant", 1, 2, "samplepoints", [3 1 2]) -%!error <SamplePoints must be a> fillmissing ([1 2 3], "constant", 1, 2, "samplepoints", [1 1 2]) -%!error <SamplePoints must be a> fillmissing ([1 2 3], "constant", 1, 2, "samplepoints", "abc") -%!error <SamplePoints must be a> fillmissing ([1 2 3], "constant", 1, 2, "samplepoints", logical([1 1 1])) -%!error <SamplePoints must be a> fillmissing ([1 2 3], "constant", 1, 1, "samplepoints", [1 2 3]) -%!error <EndValues method 'constant' only valid> fillmissing ('foo', "next", "endvalues", 1) +%!error <SamplePoints must be a> fillmissing ([1, 2, 3], "constant", 1, 2, "samplepoints", [1, 2]) +%!error <SamplePoints must be a> fillmissing ([1, 2, 3], "constant", 1, 2, "samplepoints", [3, 1, 2]) +%!error <SamplePoints must be a> fillmissing ([1, 2, 3], "constant", 1, 2, "samplepoints", [1, 1, 2]) +%!error <SamplePoints must be a> fillmissing ([1, 2, 3], "constant", 1, 2, "samplepoints", "abc") +%!error <SamplePoints must be a> fillmissing ([1, 2, 3], "constant", 1, 2, "samplepoints", logical ([1, 1, 1])) +%!error <SamplePoints must be a> fillmissing ([1, 2, 3], "constant", 1, 1, "samplepoints", [1, 2, 3]) +%!error <EndValues method 'constant' only valid> fillmissing ("foo", "next", "endvalues", 1) %!error <invalid EndValues method 'foo'> fillmissing (1, "constant", 1, 1, "endvalues", "foo") -%!error <EndValues must be a scalar or a 1 element array> fillmissing ([1 2 3], "constant", 1, 2, "endvalues", [1 2 3]) -%!error <EndValues must be a scalar or a 3 element array> fillmissing ([1 2 3], "constant", 1, 1, "endvalues", [1 2]) -%!error <EndValues must be a scalar or a 12 element array> fillmissing (randi(5,4,3,2), "constant", 1, 3, "endvalues", [1 2]) +%!error <EndValues must be a scalar or a 1 element array> fillmissing ([1, 2, 3], "constant", 1, 2, "endvalues", [1, 2, 3]) +%!error <EndValues must be a scalar or a 3 element array> fillmissing ([1, 2, 3], "constant", 1, 1, "endvalues", [1, 2]) +%!error <EndValues must be a scalar or a 12 element array> fillmissing (randi(5,4,3,2), "constant", 1, 3, "endvalues", [1, 2]) %!error <EndValues must be numeric or a> fillmissing (1, "constant", 1, 1, "endvalues", {1}) %!error <invalid parameter name 'foo'> fillmissing (1, "constant", 1, 2, "foo", 4) %!error <MissingLocations option is not compatible with> fillmissing (struct, "constant", 1, "missinglocations", false) %!error <MissingLocations and MaxGap options> fillmissing (1, "constant", 1, 2, "maxgap", 1, "missinglocations", false) %!error <MissingLocations and MaxGap options> fillmissing (1, "constant", 1, 2, "missinglocations", false, "maxgap", 1) %!error <the 'replacevalues' option has not> fillmissing (1, "constant", 1, "replacevalues", true) -%!error <the 'datavariables' option has not> fillmissing (1, "constant", 1, "datavariables", 'Varname') +%!error <the 'datavariables' option has not> fillmissing (1, "constant", 1, "datavariables", "Varname") %!error <MissingLocations must be a> fillmissing (1, "constant", 1, 2, "missinglocations", 1) -%!error <MissingLocations must be a> fillmissing (1, "constant", 1, 2, "missinglocations", 'a') -%!error <MissingLocations must be a> fillmissing (1, "constant", 1, 2, "missinglocations", [true false]) +%!error <MissingLocations must be a> fillmissing (1, "constant", 1, 2, "missinglocations", "a") +%!error <MissingLocations must be a> fillmissing (1, "constant", 1, 2, "missinglocations", [true, false]) %!error <MissingLocations cannot be used with method> fillmissing (true, "linear", "missinglocations", true) -%!error <MissingLocations cannot be used with method> fillmissing (int8(1), "linear", "missinglocations", true) +%!error <MissingLocations cannot be used with method> fillmissing (int8 (1), "linear", "missinglocations", true) %!error <MissingLocations cannot be used with EndValues method> fillmissing (true, "next", "missinglocations", true, "EndValues", "linear") %!error <MissingLocations cannot be used with EndValues method> fillmissing (true, "next", "EndValues", "linear", "missinglocations", true) -%!error <MissingLocations cannot be used with EndValues method> fillmissing (int8(1), "next", "missinglocations", true, "EndValues", "linear") -%!error <MissingLocations cannot be used with EndValues method> fillmissing (int8(1), "next", "EndValues", "linear", "missinglocations", true) +%!error <MissingLocations cannot be used with EndValues method> fillmissing (int8 (1), "next", "missinglocations", true, "EndValues", "linear") +%!error <MissingLocations cannot be used with EndValues method> fillmissing (int8 (1), "next", "EndValues", "linear", "missinglocations", true) %!error <MaxGap must be a positive numeric scalar> fillmissing (1, "constant", 1, 2, "maxgap", true) -%!error <MaxGap must be a positive numeric scalar> fillmissing (1, "constant", 1, 2, "maxgap", 'a') -%!error <MaxGap must be a positive numeric scalar> fillmissing (1, "constant", 1, 2, "maxgap", [1 2]) +%!error <MaxGap must be a positive numeric scalar> fillmissing (1, "constant", 1, 2, "maxgap", "a") +%!error <MaxGap must be a positive numeric scalar> fillmissing (1, "constant", 1, 2, "maxgap", [1, 2]) %!error <MaxGap must be a positive numeric scalar> fillmissing (1, "constant", 1, 2, "maxgap", 0) %!error <MaxGap must be a positive numeric scalar> fillmissing (1, "constant", 1, 2, "maxgap", -1) -%!error <fill value 'V' must be a scalar or a 1> fillmissing ([1 2 3], "constant", [1 2 3]) -%!error <fill value 'V' must be a scalar or a 1> fillmissing ([1 2 3]', "constant", [1 2 3]) -%!error <fill value 'V' must be a scalar or a 1> fillmissing ([1 2 3]', "constant", [1 2 3], 1) -%!error <fill value 'V' must be a scalar or a 1> fillmissing ([1 2 3], "constant", [1 2 3], 2) -%!error <fill value 'V' must be a scalar or a 6> fillmissing (randi(5,4,3,2), "constant", [1 2], 1) -%!error <fill value 'V' must be a scalar or a 8> fillmissing (randi(5,4,3,2), "constant", [1 2], 2) -%!error <fill value 'V' must be a scalar or a 12> fillmissing (randi(5,4,3,2), "constant", [1 2], 3) +%!error <fill value 'V' must be a scalar or a 1> fillmissing ([1, 2, 3], "constant", [1, 2, 3]) +%!error <fill value 'V' must be a scalar or a 1> fillmissing ([1, 2, 3]', "constant", [1, 2, 3]) +%!error <fill value 'V' must be a scalar or a 1> fillmissing ([1, 2, 3]', "constant", [1, 2, 3], 1) +%!error <fill value 'V' must be a scalar or a 1> fillmissing ([1, 2, 3], "constant", [1, 2, 3], 2) +%!error <fill value 'V' must be a scalar or a 6> fillmissing (randi (5, 4, 3, 2), "constant", [1, 2], 1) +%!error <fill value 'V' must be a scalar or a 8> fillmissing (randi (5, 4, 3, 2), "constant", [1, 2], 2) +%!error <fill value 'V' must be a scalar or a 12> fillmissing (randi (5, 4, 3, 2), "constant", [1, 2], 3) %!error <fill function handle must be followed by> fillmissing (1, @(x,y,z) x+y+z) -%!error <fill function return values must be the same size> fillmissing ([1 NaN 2], @(x,y,z) [1 2], 2) +%!error <fill function return values must be the same size> fillmissing ([1, NaN, 2], @(x,y,z) [1, 2], 2) diff --git a/inst/glmfit.m b/inst/glmfit.m index 2e5b819..eea142f 100644 --- a/inst/glmfit.m +++ b/inst/glmfit.m @@ -1,4 +1,5 @@ ## Copyright (C) 2024 Ruchika Sonagote <ruchikasonagote2003@gmail.com> +## Copyright (C) 2024 Andreas Bertsatos <abertsatos@biol.uoa.gr> ## ## This file is part of the statistics package for GNU Octave. ## @@ -18,66 +19,153 @@ ## -*- texinfo -*- ## @deftypefn {statistics} {@var{b} =} glmfit (@var{X}, @var{y}, @var{distribution}) -## @deftypefnx {statistics} {@var{b} =} glmfit (@var{X}, @var{y}, @var{distribution}, @var{Name}, @var{Value}) +## @deftypefnx {statistics} {@var{b} =} glmfit (@var{X}, @var{y}, @var{distribution},@var{Name}, @var{Value}) +## @deftypefnx {statistics} {[@var{b}, @var{dev}] =} glmfit (@dots{}) ## ## Perform generalized linear model fitting. ## -## This function fits a generalized linear model (GLM) to the given data using -## the specified link function and distribution of the response variable. The -## model is fitted using Iteratively Reweighted Least Squares (IRLS). +## @code{@var{b} = glmfit (@var{X}, @var{y}, @var{distribution})} returns a +## coefficient estimates vector, @var{b} for a +## generalized linear regression model of responses in @var{y} and +## predictors in @var{X}, using the @var{distribution}. ## ## @itemize -## @item @var{X} is an @math{nxp} matrix of predictor variables with +## @item @var{X} is an @math{nxp} numeric matrix of predictor variables with ## @math{n} observations and @math{p} predictors. -## @item @var{y} is an @math{nx1} vector of response variables. +## @item @var{y} is a @math{n x 1} numeric vector of responses for all supported +## distributions, except for the 'binomial' distribution which can also have +## @var{y} as a @math{n x 2} matrix, where the first column contains the number +## of successes and the second column contains the number of trials. ## @item @var{distribution} specifies the distribution of the response variable ## (e.g., 'poisson'). ## @end itemize ## -## @code{@var{b} = glmfit (@var{X}, @var{y}, @var{distribution}, @var{Name}, -## @var{Value})} specifies additional options using @qcode{Name-Value} pair -## arguments. +## @code{@var{b} = glmfit (@dots{}, @var{Name}, @var{Value})} +## specifies additional options using @qcode{Name-Value} pair arguments. +## ## @multitable @columnfractions 0.18 0.02 0.8 -## @headitem @tab @var{Name} @tab @var{Value} +## @headitem @var{Name} @tab @tab @var{Value} ## -## @item @qcode{"link"} @tab @tab A character vector specifying a lin +## @item @qcode{"link"} @tab @tab A character vector specifying a link ## function. -## @end multitable ## -## The function returns @var{b}, the estimated coefficients of the GLM, -## including the intercept term as the first element of @var{b}. +## @item @qcode{"constant"} @tab @tab Specifies whether to +## include a constant term in the model. Options are +## @var{"on"} (default) or @var{"off"}. +## @end multitable ## -## Currently, the function supports only the 'poisson' distribution -## and 'log' link function. Further expansion is required to support -## additional distributions and link functions. +## @code{[@var{b}, @var{dev}] = glmfit (@dots{})} +## returns the estimated coefficient vector, @var{b}, as well as +## the deviance, @var{dev}, of the fit. ## +## Supported distributions include 'poisson', 'binomial', and 'normal'. +## Supported link functions include 'identity', 'log', 'logit', 'probit', +## 'loglog', 'comploglog', 'reciprocal' and a custom link. +## Custom link function provided as a structure with three fields: +## Link Function, Derivative Function, Inverse Function. ## @end deftypefn -function b = glmfit(X, y, distribution, varargin) +function [b,varargout] = glmfit (X, y, distribution, varargin) + ## Check input - y = round (y(:)); - if (nargin < 2) - X = zeros (length (y), 0); + if (nargin < 3) + error ("glmfit: too few input arguments."); + elseif (mod (nargin - 3, 2) != 0) + error ("glmfit: Name-Value arguments must be in pairs."); + elseif (! isnumeric (X)) + error ("glmfit: X must be a numeric."); + elseif (! isnumeric (y)) + error ("glmfit: Y must be a numeric."); + elseif (size (X, 1) != size (y, 1)) + error ("glmfit: X and Y must have the same number of observations."); + elseif (! ischar (distribution)) + error ("glmfit: DISTRIBUTION must be a character vector."); endif - xymissing = (isnan (y) | any (isnan (X), 2)); + + ## Remove missing values + xymissing = isnan (y) | any (isnan (X), 2); y(xymissing) = []; X(xymissing,:) = []; [my, ny] = size (y); [mx, nx] = size (X); - if (mx != my) - error ("glm: X and y must have the same number of observations."); + + ## Check dimensions based on distribution + if (strcmpi (distribution, 'binomial')) + if (size (y, 2) > 2) + error (["glmfit: for a binomial distribution,", ... + " Y must be an n-by-1 or n-by-2 matrix."]); + endif + else + if (size (y, 2) != 1) + error (["glmfit: for distributions other than the binomial,", ... + " Y must be an n-by-1 column vector."]); + endif endif - ## Add defaults - link = "log"; + ## Add default link functions + switch (tolower (distribution)) + case "poisson" + link = "log"; + case "binomial" + link = "logit"; + case "normal" + link = "identity"; + case "gamma" + error ("glmfit: 'gamma' distribution is not supported yet."); + case "inverse gaussian" + error ("glmfit: 'inverse gaussian' distribution is not supported yet."); + otherwise + error ("glmfit: unknown distribution."); + endswitch + + ## Set default for constant + constant = "on"; ## Parse extra parameters while (numel (varargin) > 0) switch (tolower (varargin {1})) case "link" - link = varargin{2}; - if (! any (strcmpi (link, {"log"}))) - error ("glmfit: unsupported link function."); + linkInput = varargin {2}; + ## Check custom link + if (iscell (linkInput)) + if (numel (linkInput) != 3) + error (["glmfit: custom link functions must be", ... + " in a three-element cell array."]) + endif + linkFunc = linkInput{1}; + derLinkFunc = linkInput{2}; + invLinkFunc = linkInput{3}; + ## Check for function_handle + if (! all (cellfun (@(f) isa (f, 'function_handle'), linkInput))) + error ("glmfit: custom link functions must be function handles."); + endif + ## Test the custom function with a small vector + try + testInput = [1; 2; 3; 4; 5]; + testOutput = invLinkFunc (testInput); + if (! isequal (size (testInput), size (testOutput))) + error (["glmfit: custom inverse link function must", ... + " return output of the same size as input."]); + endif + catch + error (["glmfit: custom inverse link function must", ... + " return output of the same size as input."]); + end_try_catch + link = "custom"; + ## Check link + elseif ischar (linkInput) || isstring (linkInput) + link = tolower (linkInput); + if (! any (strcmpi (link, {"identity", "log", "logit", "probit", ... + "loglog", "comploglog", "reciprocal"}))) + error ("glmfit: unsupported link function."); + endif + else + error ("glmfit: invalid value for link function."); + endif + case "constant" + constant = tolower (varargin {2}); + if (! any (strcmpi (constant, {"on", "off"}))) + error ("glmfit: constant should be either 'on' or 'off'."); endif otherwise error ("glmfit: unknown parameter name."); @@ -85,57 +173,170 @@ function b = glmfit(X, y, distribution, varargin) varargin (1:2) = []; endwhile - ## Add column of ones - X = [ones(size(X, 1), 1), X]; + ## Adjust X based on constant + if (strcmpi (constant, 'on')) + X = [ones(mx, 1), X]; + endif + ## Initialize b b = zeros (size (X, 2), 1); - max_itr = 1000; - tolerance = 1e-6; - b_prev = b; ## Select functions switch (link) + case "identity" + ilink = @(x) x; case "log" - inverse_link_func = @(linear_predictor) exp(linear_predictor); + ilink = @(x) exp (x); + case "logit" + ilink = @(x) exp (x) ./ (1 + exp (x)); + case "probit" + ilink = @(x) normcdf (x); + case "loglog" + ilink = @(x) exp (-exp (x)); + case "comploglog" + ilink = @(x) 1 - exp (-exp (x)); + case "reciprocal" + ilink = @(x) 1 ./ x; + case "custom" + ilink = invLinkFunc; endswitch - switch (distribution) + + ## Select negative loglikelihood according to distribution + switch (tolower (distribution)) case "poisson" - working_response_func = ... - @(y, linear_predictor, mu) linear_predictor + (y - mu) ./ mu; - diag_matrix_func = @(mu) diag(mu); + nll = @(b) - sum ((y .* X * b) - ilink (X * b) - gammaln (y+1)); + case "binomial" + eps = 1e-6; + if (size (y, 2) == 1) + successes = y; + trials = ones (size (y)); + else # it can only have 2 columns then + successes = y(:, 1); + trials = y(:, 2); + endif + nll = @(b) ... + - sum (successes .* log (max (min (ilink (X * b), 1 - eps), eps)) ... + + (trials - successes) ... + .* log (1 - max (min (ilink (X * b), 1 - eps), eps))); + case "normal" + nll = @(b) 0.5 * sum ((y - ilink (X * b)) .^ 2); endswitch + options = optimset ('MaxFunEvals', 10000, 'MaxIter', 10000); + b = fminsearch (nll, b, options); - for i = 1:max_itr - linear_predictor = X * b; - ## Give inverse function according to link function - mu = inverse_link_func (linear_predictor); - ## Weights for IRLS - z = working_response_func (y, linear_predictor, mu); - W = diag_matrix_func (mu); - ## Update b - b = (X' * W * X) \ (X' * W * z); - ## Check for convergence - if norm(b - b_prev, 2) < tolerance - break; - endif - b_prev = b; - endfor - - if (i == max_itr) - #warning('glmfit: reached limit'); + if (nargout > 1) + dev = []; + switch (tolower (distribution)) + case "poisson" + p = exp (X * b); + eps = 1e-6; + dev = sum (2 * (y .* log ((y + eps) ./ (p + eps)) - (y - p))); + case "binomial" + eps = 1e-10; + if (size (y, 2) == 1) + successes = y; + trials = ones(size (y)); + elseif (size (y, 2) == 2) + successes = y(:, 1); + trials = y(:, 2); + endif + p_hat = max (min (ilink (X * b), 1 - eps), eps); + p = successes ./ trials; + p = max (min (p, 1 - eps), eps); + dev = 2 * sum (successes .* log (p ./ p_hat) ... + + (trials - successes) .* log ((1 - p) ./ (1 - p_hat))); + case "normal" + dev = sum ((y - (X * b)) .^ 2); + endswitch + varargout{1} = dev; endif endfunction +%!demo +%! rand ("seed", 1); +%! X = rand (100, 1); +%! b_true = [0.5; -1.2]; +%! mu = exp (b_true(1) + b_true(2) * X); +%! randp ("seed", 1); +%! y = poissrnd (mu); +%! ## Fit a GLM model using the poisson distribution +%! [b,dev] = glmfit (X, y, 'poisson'); + +%!demo +%! x = [2100 2300 2500 2700 2900 3100 3300 3500 3700 3900 4100 4300]'; +%! n = [48 42 31 34 31 21 23 23 21 16 17 21]'; +%! y = [1 2 0 3 8 8 14 17 19 15 17 21]'; +%! [b,dev] = glmfit (x,[y n],'binomial','Link','probit'); + ## Test output %!test %! rand ("seed", 1); %! X = rand (50, 1); %! b_true = [0.4; 1.5]; %! mu_true = exp (b_true(1) + b_true(2) * X); +%! randp ("seed", 1); %! y = poissrnd (mu_true); -%! b = glmfit(X, y, "poisson", "link", "log"); -%! assert(b(1), b_true(1), 0.5); -%! assert(b(2), b_true(2), 0.5); +%! b = glmfit (X, y, "poisson", "link", "log"); +%! assert (b(1), b_true(1), 0.5); +%! assert (b(2), b_true(2), 0.5); +%!test +%! rand ("seed", 1); +%! X1 = rand (50, 1); +%! X2 = rand (50, 1) * 0.5; +%! b_true = [0.4; 1.5; -0.7]; +%! mu_true = exp (b_true(1) + b_true(2) * X1 + b_true(3) * X2); +%! randp ("seed", 1); +%! y = poissrnd(mu_true); +%! [b, dev] = glmfit ([X1, X2], y, "poisson", "link", "log"); +%! assert (b(1), b_true(1), 1); +%! assert (b(2), b_true(2), 1); +%! assert (b(3), b_true(3), 1); +%! assert (dev < 60, true); ## Test input validation +%!error <glmfit: too few input arguments.> glmfit () +%!error <glmfit: too few input arguments.> glmfit (1) +%!error <glmfit: too few input arguments.> glmfit (1, 2) +%!error <glmfit: Name-Value arguments must be in pairs.> ... +%! glmfit (rand (6, 1), rand (6, 1), 'poisson', 'link') +%!error <glmfit: X must be a numeric.> ... +%! glmfit ('abc', rand (6, 1), 'poisson') +%!error <glmfit: Y must be a numeric.> ... +%! glmfit (rand (5, 2), 'abc', 'poisson') +%!error <glmfit: X and Y must have the same number of observations.> ... +%! glmfit (rand (5, 2), rand (6, 1), 'poisson') +%!error <glmfit: DISTRIBUTION must be a character vector.> ... +%! glmfit (rand (6, 2), rand (6, 1), 3) +%!error <glmfit: DISTRIBUTION must be a character vector.> ... +%! glmfit (rand (6, 2), rand (6, 1), {'poisson'}) +%!error <glmfit: for a binomial distribution, Y must be an n-by-1 or n-by-2 matrix.> ... +%! glmfit (rand (5, 2), rand (5, 3), 'binomial') +%!error <glmfit: for distributions other than the binomial, Y must be an n-by-1 column vector> ... +%! glmfit (rand (5, 2), rand (5, 2), 'normal') +%!error <glmfit: 'gamma' distribution is not supported yet.> ... +%! glmfit (rand (5, 2), rand (5, 1), 'gamma') +%!error <glmfit: 'inverse gaussian' distribution is not supported yet.> ... +%! glmfit (rand (5, 2), rand (5, 1), 'inverse gaussian') +%!error <glmfit: unknown distribution.> ... +%! glmfit (rand (5, 2), rand (5, 1), 'loguniform') +%!error <glmfit: custom link functions must be in a three-element cell array.> ... +%! glmfit (rand(5,2), rand(5,1), 'poisson', 'link', {'log'}) +%!error <glmfit: custom link functions must be in a three-element cell array.> ... +%! glmfit (rand(5,2), rand(5,1), 'poisson', 'link', {'log', 'hijy'}) +%!error <glmfit: custom link functions must be function handles.> ... +%! glmfit (rand(5,2), rand(5,1), 'poisson', 'link', {'log','dfv','dfgvd'}) +%!error <glmfit: custom link functions must be function handles.> ... +%! glmfit (rand(5,2), rand(5,1), 'poisson', 'link', {@log, 'derivative', @exp}) +%!error <glmfit: custom inverse link function must return output of the same size as input.> ... +%! glmfit (rand(5,2), rand(5,1), 'poisson', 'link', {@exp, @log, @(x) eye(e)}) +%!error <glmfit: unsupported link function.> ... +%! glmfit (rand(5,2), rand(5,1), 'poisson', 'link', 'somelinkfunction') +%!error <glmfit: invalid value for link function.> ... +%! glmfit (rand(5,2), rand(5,1), 'poisson', 'link', 2) +%!error <glmfit: constant should be either 'on' or 'off'.> ... +%! glmfit (rand(5,2), rand(5,1), 'poisson', 'link', 'log', 'constant', 0) +%!error <glmfit: constant should be either 'on' or 'off'.> ... +%! glmfit (rand(5,2), rand(5,1), 'poisson', 'link', 'log', 'constant', 'asda') +%!error <glmfit: unknown parameter name.> ... +%! glmfit (rand(5,2), rand(5,1), 'poisson', 'param', 'log', 'constant', 'on') diff --git a/inst/histfit.m b/inst/histfit.m index 6f314c1..69ee04c 100644 --- a/inst/histfit.m +++ b/inst/histfit.m @@ -1,5 +1,5 @@ ## Copyright (C) 2003 Alberto Terruzzi <t-albert@libero.it> -## Copyright (C) 2022-2023 Andreas Bertsatos <abertsatos@biol.uoa.gr> +## Copyright (C) 2022-2024 Andreas Bertsatos <abertsatos@biol.uoa.gr> ## ## This file is part of the statistics package for GNU Octave. ## @@ -17,61 +17,151 @@ ## this program; if not, see <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn {statistics} {} histfit (@var{x}, @var{nbins}) -## @deftypefnx {statistics} {@var{h} =} histfit (@var{x}, @var{nbins}) +## @deftypefn {statistics} {} histfit (@var{x}) +## @deftypefnx {statistics} {} histfit (@var{x}, @var{nbins}) +## @deftypefnx {statistics} {} histfit (@var{x}, @var{nbins}, @var{distname}) +## @deftypefnx {statistics} {} histfit (@var{ax}, @dots{}) +## @deftypefnx {statistics} {@var{h} =} histfit (@dots{}) ## -## Plot histogram with superimposed fitted normal density. +## Plot histogram with superimposed distribution fit. ## -## @code{histfit (@var{x}, @var{nbins})} plots a histogram of the values in -## the vector @var{x} using @var{nbins} bars in the histogram. With one input -## argument, @var{nbins} is set to the square root of the number of elements in -## @var{x}. +## @code{histfit (@var{x})} plots a histogram of the values in the vector +## @var{x} using the number of bins equal to the square root of the number of +## non-missing elements in @var{x} and superimposes a fitted normal density +## function. ## -## @code{@var{h} = histfit (@var{x}, @var{nbins})} returns the bins and fitted -## line handles of the plot in @var{h}. +## @code{histfit (@var{x}, @var{nbins})} plots a histogram of the values in the +## vector @var{x} using @var{nbins} number of bins in the histogram and +## superimposes a fitted normal density function. ## -## Example +## @code{histfit (@var{x}, @var{nbins}, @var{distname})} plots a histogram of +## the values in the vector @var{x} using @var{nbins} number of bins in the +## histogram and superimposes a fitted density function from the distribution +## specified by @var{distname}. ## -## @example -## histfit (randn (100, 1)) -## @end example +## @code{histfit (@var{ax}, @dots{})} uses the axes handle @var{ax} to plot the +## histogram and the fitted density function onto followed by any of the input +## argument combinations specified in the previous syntaxes. ## -## @seealso{bar, hist, pareto} +## @code{@var{h} = histfit (@dots{})} returns a vector of handles @var{h}, where +## @qcode{@var{h}(1)} is the handle to the histogram and @qcode{@var{h}(1)} is +## the handle to the density curve. +## +## Note: calling @code{fitdist} without any input arguments will return a cell +## array of character vectors listing all supported distributions. +## +## @seealso{bar, hist, normplot, fitdist} ## @end deftypefn -function [varargout] = histfit (x, nbins) +function [varargout] = histfit (varargin) + + ## Add list of supported probability distribution objects + PDO = {'Beta'; 'BirnbaumSaunders'; 'Burr'; 'Exponential'; 'ExtremeValue'; ... + 'Gamma'; 'GeneralizedExtremeValue'; 'GeneralizedPareto'; ... + 'InverseGaussian'; 'Logistic'; 'Loglogistic'; 'Lognormal'; ... + 'Nakagami'; 'NegativeBinomial'; 'Normal'; 'Poisson'; 'Rayleigh'; ... + 'Rician'; 'tLocationScale'; 'Weibull'}; + + ABBR = {"bisa"; "ev"; "gev"; "gp"; "invg"; "nbin"; "tls"; "wbl"}; - if (nargin < 1 || nargin > 2) - print_usage; + ## Check for zero input arguments + if (numel (varargin) < 1) + varargout{1} = PDO; + return endif - if (! isnumeric (x) || ! isreal (x) || ! isvector (x) || isscalar (x)) - error ("histfit: X must be a numeric vector of real numbers."); + ## Check for axes handle + if (isaxes (varargin{1})) + ax = varargin{1}; + varargin(1) = []; + get_current_axes = false; + else + get_current_axes = true; endif - row = sum (! isnan (x)); + ## Get data + if (numel (varargin) < 1) + error ("histfit: too few input arguments."); + else + x = varargin{1}; + if (! isnumeric (x) || ! isreal (x) || ! isvector (x) || isscalar (x)) + error ("histfit: X must be a numeric vector of real numbers."); + endif + ## Remove missing values + x(isnan (x)) = []; + xsize = numel (x); + ## Check for valid data + if (xsize < 1) + error ("histfit: no data in X."); + endif + endif + + ## Get nbins + if (numel (varargin) > 1) + nbins = varargin{2}; + if (! (isreal (nbins) && isscalar (nbins) && fix (nbins) == nbins)) + error ("histfit: NBINS must be a real scalar integer value."); + endif + else + nbins = ceil (sqrt (xsize)); + endif - if (nargin < 2) - nbins = ceil (sqrt (row)); + ## Get distribution + if (numel (varargin) > 2) + distname = varargin{3}; + ## Check distribution name + if (! (ischar (distname) && size (distname, 1) == 1)) + error ("histfit: DISTNAME must be a character vector."); + elseif (strcmpi (distname, "kernel")) + error ("histfit: 'Kernel' distribution is not supported yet."); + elseif (! (any (strcmpi (distname, PDO)) || any (strcmpi (distname, ABBR)))) + error ("histfit: unrecognized distribution name."); + endif + else + distname = "normal"; endif - [n, xbin] = hist (x, nbins); - if (any (abs (diff (xbin, 2)) > 10 * max (abs (xbin)) * eps)) - error ("histfit: bins must have uniform width."); + ## Create axes handle (if necessary) + if (get_current_axes) + ax = gca (); endif - ## Compute mu and sigma parameters - mr = mean (x, "omitnan"); - sr = std (x); - ## Evenly spaced samples of the expected range in X - x = (-3*sr+mr:0.1*sr:3*sr+mr)'; - [xb, yb] = bar (xbin, n); - y = normpdf (x, mr, sr); - binwidth = xbin(2) - xbin(1); - ## Necessary normalization to overplot the histogram - y = row * y * binwidth; - ## Plot density line over histogram. - h = plot (xb, yb, ";;b", x, y, ";;r-"); + ## Plot the histogram + if (any (strcmpi (distname, {"poisson", "NegativeBinomial", "nbin"}))) + binwidth = 1; + xmin = min (x) - 1; + xmax = max (x) + 1; + [binsize, bincenter] = hist (x, [xmin:xmax]); + else + [binsize, bincenter] = hist (x, nbins); + binwidth = max (diff (bincenter)); + xmin = min (x) - binwidth / 2; + xmax = max (x) + binwidth / 2; + endif + h = bar (ax, bincenter, binsize, 1, "facecolor", "b"); + + ## Fit distibution to data + pd = fitdist (x, distname); + + ## Compute density function + if (any (strcmpi (distname, {"poisson", "NegativeBinomial", "nbin"}))) + x = [min(x):max(x)]'; + y = pdf (pd, x); + else + x = [xmin:(xmax-xmin)/100:xmax]'; + y = pdf (pd, x); + endif + + ## Normalize density line and overplot the histogram + y = xsize * y * binwidth; + hold on; + if (any (strcmpi (distname, {"poisson", "NegativeBinomial", "nbin"}))) + h(2) = plot (ax, x, y, ";;r-o"); + else + h(2) = plot (ax, x, y, ";;r-"); + endif + xlim ([xmin, xmax]); + hold off; ## Return the plot's handle if requested if (nargout == 1) @@ -82,6 +172,12 @@ endfunction %!demo %! histfit (randn (100, 1)) +%!demo +%! histfit (poissrnd (2, 1000, 1), 10, "Poisson") + +%!demo +%! histfit (betarnd (3, 10, 1000, 1), 10, "beta") + ## Test plotting %!test %! hf = figure ("visible", "off"); @@ -107,7 +203,71 @@ endfunction %! unwind_protect_cleanup %! close (hf); %! end_unwind_protect +%!test +%! hf = figure ("visible", "off"); +%! unwind_protect +%! histfit (randn (100, 1)); +%! unwind_protect_cleanup +%! close (hf); +%! end_unwind_protect +%!test +%! hf = figure ("visible", "off"); +%! unwind_protect +%! histfit (poissrnd (2, 1000, 1), 10, "Poisson"); +%! unwind_protect_cleanup +%! close (hf); +%! end_unwind_protect +%!test +%! hf = figure ("visible", "off"); +%! unwind_protect +%! histfit (betarnd (3, 10, 1000, 1), 10, "beta"); +%! unwind_protect_cleanup +%! close (hf); +%! end_unwind_protect +%!test +%! hf = figure ("visible", "off"); +%! unwind_protect +%! ax = gca (); +%! histfit (ax, randn (100, 1)); +%! unwind_protect_cleanup +%! close (hf); +%! end_unwind_protect +%!test +%! hf = figure ("visible", "off"); +%! unwind_protect +%! ax = gca (); +%! histfit (ax, poissrnd (2, 1000, 1), 10, "Poisson"); +%! unwind_protect_cleanup +%! close (hf); +%! end_unwind_protect +%!test +%! hf = figure ("visible", "off"); +%! unwind_protect +%! ax = gca (); +%! histfit (ax, betarnd (3, 10, 1000, 1), 10, "beta"); +%! unwind_protect_cleanup +%! close (hf); +%! end_unwind_protect ## Test input validation -%!error histfit (); -%!error histfit ([x',x']); +%!test +%! hf = figure ("visible", "off"); +%! unwind_protect +%! ax = axes ("parent", hf); +%! fail ("histfit (ax)", "histfit: too few input arguments."); +%! unwind_protect_cleanup +%! close (hf); +%! end_unwind_protect +%!error<histfit: X must be a numeric vector of real numbers.> ... +%! histfit ('wer') +%!error<histfit: no data in X.> histfit ([NaN, NaN, NaN]); +%!error<histfit: NBINS must be a real scalar integer value.> ... +%! histfit (randn (100, 1), 5.6) +%!error<histfit: DISTNAME must be a character vector.> ... +%! histfit (randn (100, 1), 8, 5) +%!error<histfit: DISTNAME must be a character vector.> ... +%! histfit (randn (100, 1), 8, {'normal'}) +%!error<histfit: 'Kernel' distribution is not supported yet.> ... +%! histfit (randn (100, 1), 8, 'Kernel') +%!error<histfit: unrecognized distribution name.> ... +%! histfit (randn (100, 1), 8, 'ASDASDASD') diff --git a/inst/normplot.m b/inst/normplot.m index e9bfdcd..ff1092d 100644 --- a/inst/normplot.m +++ b/inst/normplot.m @@ -28,7 +28,7 @@ ## ## @code{@var{h} = normplot (@var{ax}, @var{x})} takes a handle @var{ax} in ## addition to the data in @var{x} and it uses that axes for ploting. You may -## get this handle of an existing plot with @code{gca}/. +## get this handle of an existing plot with @code{gca}. ## ## The line joing the 1st and 3rd quantile is drawn solid whereas its extensions ## to both ends are dotted. If the underlying distribution is normal, the diff --git a/src/Makefile b/src/Makefile index 719dbe2..2608a6d 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,6 +1,7 @@ # Makefile for compiling required oct files all: + $(MKOCTFILE) editDistance.cc $(MKOCTFILE) libsvmread.cc $(MKOCTFILE) libsvmwrite.cc $(MKOCTFILE) svmpredict.cc svm.cpp svm_model_octave.cc diff --git a/src/editDistance.cc b/src/editDistance.cc new file mode 100644 index 0000000..124e626 --- /dev/null +++ b/src/editDistance.cc @@ -0,0 +1,748 @@ +/*
+Copyright (C) 2024 Andreas Bertsatos <abertsatos@biol.uoa.gr>
+
+This file is part of the statistics package for GNU Octave.
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free Software
+Foundation; either version 3 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+details.
+
+You should have received a copy of the GNU General Public License along with
+this program; if not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <algorithm>
+#include <iostream>
+#include <cmath>
+#include <cstring>
+#include <fstream>
+#include <vector>
+#include <octave/oct.h>
+#include <octave/Cell.h>
+#include <octave/parse.h>
+
+using namespace std;
+
+struct UniqueVecOut
+{
+ ColumnVector IA;
+ ColumnVector IC;
+ Cell IA_c;
+};
+ +// Function for computing the minimum of three integer values
+int minimum (int a, int b, int c)
+{
+ int min = a;
+ if (b < min) min = b;
+ if (c < min) min = c;
+ return min;
+}
+
+// Function for computing the Levenshtein distance between two strings
+int LevensDistStr (const string& s1, const string& s2)
+{
+ const int rows = s1.length();
+ const int cols = s2.length();
+ vector<int> curr(cols+1, 0);
+ int prev;
+ // Prepopulate 1st column
+ for (int j = 0; j <= cols; j++)
+ {
+ curr[j] = j;
+ }
+ // Compute all other elements in distance matrix
+ for (int i = 1; i <= rows; i++)
+ {
+ prev = curr[0];
+ curr[0] = i;
+ for (int j = 1; j <= cols; j++)
+ {
+ int temp = curr[j];
+ if (s1[i - 1] == s2[j - 1])
+ {
+ curr[j] = prev;
+ }
+ else
+ {
+ curr[j] = 1 + minimum (prev, curr[j - 1], curr[j]);
+ }
+ prev = temp;
+ }
+ }
+ return curr[cols];
+}
+
+// Function for computing the Levenshtein distance between two documents
+int LevensDistDoc (const Cell& d1, const Cell& d2)
+{
+ const int rows = d1.numel();
+ const int cols = d2.numel();
+ vector<int> curr(cols+1, 0);
+ int prev;
+ // Prepopulate 1st column
+ for (int j = 0; j <= cols; j++)
+ {
+ curr[j] = j;
+ }
+ // Compute all other elements in distance matrix
+ for (int i = 1; i <= rows; i++)
+ {
+ prev = curr[0];
+ curr[0] = i;
+ for (int j = 1; j <= cols; j++)
+ {
+ int temp = curr[j];
+ if (d1(i - 1).string_value() == d2(i - 1).string_value())
+ {
+ curr[j] = prev;
+ }
+ else
+ {
+ curr[j] = 1 + minimum (prev, curr[j - 1], curr[j]);
+ }
+ prev = temp;
+ }
+ }
+ return curr[cols];
+}
+
+// Transform a distance triu matric to a boolean triu matrix
+boolMatrix double2bool (const Matrix& D, const int& minDist)
+{
+ const int sz = D.rows();
+ boolMatrix Bmat(sz, sz);
+ for (octave_idx_type i = 0; i < sz - 1; i++)
+ {
+ Bmat(i,i) = true;
+ for (octave_idx_type j = i + 1; j < sz; j++)
+ {
+ if (D(i,j) <= minDist)
+ {
+ Bmat(i,j) = true;
+ Bmat(j,i) = false;
+ }
+ else
+ {
+ Bmat(i,j) = false;
+ Bmat(j,i) = false;
+ }
+ }
+ }
+ Bmat(sz - 1,sz - 1) = true;
+ return Bmat;
+}
+
+// Transform a distance triu matric to a distance vector
+Matrix triu2Dvec (const Matrix& D)
+{
+ const int szA = D.rows();
+ const int sz = szA * (szA - 1) / 2;
+ octave_idx_type idx = 0;
+ Matrix Dvec(sz, 1);
+ for (octave_idx_type i = 0; i < szA - 1; i++)
+ {
+ for (octave_idx_type j = i + 1; j < szA; j++)
+ {
+ Dvec(idx++,0) = D(i,j);
+ }
+ }
+ return Dvec;
+}
+
+// Compute unique indexing IA cell of vectors
+vector<vector<int>> IAcellvec (const boolMatrix& B)
+{
+ int rows = B.rows();
+ int cols = B.columns();
+ vector<vector<int>> IAcell;
+ for (int i = 0; i < rows; i++)
+ {
+ vector<int> IA_cIdx;
+ IA_cIdx.push_back(i);
+ for (int j = i + 1; j < cols; j++)
+ {
+ if (B(i,j))
+ {
+ IA_cIdx.push_back(j);
+ }
+ }
+ IAcell.push_back(IA_cIdx);
+ }
+ return IAcell;
+}
+
+// Transform to IAcellvec to Cell
+Cell IA2cell (const vector<vector<int>>& IAc, const vector<int>& IAv)
+{
+ Cell IA(IAv.size(), 1);
+ for (octave_idx_type i = 0; i < IAv.size(); i++)
+ {
+ int idx = IAv[i];
+ Matrix IAidx(IAc[idx].size(), 1);
+ for (octave_idx_type j = 0; j < IAc[idx].size(); j++)
+ {
+ IAidx(j,0) = IAc[idx][j] + 1;
+ }
+ IA(i,0) = IAidx;
+ }
+ return IA;
+}
+
+// Compute unique indexing IA vector
+vector<int> IAvector (const vector<vector<int>>& IAcell)
+{
+ vector<int> IA;
+ vector<int> IA_done;
+ for (int i = 0; i < IAcell.size(); i++)
+ {
+ for (int j = 0; j < IAcell[i].size(); j++)
+ {
+ if (binary_search(IA_done.begin(), IA_done.end(), IAcell[i][j]))
+ {
+ break;
+ }
+ else
+ {
+ if (j == 0)
+ {
+ IA.push_back(IAcell[i][j]);
+ }
+ else
+ {
+ IA_done.push_back(IAcell[i][j]);
+ }
+ }
+ }
+ sort (IA_done.begin(), IA_done.end());
+ }
+ return IA;
+}
+
+// Transform to IAvector to Matrix
+Matrix IA2mat (const vector<int>& IAv)
+{
+ Matrix IA(IAv.size(), 1);
+ for (octave_idx_type i = 0; i < IAv.size(); i++)
+ {
+ IA(i,0) = IAv[i] + 1;
+ }
+ return IA;
+}
+
+// Compute unique indexing IA vector
+Matrix ICvector (const vector<vector<int>>& IAc, const int& szA)
+{
+ Matrix IC(szA, 1);
+ vector<int> IC_done;
+ for (int i = 0; i < IAc.size(); i++)
+ {
+ for (int j = 0; j < IAc[i].size(); j++)
+ {
+ if (binary_search(IC_done.begin(), IC_done.end(), IAc[i][j]))
+ {
+ break;
+ }
+ else
+ {
+ octave_idx_type idx = IAc[i][j];
+ IC(idx,0) = i + 1;
+ IC_done.push_back(IAc[i][j]);
+ }
+ }
+ }
+ return IC;
+}
+
+// Functionality for uniquetol
+octave_value_list uniquetol (const int& nargout, const Cell& A, const Matrix& D,
+ const int& minDist, const bool& OutputAllIndices)
+{
+ octave_value_list retval (nargout);
+ boolMatrix B = double2bool (D, minDist);
+ vector<vector<int>> IAc = IAcellvec (B);
+ vector<int> IAv = IAvector (IAc);
+ // Build cellstr with unique elements
+ Cell C(IAv.size(), 1);
+ if (A.iscellstr())
+ {
+ for (octave_idx_type i = 0; i < IAv.size(); i++)
+ {
+ C(i,0) = A(IAv[i]).string_value();
+ }
+ }
+ else
+ {
+ for (octave_idx_type i = 0; i < IAv.size(); i++)
+ {
+ C(i,0) = A.elem(IAv[i]);
+ }
+ }
+ retval(0) = C;
+ // Build IA vector output
+ if (nargout > 1 && OutputAllIndices)
+ {
+ retval(1) = IA2cell (IAc, IAv);
+ }
+ else if (nargout > 1)
+ {
+ retval(1) = IA2mat (IAv);
+ }
+ // Build IC vector output
+ if (nargout > 2)
+ {
+ retval(2) = ICvector (IAc, A.numel());
+ }
+ return retval;
+}
+
+// Expand a cell scalar to a cell vector
+Cell expand (const Cell& IN, const int& sz)
+{
+ //octave_idx_type sz = static_cast<int>(sz_out);
+ Cell OUT(sz, 1);
+ for (octave_idx_type i = 0; i < sz; i++)
+ {
+ OUT(i,0) = IN.elem(0);
+ }
+ return OUT;
+}
+
+DEFUN_DLD(editDistance, args, nargout,
+ "-*- texinfo -*-\n\
+ @deftypefn {statistics} {@var{d} =} editDistance (@var{str})\n\
+ @deftypefnx {statistics} {@var{d} =} editDistance (@var{doc})\n\
+ @deftypefnx {statistics} {@var{C} =} editDistance (@dots{}, @var{minDist})\n\
+ @deftypefnx {statistics} {[@var{C}, @var{IA}, @var{IC}] =} editDistance @\
+ (@dots{}, @var{minDist})\n\
+ @deftypefnx {statistics} {[@var{C}, @var{IA}, @var{IC}] =} editDistance @\
+ (@dots{}, @var{minDist}, @qcode{\"OutputAllIndices\"}, @var{value})\n\
+ @deftypefnx {statistics} {@var{d} =} editDistance (@var{str1}, @var{str2})\n\
+ @deftypefnx {statistics} {@var{d} =} editDistance (@var{doc1}, @var{doc2})\n\
+\n\
+\n\
+Compute the edit (Levenshtein) distance between strings or documents. \
+\n\n\
+@code{@var{d} = editDistance (@var{str})} takes a cell array of character \
+vectors and computes the Levenshtein distance between each pair of strings in \
+@var{str} as the lowest number of grapheme insertions, deletions, and \
+substitutions required to convert string @qcode{@var{str}@{1@}} to string \
+@qcode{@var{str}@{2@}}. If @var{str} is a @qcode{cellstr} vector with \
+@math{N} elements, the returned distance @var{d} is an @math{(N * (N-1)) / 2)} \
+column vector of doubles. If @var{str} is an array (that is @code{all (size \
+(str) > 1) = true}), then it is transformed to a column vector as in \
+@code{str = str(:)}. @code{editDistance} expects @var{str} to be a column \
+vector, if it is row vector, it is transformed to a column vector.\n\n\
+\
+@code{@var{d} = editDistance (@var{doc})} can also take a cell array \
+containing cell arrays of character vectors, in which case each element of \
+@var{doc} is regarded as a document, and the character vector in each element \
+of the cell string array is regarded a token. @code{editDistance} computes \
+the Levenshtein distance between each pair of cell elements in @var{doc} as \
+the lowest number of token insertions, deletions, and substitutions required \
+to convert document @qcode{@var{doc}@{1@}} to document @qcode{@var{doc}@{2@}}. \
+If @var{doc} is a @qcode{cell} vector with @math{N} elements, the distance \
+@var{d} is an @math{(N * (N-1)) / 2)} column vector of doubles. If @var{doc} \
+is an array (that is @code{all (size (doc) > 1) = true}), then it is converted \
+to a column vector as in @code{doc = doc(:)}.\n\n\
+\
+@code{@var{C} = editDistance (@dots{}, @var{minDist})} specifies a minimum \
+distance, @var{minDist}, which is regarded as a similarity threshold between \
+each pair of strings or documents, defined in the previous syntaces. In this \
+case, @code{editDistance} resembles the functionality of the @code{uniquetol} \
+function and returns the unique strings or documents that are similar up to \
+@var{minDist} distance. @var{C} is either a cellstring array or a cell array \
+of cellstrings, depending on the first input argument.\n\n\
+\
+@code{[@var{C}, @var{IA}, @var{IC}] = editDistance (@dots{}, @var{minDist})} \
+also returns index vectors @var{IA} and @var{IC}. Assuming @var{A} contains \
+either strings @var{str} or documents @var{doc} as defined above, @var{IA} \
+is a column vector of indices to the first occurrence of similar elements such \
+that @qcode{@var{C} = @var{A}(@var{IA})}, and @var{IC} is a column vector of \
+indices such that @qcode{@var{A} ~ @var{C}(@var{IC})} where @qcode{~} means \
+that the strings or documents are within the specified distance @var{minDist} \
+of each other.\n\n\
+\
+@code{[@var{C}, @var{IA}, @var{IC}] = editDistance (@dots{}, @var{minDist}, \
+@qcode{\"OutputAllIndices\"}, @var{value})} specifies the type of the second \
+output index @var{IA}. @var{value} must be a logical scalar. When set to \
+@code{true}, @var{IA} is a cell array containing the vectors of indices for \
+ALL elements in @var{A} that are within the specified distance @var{minDist} \
+of each other. Each cell in @var{IA} corresponds to a value in @var{C} and \
+the values in each cell correspond to locations in @var{A}. If @var{value} is \
+set to @code{false}, then @var{IA} is returned as an index vector described in \
+the previous syntax.\n\n\
+\
+@code{@var{d} = editDistance (@var{str1}, @var{str2})} can also take two \
+character vectors, @var{str1} and @var{str2} and compute the Levenshtein \
+distance @var{d} as the lowest number of grapheme insertions, deletions, and \
+substitutions required to convert @var{str1} to @var{str2}. @var{str1} and \
+@var{str2} may also be cellstring arrays, in which case the pairwise distance \
+is computed between @qcode{@var{str1}@{n@}} and @qcode{@var{str1}@{n@}}. The \
+cellstring arrays must be of the same size or scalars, in which case the \
+scalar is expanded to the size of the other cellstring input. The returned \
+distance @var{d} is a column vector with the same number of elements as the \
+cellstring arrays. If @var{str1} or @var{str2} is an array, then it is \
+transformed to a column vector. @code{editDistance} expects both @var{str1} \
+and @var{str2} to be a column vectors, if not, they are transformed into \
+column vectors.\n\n\
+\
+@code{@var{d} = editDistance (@var{doc1}, @var{doc2})} can also take two cell \
+array containing cell arrays of character vectors, in which case each element \
+of @var{doc1} and @var{dos2} is regarded as a document, and the character \
+vector in each element of the cell string array is regarded a token. \
+@code{editDistance} computes the pairwise Levenshtein distance between the \
+of cell elements in @var{doc1} and @var{doc2} as the lowest number of token \
+insertions, deletions, and substitutions required to convert document \
+@qcode{@var{doc1}@{n@}} to document @qcode{@var{doc1}@{n@}}.\n\n\
+@end deftypefn")
+{
+ int nargin = args.length();
+ // Add default options
+ bool OutputAllIndices = false;
+ // Parse Name-Value paired arguments
+ if (nargin > 2 && args(nargin-2).is_string())
+ {
+ string ParamName = "OutputAllIndices";
+ if (args(nargin - 2).string_value() == ParamName)
+ {
+ const int idx = nargin - 1;
+ if (args(idx).islogical() && args(idx).numel() == 1)
+ {
+ const boolMatrix tmp = args(idx).bool_matrix_value();
+ OutputAllIndices = tmp(0);
+ }
+ else
+ {
+ error ("editDistance: value for OutputAllIndices "
+ "must be a logical scalar.");
+ }
+ nargin--;
+ nargin--;
+ }
+ }
+ // Check for invalid number of input arguments
+ if (nargin > 3)
+ {
+ error ("editDistance: too many input arguments.");
+ }
+ // Check for last argument being numeric (minDist)
+ int minDist;
+ bool doMinDist;
+ if (nargin > 1 && args(nargin-1).isnumeric())
+ {
+ // Check minDist input argument
+ if (args(nargin -1 ).numel() != 1)
+ {
+ error ("editDistance: minDist must be a scalar value.");
+ }
+ Matrix tmp = args(nargin - 1).matrix_value();
+ if (tmp(0,0) < 0 || floor (tmp(0,0)) != tmp(0,0))
+ {
+ error ("editDistance: minDist must be a nonnegative integer.");
+ }
+ minDist = static_cast<int>(tmp(0,0));
+ doMinDist = true;
+ nargin--;
+ }
+ else
+ {
+ doMinDist = false;
+ }
+ // Check for invalid number of output arguments
+ if ((nargout > 3 && doMinDist) || (nargout > 1 && ! doMinDist))
+ {
+ error ("editDistance: too many output arguments.");
+ }
+ // Check cases of string arguments
+ octave_value_list retval (nargout);
+ if (nargin == 1)
+ {
+ if (args(0).iscellstr())
+ {
+ // Get cellstr input argument
+ const Cell strA = args(0).cellstr_value();
+ int szA = strA.numel();
+ // For scalar input return distance to itself, i.e. 0
+ if (szA == 1)
+ {
+ retval(0) = double (0);
+ return retval;
+ }
+ // Compute the edit distance
+ Matrix D(szA, szA);
+ #pragma omp parallel
+ {
+ #pragma omp parallel for
+ for (octave_idx_type i = 0; i < szA - 1; i++)
+ {
+ D(i,i) = 0;
+ string s1 = strA(i).string_value();
+ for (octave_idx_type j = i + 1; j < szA; j++)
+ {
+ D(i,j) = LevensDistStr (s1, strA(j).string_value());
+ }
+ }
+ D(szA - 1,szA - 1) = 0;
+ }
+ // If minDist is given, change functionality from 'pdist' to 'uniquetol'
+ if (doMinDist)
+ {
+ retval = uniquetol (nargout, strA, D, minDist, OutputAllIndices);
+ }
+ else
+ {
+ // Transform to distance vector
+ retval(0) = triu2Dvec (D);
+ }
+ return retval;
+ }
+ else if (args(0).iscell())
+ {
+ // Get cell input argument
+ const Cell docA = args(0).cell_value();
+ int szA = docA.numel();
+ // Check that all cell elements contain cellstring arrays
+ for (octave_idx_type i = 0; i < szA - 1; i++)
+ {
+ Cell tmp = docA.elem(i);
+ if (! tmp.iscellstr())
+ {
+ error ("editDistance: tokenizedDocument "
+ "must contain cellstr arrays.");
+ }
+ }
+ // For scalar input return distance to itself, i.e. 0
+ if (szA == 1)
+ {
+ retval(0) = double (0);
+ return retval;
+ }
+ // Compute the edit distance
+ Matrix D(szA, szA);
+ #pragma omp parallel
+ {
+ #pragma omp parallel for
+ for (octave_idx_type i = 0; i < szA - 1; i++)
+ {
+ D(i,i) = 0;
+ Cell d1 = docA.elem(i);
+ for (octave_idx_type j = i + 1; j < szA; j++)
+ {
+ D(i,j) = LevensDistDoc (d1, docA.elem(j));
+ }
+ }
+ D(szA - 1,szA - 1) = 0;
+ }
+ // If minDist is given, change functionality from 'pdist' to 'uniquetol'
+ if (doMinDist)
+ {
+ retval = uniquetol (nargout, docA, D, minDist, OutputAllIndices);
+ }
+ else
+ {
+ // Transform to distance vector
+ retval(0) = triu2Dvec (D);
+ }
+ return retval;
+ }
+ else
+ {
+ error ("editDistance: STR1 must be a cellstr.");
+ }
+ }
+ else if (nargin == 2)
+ {
+ if (args(0).iscellstr() && args(1).iscellstr())
+ {
+ // Get cellstr input arguments
+ Cell strA = args(0).cellstr_value();
+ Cell strB = args(1).cellstr_value();
+ // Check cellstr sizes match
+ int szA = strA.numel();
+ int szB = strB.numel();
+ if (szA != 1 && szB != 1 && szA != szB)
+ {
+ error ("editDistance: cellstr input arguments size mismatch.");
+ }
+ // Preallocate the distance vector and expand as necessary
+ int sz = szA;
+ if (szA == 1 && szB != 1)
+ {
+ sz = szB;
+ strA = expand (strA, sz);
+ }
+ else if (szA != 1 && szB == 1)
+ {
+ strB = expand (strB, sz);
+ }
+ Matrix D(sz, 1);
+ // Compute the distance vector
+ for (octave_idx_type i = 0; i < sz; i++)
+ {
+ D(i,0) = LevensDistStr (strA(i).string_value(), strB(i).string_value());
+ }
+ retval(0) = D;
+ }
+ else if (args(0).iscell() && args(1).iscell())
+ {
+ // Get cell input arguments
+ Cell docA = args(0).cell_value();
+ Cell docB = args(1).cell_value();
+ // Check cell sizes match
+ int szA = docA.numel();
+ int szB = docB.numel();
+ if (szA != 1 && szB != 1 && szA != szB)
+ {
+ error ("editDistance: cellstr input arguments size mismatch.");
+ }
+ // Check both cell arrays contain cellstring arrays
+ for (octave_idx_type i = 0; i < szA - 1; i++)
+ {
+ Cell tmp = docA.elem(i);
+ if (! tmp.iscellstr())
+ {
+ error ("editDistance: first tokenizedDocument "
+ "does not contain cellstr arrays.");
+ }
+ }
+ for (octave_idx_type i = 0; i < szB - 1; i++)
+ {
+ Cell tmp = docB.elem(i);
+ if (! tmp.iscellstr())
+ {
+ error ("editDistance: second tokenizedDocument "
+ "does not contain cellstr arrays.");
+ }
+ }
+ // Preallocate the distance vector and expand as necessary
+ int sz = szA;
+ if (szA == 1 && szB != 1)
+ {
+ sz = szB;
+ docA = expand (docA, sz);
+ }
+ else if (szA != 1 && szB == 1)
+ {
+ docB = expand (docB, sz);
+ }
+ Matrix D(sz, 1);
+ // Compute the distance vector
+ for (octave_idx_type i = 0; i < sz; i++)
+ {
+ D(i,0) = LevensDistDoc (docA.elem(i), docB.elem(i));
+ }
+ retval(0) = D;
+ }
+ else if (args(0).is_string() && args(1).is_string())
+ {
+ retval(0) = LevensDistStr (args(0).string_value(),args(1).string_value());
+ }
+ else
+ {
+ error ("editDistance: STR1 and STR2 must be either strings or cellstr.");
+ }
+ }
+ return retval;
+}
+
+/*
+%!error <editDistance: too many input arguments.> d = editDistance (1, 2, 3, 4);
+%!error <editDistance: too many output arguments.> ...
+%! [C, IA, IC, I] = editDistance ({"AS","SD","AD"}, 1);
+%!error <editDistance: too many output arguments.> ...
+%! [C, IA] = editDistance ({"AS","SD","AD"});
+%!error <editDistance: minDist must be a scalar value.> ...
+%! d = editDistance ({"AS","SD","AD"}, [1, 2]);
+%!error <editDistance: minDist must be a nonnegative integer.> ...
+%! d = editDistance ({"AS","SD","AD"}, -2);
+%!error <editDistance: minDist must be a nonnegative integer.> ...
+%! d = editDistance ({"AS","SD","AD"}, 1.25);
+%!error <editDistance: minDist must be a scalar value.> ...
+%! d = editDistance ({"AS","SD","AD"}, {"AS","SD","AD"}, [1, 2]);
+%!error <editDistance: minDist must be a nonnegative integer.> ...
+%! d = editDistance ({"AS","SD","AD"}, {"AS","SD","AD"}, -2);
+%!error <editDistance: minDist must be a nonnegative integer.> ...
+%! d = editDistance ({"AS","SD","AD"}, {"AS","SD","AD"}, 1.25);
+%!error <editDistance: minDist must be a scalar value.> ...
+%! d = editDistance ("string1", "string2", [1, 2]);
+%!error <editDistance: minDist must be a nonnegative integer.> ...
+%! d = editDistance ("string1", "string2", -2);
+%!error <editDistance: minDist must be a nonnegative integer.> ...
+%! d = editDistance ("string1", "string2", 1.25);
+%!error <editDistance: tokenizedDocument must contain cellstr arrays.> ...
+%! d = editDistance ({{"string1", "string2"}, 2});
+%!error <editDistance: tokenizedDocument must contain cellstr arrays.> ...
+%! d = editDistance ({{"string1", "string2"}, 2}, 2);
+%!error <editDistance: STR1 must be a cellstr.> ...
+%! d = editDistance ([1, 2, 3]);
+%!error <editDistance: STR1 must be a cellstr.> ...
+%! d = editDistance (["AS","SD","AD","AS"]);
+%!error <editDistance: STR1 must be a cellstr.> ...
+%! d = editDistance (["AS","SD","AD"], 2);
+%!error <editDistance: STR1 and STR2 must be either strings or cellstr.> ...
+%! d = editDistance (logical ([1,2,3]), {"AS","AS","AD"});
+%!error <editDistance: STR1 and STR2 must be either strings or cellstr.> ...
+%! d = editDistance ({"AS","SD","AD"}, logical ([1,2,3]));
+%!error <editDistance: STR1 and STR2 must be either strings or cellstr.> ...
+%! d = editDistance ([1,2,3], {"AS","AS","AD"});
+%!error <editDistance: first tokenizedDocument does not contain cellstr arrays.> ...
+%! d = editDistance ({1,2,3}, {"AS","SD","AD"});
+%!error <editDistance: second tokenizedDocument does not contain cellstr arrays.> ...
+%! d = editDistance ({"AS","SD","AD"}, {1,2,3});
+%!error <editDistance: cellstr input arguments size mismatch.> ...
+%! d = editDistance ({"AS","SD","AD"}, {"AS", "AS"});
+%!test
+%! d = editDistance ({"AS","SD","AD"});
+%! assert (d, [2; 1; 1]);
+%! assert (class (d), "double");
+%!test
+%! C = editDistance ({"AS","SD","AD"}, 1);
+%! assert (iscellstr (C), true);
+%! assert (C, {"AS";"SD"});
+%!test
+%! [C, IA] = editDistance ({"AS","SD","AD"}, 1);
+%! assert (class (IA), "double");
+%! assert (IA, [1;2]);
+%!test
+%! A = {"ASS"; "SDS"; "FDE"; "EDS"; "OPA"};
+%! [C, IA] = editDistance (A, 2, "OutputAllIndices", false);
+%! assert (class (IA), "double");
+%! assert (A(IA), C);
+%!test
+%! A = {"ASS"; "SDS"; "FDE"; "EDS"; "OPA"};
+%! [C, IA] = editDistance (A, 2, "OutputAllIndices", true);
+%! assert (class (IA), "cell");
+%! assert (C, {"ASS"; "FDE"; "OPA"});
+%! assert (A(IA{1}), {"ASS"; "SDS"; "EDS"});
+%! assert (A(IA{2}), {"FDE"; "EDS"});
+%! assert (A(IA{3}), {"OPA"});
+%!test
+%! A = {"ASS"; "SDS"; "FDE"; "EDS"; "OPA"};
+%! [C, IA, IC] = editDistance (A, 2);
+%! assert (class (IA), "double");
+%! assert (A(IA), C);
+%! assert (IC, [1; 1; 3; 1; 5]);
+%!test
+%! d = editDistance ({"AS","SD","AD"}, {"AS", "AD", "SE"});
+%! assert (d, [0; 1; 2]);
+%! assert (class (d), "double");
+%!test
+%! d = editDistance ({"AS","SD","AD"}, {"AS"});
+%! assert (d, [0; 2; 1]);
+%! assert (class (d), "double");
+%!test
+%! d = editDistance ({"AS"}, {"AS","SD","AD"});
+%! assert (d, [0; 2; 1]);
+%! assert (class (d), "double");
+%!test
+%! b = editDistance ("Octave", "octave");
+%! assert (b, 1);
+%! assert (class (b), "double");
+*/
|