# BOOTSTRAP

## Description

Bootstrap simulation method samples from an empirical dataset typically drawing independent observations with equal probability to reconstruct a new hyptothetical distribution. with BOOTSTRAP, can sample with equal probability or with specified biases in the empirical dataset. This is useful for stress testing and scenario analysis. This function draws from sample with replacement.

## Syntax

The following describes the function signature for use in Microsoft Excel's formula bar.

```excel-formula
=BOOTSTRAP(sample, nPaths, numPeriods, weights, prVector, rndSeed)
```

### Input(s)

| Argument       | Description                                                                                                                                                                                                                              |
| -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **sample**     | Vector or matrix of the sample population data.                                                                                                                                                                                          |
| **nPaths**     | Number of paths to simulate.                                                                                                                                                                                                             |
| **numPeriods** | Number of periods to simulate.                                                                                                                                                                                                           |
| **weights**    | Optional argument. Vector of asset/variable weights to apply to sample. If weights are not specified and sample is multivariate, then **nPaths** will be forced to 1.                                                                    |
| **prVector**   | Optional argument. Probability vector to specifiy the likelihood of sampling from a given period in the sample population. If not specified, this argument defaults to an equal probabilities across all periods (uniform distribution). |
| **rndSeed**    | Optional argument, numeric value to specify random generator seed. If not specified, the random seed is a function of CPU clock.                                                                                                         |

### Output(s)

Bootstrap simulated sample with repetitions. The simulated sample will be `numPeriods` by `nPaths` in size.&#x20;

{% hint style="info" %}
Because Microsoft Excel is in some ways a 2-dimensional application, it is challenging to work with persisting N-dimensional arrays in a presentable form. To accommodate this, we can bootstrap multivariate samples and aggregate the results to a portfolio solution via **weights** and return a 2-dimensional matrix of bootstrapped portfolio values.
{% endhint %}

## Example

{% hint style="warning" %}
Coming soon.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://excelhelp.windhamlabs.com/functions/simulation/bootstrap.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
