Simulation Commands - Maple Programming Help

Home : Support : Online Help : Statistics and Data Analysis : Statistics Package : Simulation : Statistics/Simulation

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[\begin{array}{c}{\mathrm{1 .. 1000}}{\mathrm{Vector}}{[}{\mathrm{row}}{]}\\ {\mathrm{Data Type:}}{\mathrm{float}}{[}{8}{]}\\ {\mathrm{Storage:}}{\mathrm{rectangular}}\\ {\mathrm{Order:}}{\mathrm{Fortran_order}}\end{array}\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.282164906730844}{,}{0.00399251392902761747}\right]$ (2)
 > $\mathrm{Bootstrap}\left(\mathrm{Mean},A,\mathrm{replications}=1000,\mathrm{output}=\left['\mathrm{value}','\mathrm{standarderror}'\right]\right)$
 $\left[{0.275105910864221}{,}{0.00381911787834478744}\right]$ (3)

Compare this with analytic results.

 > $\mathrm{Mean}\left(X\right)$
 ${4790016000}{}{{ⅇ}}^{{-}{1}}{-}{1762148409}$ (4)
 > $\mathrm{evalf}[30]\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[\begin{array}{c}{\mathrm{1 .. 100000}}{\mathrm{Vector}}{[}{\mathrm{row}}{]}\\ {\mathrm{Data Type:}}{\mathrm{float}}{[}{8}{]}\\ {\mathrm{Storage:}}{\mathrm{rectangular}}\\ {\mathrm{Order:}}{\mathrm{Fortran_order}}\end{array}\right]$ (9)