---
title: "Usage"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{my-vignette}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
```

```{r setup}
library(SyScSelection)
```

### Example ellipsodial mesh for a normal distribution:
- Estimate the mean and covariance matrix from the data:<br />
```mu <- colMeans(data)```<br />
```sig <- cov(data)```

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

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

- Create a hyperellipsoid object. Note that the constructor takes the **inverse of the disperion matrix**:<br />
```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:<br />
```scenarios <- hypercube_mesh(3, hellip)```

### Example ellipsodial mesh for a t distribution:
- Estimate the mean, covariance, and degrees of freedom from the data:<br />
```mu <- colMeans(data)```<br />
```sig <- cov(data)```<br />
```nu <- dim(data)[1] - 1```

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

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

- Create a hyperellipsoid object. Note that the constructor takes the **inverse of the disperion matrix**:<br />
```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:<br />
```scenarios <- hypercube_mesh(3, hellip)```