Overview - Maple Help

# Online Help

###### All Products    Maple    MapleSim

Simulation Commands

 The Statistics package provides optimized algorithms for simulating from all supported distributions as well as tools for creating custom random number generators, parametric and non-parametric bootstrap.

 compute bootstrap statistics sample a kernel density estimate generate random sample

Examples

 > $\mathrm{with}\left(\mathrm{Statistics}\right):$

Generate random sample drawn from the non-central beta distribution.

 > $X≔\mathrm{RandomVariable}\left(\mathrm{NonCentralBeta}\left(3,10,2\right)\right):$
 > $A≔\mathrm{Sample}\left(X,1000\right)$
 ${A}{≔}\left[{0.298749038049262}{,}{0.160496089457820}{,}{0.324127131506297}{,}{0.290206966234071}{,}{0.537220813028702}{,}{0.225806784723962}{,}{0.323656644296660}{,}{0.224075578813581}{,}{0.139203619269065}{,}{0.144713788483976}{,}{0.162170989508424}{,}{0.163919547946135}{,}{0.404909255935277}{,}{0.412044080355721}{,}{0.348094710719217}{,}{0.331157628015845}{,}{0.295105552445666}{,}{0.193177607186590}{,}{0.400373007871060}{,}{0.130898465329786}{,}{0.195185443150392}{,}{0.376386657719254}{,}{0.0871782064096334}{,}{0.251491595894991}{,}{0.620308537159290}{,}{0.277296883006483}{,}{0.437779720079008}{,}{0.152921471824328}{,}{0.235265960512657}{,}{0.136378679376410}{,}{0.252714543040837}{,}{0.429187139161412}{,}{0.374226424815941}{,}{0.302801012538073}{,}{0.154684837824354}{,}{0.356035545600185}{,}{0.364686121969868}{,}{0.222026138646806}{,}{0.416210165850863}{,}{0.190871901430894}{,}{0.303495622736175}{,}{0.388708191892459}{,}{0.0738816418814309}{,}{0.202500852820107}{,}{0.104659380876615}{,}{0.354257658106483}{,}{0.208477128105665}{,}{0.382524697999167}{,}{0.176268646694049}{,}{0.120614541942356}{,}{0.183628521334067}{,}{0.105348882457644}{,}{0.322876552017316}{,}{0.199044448794066}{,}{0.351886259492336}{,}{0.541017418216111}{,}{0.400262939648824}{,}{0.289634276207489}{,}{0.136612348557671}{,}{0.429606223713469}{,}{0.311378762025564}{,}{0.237936821359705}{,}{0.172682713203868}{,}{0.587851925462311}{,}{0.222871011457330}{,}{0.107369139160512}{,}{0.389056233892129}{,}{0.345966852569480}{,}{0.284198344230638}{,}{0.149470287155729}{,}{0.328740299838745}{,}{0.265539779603986}{,}{0.156255385188462}{,}{0.329479875992677}{,}{0.257023076440196}{,}{0.240540840738284}{,}{0.182587825634373}{,}{0.426257901690903}{,}{0.104729408184404}{,}{0.232881839115843}{,}{0.305170632862252}{,}{0.145058470328692}{,}{0.261365502435354}{,}{0.0936526620439586}{,}{0.225512556744244}{,}{0.270964742331662}{,}{0.350022007063060}{,}{0.261919227464596}{,}{0.230771541043555}{,}{0.337509810728467}{,}{0.156134695828703}{,}{0.410821484550497}{,}{0.0689142635904654}{,}{0.142203876621286}{,}{0.286281908777234}{,}{0.251579621833158}{,}{0.193769396232071}{,}{0.138728250394330}{,}{0.100386830245882}{,}{0.350686151055232}{,}{\dots }{,}{\text{⋯ 900 row vector entries not shown}}\right]$ (1)

Use the bootstrap to estimate the mean and the standard error of the mean.

 > $\mathrm{Bootstrap}\left(\mathrm{Mean},X,\mathrm{replications}=1000,\mathrm{output}=\left['\mathrm{value}','\mathrm{standarderror}'\right]\right)$
 $\left[{0.282229356166131}{,}{0.00399644288773034952}\right]$ (2)
 > $\mathrm{Bootstrap}\left(\mathrm{Mean},A,\mathrm{replications}=1000,\mathrm{output}=\left['\mathrm{value}','\mathrm{standarderror}'\right]\right)$
 $\left[{0.275083017014237}{,}{0.00384426186874453797}\right]$ (3)

