[SOLVED] AMS597-Homework 7

24.99 $

Programming resource
Digital learning resource
Category:
Practical programming resource
Suitable for guided study and reference
Tutor guidance available when needed

Description

Rate this product
  1. Estimate the bias, standard error, standard normal bootstrap CI, basic bootstrap CI and bootstrap t-interval at 95% of the sample median for x where

> set.seed(123)

> x <- rnorm(50)

  1. Another test statistic for two group comparison, i.e., H0 : F = G vs Ha : F 6= G in the univariate case is the Cramer-von Mises statistic

where Fn is the ecdf of x1,…,xn and Gm is the ecdf of y1,…,ym.

Implement the two group comparison using Cramer-von Mises test statistic but obtaining the p-value from permutation test.

  1. Implement the bivariate Spearman rank correlation test as a permutation test. Compare the achieved significance level of the permutation test with the p-value reported by test on the following samples:

> set.seed(123)

> x <- rnorm(50)

> y <- 0.2*x+rnorm(50)

  1. (a) Derive the Newton-Raphson iteration for solving

e2x = x + 6

Implement your iteration as a R function and report the solution to the equation.

(b) Compare your answer to the solution using uniroot function (i.e., Brent’s method).

  1. (a) Let x1,…,xn be a random sample from a Poisson(λ). Find the maximum likelihood estimator of λ using the function optimize in R. Apply this to

set.seed(123) lambda.true <- 10 x <- rpois(1000,lambda.true)

(b) Let x1,…,xn be a random sample from a Beta(a,b). Find the maximum likelihood estimator of θ = (a,b) using the function optim and optimx in R. Apply this to

set.seed(123) a.true <- 5

b.true <- 2

x <- rbeta(1000,shape1=a.true,shape2=b.true)

Resource details

Understand the Task Before You Use the Resource

Review the requirements, identify the programming concepts involved, study the implementation and test your understanding with your own examples and modifications.