

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


POL 213: Problem Set 1 Fun With Distributions
Please answer the following questions. With your answer, please turn in your R log-file. I am being intentionally vague on R script in this assignment in hopes that you all can figure some of this out. It will be tough and I can answer questions as need be.
L ( θ | y ) =
∏^ N
= 1
ƒ ( y | μ, σ = 1 )
∏^ N
= 1
p 2 π
exp
−( y − μ )^2 2
(1)
In R, write a function that finds a value, μ , that maximizes the log-likelihood of y , where y is a vector of ten observations drawn randomly from a standard normal distribution. Generate 20 possible values for μ and plot the resulting log-likelihoods with respect to the μ. Label the graph axes appropriately. For what value of μ is the log-likelihood maximized? To verify your answer, solve the first derivative. For this case, the first derivative is given by
∂ ∂μ
−
∑^ N
= 1
( y − μ )^2
(^) = 2
∑^ N
= 1
y − 2 Nμ. (2)
What value of μ satisfies the first order condition? In ordinary statistics, what does μ correspond to? (20 points)
L ( θ | y ) =
e − Nλλ
∑ y ∏ y!
Note that the Poisson distribution is commonly used to describe the DGP for variables of counts. For this problem, create a vector of 10 positive integers ( is also ok). Keep the integers within the range [0,5]. First do a grid search and find the value of λ that maximizes the function. Plot the likelihood with respect to lambda. After inspecting this plot, redo your grid search using a finer mesh. To help get you started, note that candidate values for λ can be generated by:
lambda <- seq(0,5, .01)
After this, you need to write the function given in equation 3 and plot it. The fine mesh grid can be constructed using the code fragment from above. De- scribe the location of the maximum in both plots and describe the differences you see between the first and second grid searches. (20 points)