Your goal is to produce a function that computes E
Ask Expert

Be Prepared For The Toughest Questions

Practice Problems

Your goal is to produce a function that computes E

Task

Your goal is to produce a function that computes E[q ∗ j |q˜jt, Njt], the expected quality of a GP given observed rounded rating ˜qjt and number of reviews Njt. The function obviously needs to take ˜qjt, Njt as variable inputs. Some fixed inputs (i.e. inputs that won’t ever change) that you also need are:

• A vector of random draws from the prior P(q ∗ j ). This is so that computing R f(q ∗ j )dP(q ∗ j ) is as simple as taking an average of f(·) over the vector of random draws.

• A vector of 4 cutpoints for the ordered probit.

Some hints:

• Start by building the simplest functions. For example, P(qrt|q ∗ j ) is really easy.

• Think carefully through the combinatorics when computing R(˜qjt, Njt).

– This is one of the hardest (if not the hardest) parts, especially if you’re trying to do so efficiently.

– I suggest using recursion. This shows how to do so for an equivalent problem: https: //www.techiedelight.com/total-ways-sum-with-n-throws-dice-having-k-faces/. Memoization can also really help. 

• An excellent “checkpoint” is computing p(˜qjt|Njt, q∗ j ). If you can compute p(˜qjt|Njt, q∗ j ), you’re basically done with the hard part. Let me know when you can compute p(˜qjt|Njt, q∗ j ). I may tell you that the code gives me enough information and you don’t need to finish the exercise.

• Test your functions along the way. For example: do the probabilities sum to 1 when you integrate your probability over the whole state space?

Hint
Economics"import numpy as npfrom scipy.stats import normdef compute_prob_q_star_given_q_tilde_N(q_star_samples, q_tilde, N, cutpoints):    """"""    Compute the probability distribution of the true quality given the observed rounded rating and number of reviews.        Args:    - q_star_samples: Vector of random draws from the prior P(q ∗ j )&...

Know the process

Students succeed in their courses by connecting and communicating with
an expert until they receive help on their questions

1
img

Submit Question

Post project within your desired price and deadline.

2
img

Tutor Is Assigned

A quality expert with the ability to solve your project will be assigned.

3
img

Receive Help

Check order history for updates. An email as a notification will be sent.

img
Unable to find what you’re looking for?

Consult our trusted tutors.

Developed by Versioning Solutions.