## Exercises

### 3.5.1Cauchy with unknown location.

Consider estimating the location parameter of a Cauchy distribution with a known scale parameter. The density function is

$\begin{array}{r}f\left(x;\theta \right)=\frac{1}{\pi \left[1+\left(x-\theta {\right)}^{2}\right]},\phantom{\rule{1em}{0ex}}x\in R,\phantom{\rule{1em}{0ex}}\theta \in R.\end{array}$

Let

${X}_{1},\dots ,{X}_{n}$

be a random sample of size

$n$

and

$\ell \left(\theta \right)$

the log-likelihood function of

$\theta$

based on the sample. – Show that

$\begin{array}{rl}\ell \left(\theta \right)& =-n\mathrm{ln}\pi -\sum _{i=1}^{n}\mathrm{ln}\left[1+\left(\theta -{X}_{i}{\right)}^{2}\right],\\ {\ell }^{\prime }\left(\theta \right)& =-2\sum _{i=1}^{n}\frac{\theta -{X}_{i}}{1+\left(\theta -{X}_{i}{\right)}^{2}},\\ {\ell }^{″}\left(\theta \right)& =-2\sum _{i=1}^{n}\frac{1-\left(\theta -{X}_{i}{\right)}^{2}}{\left[1+\left(\theta -{X}_{i}{\right)}^{2}{\right]}^{2}},\\ {I}_{n}\left(\theta \right)& =\frac{4n}{\pi }{\int }_{-\mathrm{\infty }}^{\mathrm{\infty }}\frac{{x}^{2}\phantom{\rule{thinmathspace}{0ex}}\mathrm{d}x}{\left(1+{x}^{2}{\right)}^{3}}=n/2,\end{array}$

where

${I}_{n}$

is the Fisher information of this sample. – Set the random seed as

$20180909$

and generate a random sample of size

$n=10$

with

$\theta =5$

. Implement a loglikelihood function and plot against

$\theta$

. – Find the MLE of

$\theta$

using the Newton–Raphson method with initial values on a grid starting from

$-10$

to

$30$

with increment

$0.5$

. Summarize the results. – Improved the Newton–Raphson method by halving the steps if the likelihood is not improved. – Apply fixed-point iterations using

$G\left(\theta \right)=\alpha {\ell }^{\prime }\left(\theta \right)+\theta$

, with scaling choices of

$\alpha \in \left\{1,0.64,0.25\right\}$

and the same initial values as above. – First use Fisher scoring to find the MLE for

$\theta$

, then refine the estimate by running Newton-Raphson method. Try the same starting points as above. – Comment on the results from different methods (speed, stability, etc.).

### 3.5.2Many local maxima

Consider the probability density function with parameter

$\theta$

:

$\begin{array}{r}f\left(x;\theta \right)=\frac{1-\mathrm{cos}\left(x-\theta \right)}{2\pi },\phantom{\rule{1em}{0ex}}0\le x\le 2\pi ,\phantom{\rule{1em}{0ex}}\theta \in \left(-\pi ,\pi \right).\end{array}$

A random sample from the distribution is

x <- c(3.91, 4.85, 2.28, 4.06, 3.70, 4.04, 5.46, 3.53, 2.28, 1.96,
2.53, 3.88, 2.22, 3.47, 4.82, 2.46, 2.99, 2.54, 0.52)
• Find the the log-likelihood function of
$\theta$

based on the sample and plot it between

$-\pi$

and

$\pi$

.

• Find the method-of-moments estimator of
$\theta$

. That is, the estimator

${\stackrel{~}{\theta }}_{n}$

is value of

$\theta$

with

$\begin{array}{r}\mathbb{E}\left(X\mid \theta \right)={\overline{X}}_{n},\end{array}$

where

${\overline{X}}_{n}$

is the sample mean. This means you have to first find the expression for

$\mathbb{E}\left(X\mid \theta \right)$

.

• Find the MLE for
$\theta$

using the Newton–Raphson method initial value

${\theta }_{0}={\stackrel{~}{\theta }}_{n}$

.

• What solutions do you find when you start at
${\theta }_{0}=-2.7$

and

${\theta }_{0}=2.7$

?

• Repeat the above using 200 equally spaced starting values between
$-\pi$

and

$\pi$

. Partition the values into sets of attraction. That is, divide the set of starting values into separate groups, with each group corresponding to a separate unique outcome of the optimization.

### 3.5.3Modeling beetle data

The counts of a floor beetle at various time points (in days) are given in a dataset.

beetles <- data.frame(
days    = c(0,  8,  28,  41,  63,  69,   97, 117,  135,  154),
beetles = c(2, 47, 192, 256, 768, 896, 1120, 896, 1184, 1024))

A simple model for population growth is the logistic model given by

$\frac{\mathrm{d}N}{\mathrm{d}t}=rN\left(1-\frac{N}{K}\right),$

where

$N$

is the population size,

$t$

is time,

$r$

is an unknown growth rate parameter, and

$K$

is an unknown parameter that represents the population carrying capacity of the environment. The solution to the differential equation is given by

${N}_{t}=f\left(t\right)=\frac{K{N}_{0}}{{N}_{0}+\left(K-{N}_{0}\right)\mathrm{exp}\left(-rt\right)},$

where

${N}_{t}$

denotes the population size at time

$t$

.

• Fit the population growth model to the beetles data using the Gauss-Newton approach, to minimize the sum of squared errors between model predictions and observed counts.
• Show the contour plot of the sum of squared errors.
• In many population modeling application, an assumption of lognormality is adopted. That is , we assume that
$\mathrm{log}{N}_{t}$

are independent and normally distributed with mean

$\mathrm{log}f\left(t\right)$

and variance

${\sigma }^{2}$

. Find the maximum likelihood estimators of

$\theta =\left(r,K,{\sigma }^{2}\right)$

using any suitable method of your choice. Estimate the variance your parameter estimates. EasyDue™ 支持PayPal, AliPay, WechatPay, Taobao等各种付款方式!

E-mail: easydue@outlook.com  微信:easydue

EasyDue™是一个服务全球中国留学生的专业代写公司