Compare this with analytic results.

 > $\mathrm{Mean}\left(X\right)$
 ${-}{1762148409}{+}{4790016000}{}{{ⅇ}}^{{-1}}$ (4)
 > $\mathrm{evalf}\left[30\right]\left(\mathrm{Mean}\left(X\right)\right)$
 ${0.28226746351970438745}$ (5)
 > $\mathrm{Mean}\left(X,\mathrm{numeric}\right)$
 ${0.2822674635}$ (6)

Random sample involving two independent random variables.

 > $Y≔\mathrm{RandomVariable}\left(\mathrm{Cauchy}\left(0,1\right)\right)$
 ${Y}{≔}{\mathrm{_R0}}$ (7)
 > $Z≔\mathrm{RandomVariable}\left(\mathrm{Cauchy}\left(1,2\right)\right)$
 ${Z}{≔}{\mathrm{_R1}}$ (8)
 > $B≔\mathrm{Sample}\left({Y}^{2}+{Z}^{2},{10}^{5}\right)$
 ${B}{≔}\left[{8.23027702966309}{,}{2.45150974710626}{,}{45.2464988258304}{,}{1.23619182280984}{,}{12.3761324894683}{,}{3.21707384976341}{,}{273.615015693467}{,}{5.96219698844479}{,}{0.860431105271889}{,}{0.305122978658424}{,}{7.52920327212682}{,}{2.07256467494591}{,}{10.8070815024917}{,}{0.394430182726394}{,}{19.3647570921962}{,}{0.461755743457343}{,}{6.24947599300303}{,}{35.9864514138204}{,}{2.67450203582295}{,}{1.11744947782124}{,}{195.557563933831}{,}{0.0208535989823628}{,}{3.30404958487121}{,}{14.7641389037312}{,}{68.2019138584949}{,}{7.13908974267329}{,}{21.4868999654586}{,}{112.153409360027}{,}{20.0821006324119}{,}{1.00955124266587}{,}{22.6997643045565}{,}{301.588167115830}{,}{9.08732884165008}{,}{1428.69647130412}{,}{106.801064245015}{,}{34.6040182577412}{,}{42.3065232455375}{,}{1.46416572945411}{,}{27.6371248343772}{,}{6.19919326889794}{,}{631.357700920488}{,}{9.66358067072234}{,}{2.72451268812064}{,}{15.8651635674137}{,}{25.9561529493941}{,}{85658.4898234459}{,}{3.59006552648215}{,}{721.450092993733}{,}{7.44843615212807}{,}{32.8907665534797}{,}{69.9386364891994}{,}{19.8179826337963}{,}{14.6471711656540}{,}{140.991079663595}{,}{4.44992272594081}{,}{118.929896846639}{,}{9.23111260596482}{,}{79.9062905993280}{,}{49.8924022414821}{,}{0.171457515992941}{,}{66.5417981810520}{,}{388.930721959224}{,}{2.76608294543268}{,}{2758.95321626323}{,}{8.07598807653631}{,}{8.84264595290888}{,}{107.144002184456}{,}{10.3110572416457}{,}{7.41556584460897}{,}{53.1177020373101}{,}{0.00322764364053573}{,}{219.543615893359}{,}{77.1015624199154}{,}{2.71494708348748}{,}{47.4094889091689}{,}{17559.9273444821}{,}{581.720994705186}{,}{4.28944838265206}{,}{13.3850469840742}{,}{6.87480101410390}{,}{49.3806015960269}{,}{4.62774610319884}{,}{128.008178020047}{,}{1.01250372667289}{,}{0.469692691233665}{,}{1.90436257347381}{,}{243.474478532672}{,}{1859.63495612918}{,}{44.1125836419248}{,}{28.6650544559048}{,}{25.8410892746042}{,}{176.549384396297}{,}{68.1964282117659}{,}{3.03672275380763}{,}{0.356483987731506}{,}{27.7072541434004}{,}{6.33505376468536}{,}{45.4290425286688}{,}{1.89815660635712}{,}{239.483036353238}{,}{\dots }{,}{\text{⋯ 99900 row vector entries not shown}}\right]$ (9)

 See Also