Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Imagine that you would like to predict if your favorite table will be free at yo

ID: 3203394 • Letter: I

Question

Imagine that you would like to predict if your favorite table will be free at your favorite restau- rant. The only additional piece of information you can collect, however, is if it is sunny or not sunny. You collect paired samples from visit of the form (is sunny, is table free), where it is either sunny (1) or not sunny (0) and the table is either free (1) or not free(0).

(a). How can this be formulated as a maximum likelihood problem?

(b). Assume you have collected data for the last 10 days and computed the maximum likelihood solution to the problem formulated in (a). If it is sunny today, how would you predict if your table will be free?

(c). Imagine now that you could further gather information about if it is morning, afternoon, or evening. How does this change the maximum likelihood problem?

Explanation / Answer

a)

One can think of this situation as a logistic regression problem where not only the dependent variable is a binary variable but at the same time he independent variable also has two class only. Using the theory of least square estimation one can obtain the MLE estimates of intercept and slope which will maximize the likelihood of prediction of the fact that whether a table will be free or not from whether the day is rainy or not.

b)

In the fitted regression model one can use the data obtained for that day in order to predict the result that whether there will be a free table or not.

c)

If one can obtain information about different time of the day they the dependent variable will have more level than the previous independent variable but one can easily use regression model in order to predict the value that will there be a free table or not using binary logistic regression since it does not changes anything in the nature of the dependent variable.

Rcode:

Here in R is a demonstration that how we can fit a logistic regression model to obtain a fitted regression model and predict a table is free or not using nature of the day.

Using predict.glm() function we have obtained the predicted output for a "S" or sunny day in probability scale. In this case this is .16 which is near to zero which means that one can expect it to be "booked". (Here booked=0, free=1) Probability near to zero or one will determine the class in which the result is going to be classified.