Secretary Problem

DESCRIPTION

The secretary problem is a useful model to study several real-life scenarios. While the classic example is dealing with interviewing, the similar decision making is relevant in other life situations - for example dating.

The problem is as follows. Lets say that you have to interview 100 candidates who come in at random order. After evaluating each candidate with a numeric score, you need to decide whether to fill the position or to pass the candidate. What is a strategy that maximizes the probability of finding the best candidate? Also, what is the probability that we can even find the best candidate?

You can run the simulations to try to figure it out. Lets say that you reject the first 10 candidates, and then the first candidate with a score larger than what you have seen so far in the first 10 candidates is accepted. How will that perform? Should you wait and reject more than the first 10? Or should you decide even faster to hire?

Play around by changing how many to reject and you will see that the average(results) will go up or down. See if you can roughly find where the sweet spot is between passing a lot of initial candidates and making a decision to hire!

** Help **

sample(outcomes, probabilities)

Sample an outcome from the outcomes array based on the corresponding probabilities in the probabilities array.

average(values)

Returns the average of the values in the array. It can be handy to store the values of metrics from each simulation run and average it across all runs to obtain an estimate of the metric.

error_average(values)

Returns the estimated error (1.96 x standard error) of the average of the values at 95% confidence. In simple terms, you can assume that the estimate average(values) has error bounds +/- error_average(values). It can be handy to store the values of metrics from each simulation run and estimate both the average and the error of the average across all runs.

stdev(values)

Returns the standard deviation of the values in the passed in array.

radiobutton(name, options)

Creates a radio button parameter with name and have each option in the options array selectable. Returns the selected option.

textbox(name, default_value)

Create a textbox parameter with name and a required default value. Returns the value of the textbox.

scatter_graph(data, xlabel, ylabel)

Create a graph based on a data array and plot (data.xlabel, data.ylabel) on it. Can also pass xmin=null, xmax=null, ymin=null, ymax=null as added arguments.

stop_simulation()

Calling this function, stops the simulation.