# Usage In SyScSelection: Systematic Scenario Selection for Stress Testing

```knitr::opts_chunk\$set(
collapse = TRUE,
comment = "#>"
)
```
```library(SyScSelection)
```

### Example ellipsodial mesh for a normal distribution:

• Estimate the mean and covariance matrix from the data:
`mu <- colMeans(data)`
`sig <- cov(data)`

• The number of dimensions, d, is taken directly from the data:
`d <- length(data[1,])`

• Get the size parameter for a normal dist’n at a 95% threshold:
`calpha <- sizeparam_normal_distn(.95, d)`

• Create a hyperellipsoid object. Note that the constructor takes the inverse of the disperion matrix:
`hellip <- hyperellipsoid(mu, solve(sig), calpha)`

• Scenarios are calculated as a mesh of fineness 3. The number of scenarios is a function of the dimensionality of the hyperellipsoid and the fineness of the mesh:
`scenarios <- hypercube_mesh(3, hellip)`

### Example ellipsodial mesh for a t distribution:

• Estimate the mean, covariance, and degrees of freedom from the data:
`mu <- colMeans(data)`
`sig <- cov(data)`
`nu <- dim(data) - 1`

• The number of dimensions, d, is taken directly from the data:
`d <- length(data[1,])`

• Get the size parameter for a normal dist’n at a 95% threshold:
`calpha <- sizeparam_t_distn(.95, d, nu)`

• Create a hyperellipsoid object. Note that the constructor takes the inverse of the disperion matrix:
`hellip <- hyperellipsoid(mu, solve(sig), calpha)`

• Scenarios are calculated as a mesh of fineness 3. The number of scenarios is a function of the dimensionality of the hyperellipsoid and the fineness of the mesh:
`scenarios <- hypercube_mesh(3, hellip)`

## Try the SyScSelection package in your browser

Any scripts or data that you put into this service are public.

SyScSelection documentation built on Oct. 26, 2020, 5:08 p.m.