Description Usage Arguments Value See Also Examples

View source: R/utilityFunctions.R

Wrapper function to simulate data from different distribution with different parameter settings.

1 2 3 4 5 6 7 8 |

`x` |
The number [integer] of observations to simulate. |

`dist` |
Name of distribution [string] from which the observations are drawn. 'norm' is the normal distribution, 'unif' the uniform distribution 'bin' the binomial distribution, "cat_norm" samples categorical variables according to a normal distribution and "cat_unif" according to a uniform distribution. For "cat_norm", length(category)/2 is used mean for the normal distribution unless specified otherwise. |

`m` |
Mean of the normal distribution [double]/the mean between min and max for the uniform distribution [double]/ the rank of the category to be used as mean for "cat_norm" [integer]. |

`std` |
Standard deviation of the normal distribution or the distance of min/max from the mean for the uniform distribution [double]. |

`categories` |
Number of categories [integer] for simulating categorical variables (for distr="cat_norm" or "cat_unif"). |

`prob` |
Probability [double] of success for each trial (for distr="bin"). |

Numeric vector of length [x] with the sampled values

`runif`

, `rnorm`

, `rbinom`

for
documentation of the underlying distributions.

1 2 3 4 5 | ```
normal <- simulateDist(x=10, dist="norm", m=2, std=4)
cat_normal <- simulateDist(x=10, dist="cat_norm", categories=5)
cat_uniform <- simulateDist(x=10, dist="cat_unif", categories=5)
uniform <- simulateDist(x=10, dist="unif", m=4, std=1)
binomial <- simulateDist(x=10, dist="bin", prob=0.4)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.