Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Nov 05, 2018
10:47 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Nov 05, 2018
10:47 AM

Truncate Array to Count out of Range Results | Monte Carlo

Hello Community,

I have a worksheet running Monte Carlo simulation where I look at the output array and calculate a mean and standard deviation. I would like to use those results to calculate the number of simulations where the result was out of a range. For example, calculate the number of results than are more than 3 standard deviations from the mean. I can write "for" loops to do this work, but I feel like there might be a more elegant way to "throw out" out of range elements of an array.

Solved! Go to Solution.

1 ACCEPTED SOLUTION

Accepted Solutions

Nov 06, 2018
08:31 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Nov 06, 2018
08:31 AM

Luc, your use of the SUM tool got me thinking of combining it with Booleans operators.

Looks like there is a highly compacted way to do this when we combine both. Thanks for the feedback!

5 REPLIES 5

Nov 05, 2018
11:54 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Nov 05, 2018
11:54 AM

Yes, there is a smart way, without writing for loops:

Above is the function that counts all values below -0.7.

To count all values above 0.7, change -0.7 to 0.7 and change "lt" to "gt". That results in an error message, because there is no such value. So you have to make sure that there are values in the region you want to count.

Success!

Luc

Nov 05, 2018
12:07 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Nov 06, 2018
08:31 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Nov 06, 2018
08:31 AM

Luc, your use of the SUM tool got me thinking of combining it with Booleans operators.

Looks like there is a highly compacted way to do this when we combine both. Thanks for the feedback!

Nov 06, 2018
05:25 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Nov 06, 2018
05:25 PM

Smart!

Nov 05, 2018
04:43 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Nov 05, 2018
04:43 PM

For example, calculate the number of results than are more than 3 standard deviations from the mean. I can write "for" loops to do this work, but I feel like there might be a more elegant way to "throw out" out of range elements of an array.

If your goal is to just count the out of range elements you may use Lucs method.

If your goal is to "throw out" those elements and keeps the rest in a smaller vector you may use a combination of "Match" and "trim".