```
library("topmodels")
require("distributions3")
set.seed(28)
X <- Empirical(rnorm(50))
X
```

`[1] "Empirical distribution (Min. -2.100, Max. 2.187, N = 50)"`

`mean(X)`

`[1] -0.09838857`

`variance(X)`

`[1] 1.076242`

`skewness(X)`

`[1] 0.1027858`

`kurtosis(X)`

`[1] -0.5339262`

`random(X, 10)`

```
[1] 0.62280108 -1.66020539 -0.06429479 -0.61645815 0.14298835 -1.85883315
[7] -0.82054223 -1.66020539 -0.88294400 -0.43544484
```

`pdf(X, 2)`

`[1] 0.04`

`log_pdf(X, 2)`

`[1] -3.218876`

`cdf(X, 4)`

`[1] 1`

`quantile(X, 0.7)`

`[1] 0.3600124`

```
### example: allowed types/classes of input arguments
## Single vector (will be coerced to numeric)
Y1 <- rnorm(3, mean = -10)
d1 <- Empirical(Y1)
d1
```

`[1] "Empirical distribution (Min. -10.70, Max. -9.95, N = 3)"`

`mean(d1)`

`[1] -10.28573`

```
## Unnamed list of vectors
Y2 <- list(as.character(rnorm(3, mean = -10)),
runif(6),
rpois(4, lambda = 15))
d2 <- Empirical(Y2)
d2
```

```
[1] "Empirical distribution (Min. -10.6917, Max. -8.1584, N = 3)"
[2] "Empirical distribution (Min. 0.2365, Max. 0.8445, N = 6)"
[3] "Empirical distribution (Min. 13.0000, Max. 22.0000, N = 4)"
```

`mean(d2)`

`[1] -9.7327191 0.5375046 17.5000000`

```
## Named list of vectors
Y3 <- list("Normal" = as.character(rnorm(3, mean = -10)),
"Uniform" = runif(6),
"Poisson" = rpois(4, lambda = 15))
d3 <- Empirical(Y3)
d3
```

```
Normal
"Empirical distribution (Min. -11.1410, Max. -8.4768, N = 3)"
Uniform
"Empirical distribution (Min. 0.1372, Max. 0.9940, N = 6)"
Poisson
"Empirical distribution (Min. 16.0000, Max. 22.0000, N = 4)"
```

`mean(d3)`

```
Normal Uniform Poisson
-10.0322492 0.5316866 18.2500000
```

```
## Matrix or data.frame
Y4 <- matrix(rnorm(20), ncol = 5, dimnames = list(sprintf("D_%d", 1:4), sprintf("obs_%d", 1:5)))
d4 <- Empirical(Y4)
d4
```

```
D_1
"Empirical distribution (Min. -0.2841, Max. 1.0164, N = 5)"
D_2
"Empirical distribution (Min. -0.6239, Max. 1.1759, N = 5)"
D_3
"Empirical distribution (Min. -2.3085, Max. 1.7337, N = 5)"
D_4
"Empirical distribution (Min. -1.5264, Max. 2.4897, N = 5)"
```

```
d5 <- Empirical(as.data.frame(Y4))
d5
```

```
obs_1
"Empirical distribution (Min. -2.3085, Max. -0.2841, N = 4)"
obs_2
"Empirical distribution (Min. -1.1744, Max. 1.1759, N = 4)"
obs_3
"Empirical distribution (Min. -0.1304, Max. 2.4897, N = 4)"
obs_4
"Empirical distribution (Min. -1.5264, Max. 1.0164, N = 4)"
obs_5
"Empirical distribution (Min. 0.1128, Max. 1.6950, N = 4)"
```