Question: Let be a random variable whose density is given by ( ) = { 0 , > 0 , < = 0 , where >
Let be a random variable whose density is given by where
is a fixed parameter.
Part a
Create R function likelythetax which, for a given value of parameter theta and a given vector x which represents a sample from the population
returns the corresponding value of the likelihood function of parameter of population
based on the sample x
Note that since
for
we can assume that all the entries of the sample are positive. So think of R variable x as a vector
with for all in
In other words, you don't need to worry about how to handle situation in which
for some in
although in that case the likelihood equals so it's trivial
Your function likely should be flexible allowing vector x to be of any length.
Hint: After figuring out the mathematical formula for the likelihood function ;
your R function likely should have one or two lines of code. No loops, nor ifelse statments, please! Loops are okay only when you cannot vectorize.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
