Complete the following question in R. Problem 5. Write a function in R called like which takes an input vector dat, assumed to be Poisson random variates, and computes the Maximum-Likelihood Estimator for λ.
Here we find maximum likelihood of paramter of poisson distribution i.e lamda(λ)
We know maximum likelihood of paramter of poisson distribution i.e lamda(λ)= xbar (mean of random samples)
so we write function bases on above estimator. function name is MLE_L which take v (vector of random samples ) and return MLE of poisson
R code=
MLE_L <- function(v) {
lamda=sum(v)/length(v)
return(cat("MLE of poisson Lamda= ",lamda))
}
MLE_L(rpois(100,11))# verify by runing it wil give MLE of lamda for
100 random samples generated from p(11)
Complete the following question in R. Problem 5. Write a function in R called like which...
Please answer the question clearly.
Consider a random sample of size n from a Poisson population with parameter λ (a) Find the method of moments estimator for λ. (b) Find the maximum likelihood estimator for λ. Suppose X has a Poisson distribution and the prior distribution for its parameter A is a gamma distribution with parameters and β. (a) Show that the posterior distribution of A given X-x is a gamma distribution with parameters a +r and (b) Find the...
What would the function look like in MATLAB? Write a function called mysort that takes a 3-element vector as its sole arguments. It uses if statements, possibly nested, to return a 3-element vector with its elements in non-decreasing order, i.e., the first element in the returned vector equals the smallest element of the input vector and the last element equals the largest element in the input vector. NOTE: Your function should not use any built-in functions, e.g., sort, min, max,...
4 Mary is a waitress in a city centre restaurant. She receives tips from customers at an average rate of λ per hour. During a particular eight hour shift, she receives 5 tips. We wish to estimate λ. a (2 marks) Let X be the number of tips Mary receives in an 8 hour period. If tips are received according to a Poisson process with rate A tips per hour, state the distribution of X, with parameters b (5 marks)...
Mary is a waitress in a city centre restaurant. She receives tips from customers at an average rate of λ per hour. During a particular eight a (2 marks) Let X be the number of tips Mary receives in an 8 hour period. If tips are received according to a Poisson process with rate λ tips per hour, state the distribution of X, with parameters b (5 marks) Write down the likelihood function, L(X; 5) for this problem. Remember to...
Write a function called ''minandmax'' . Function ''minandmax'' takes only one input argument that is a matrix M . This matrix M can be any size (any number of columns and rows) with any random integer values . Function ''minandmax'' returns two output arguments. The first output argument is called ''difference_row'' that returns a row vector containing the absolute values of the difference between the maximum and minimum valued elements in each row. The second output argument is called ''difference_all''...
MATLAB QUESTION Write a MATLAB function called vector_input that takes no inputs and returns no outputs. Instead, when called, it gives control to the user and asks the user to input a length-3 vector. Then the function prints: The sum of ___, ____, and ____ is ____. [new line] where the first three blanks are filled by each element in input vector, and the last blank is the sum of all three elements.
ANSWER QUESTION 2
1. The size of claims made on an insurance policy are modelled through the following distribu- tion: λ+1 You are interested in estimating the parameter λ > 0, using the following observations 120, 20, 60, 70, 110, 150, 220, 160, 100, 100 (a) Verify that f is a density (b) Find the expectation of the generic random variable X, as a function of when > 1 (c) Prove that the method of moments estimator of λ is...
Problem Summary This is a basic problem that uses a for-loop. Write a function called vector_multiply that takes two vectors of the same length as input arguments and returns one row vector as output Each component of the output vector is the product of the corresponding components in the two input vectors. However, this function must not use an array operation it must instead use a for-loop. For example, >>product - vector_multiply([1, 2, 3, 6], [9, 6, 4, 0]) product...
1. The size of claims made on an insurance policy are modelled through the following distribu- tion: You are interested in estimating the parameter λ > 0, using the following observations: 120, 20, 60, 70, 110, 150, 220, 160, 100, 100 (a) Verify that f is a density (b) Find the expectation of the generic random variable X, as a function of \ when A 1 (c) Prove that the method of moments estimator of λ is λι =斉. Calculate...
[MATLAB] Write a function called myMultProd.m that computes the cumulative product of the elements in a vector. The cumulative product, pj, of the jth element of the vector x, xj, is defined by pj = (x1)(x2) … (xj) for j = 1:length of the vector x. DO NOT USE CUMPROD For example, when you run your function it should look like this: >> x = [2 3 4 2]; >> myMultProd(x) >> ans = 2 6 24 48 That is,...