Interview Query

Truncated Distribution

Start Timer

0:00:00

Upvote
6
Downvote
Save question
Mark as completed
View comments (8)
Next question

Given a percentile_threshold, mean m, and standard deviation sd of the normal distribution, write a function truncated_dist to simulate a normal distribution truncated at percentile_threshold.

Example:

Input:

m = 2
sd = 1
n = 6
percentile_threshold = 0.75

Output:

def truncated_dist(m,sd,percentile_threshold): ->

 [2, 1.1, 2.2, 3, 1.5, 1.3]

All values in the output sample are in the lower 75% = percentile_threshold of the distribution.

.
.
.
.
.


Comments

Loading comments...