# Positivity of a maximum likelihood estimator

This is a follow-up to Maximum Likelihood Estimation of an Ornstein-Uhlenbeck process. In the previous question I was lead to a paper presenting explicit formulas for maximum likelihood estimators of an Ornstein-Uhlenbeck process. The paper is available here: http://songchen.public.iastate.edu/Tang-Chen-09-JoE.pdf.

Suppose we are given discrete observations $X_0,X_\delta,\ldots,X_{n\delta}$ (equally spaced) from an Ornstein-Uhlenbeck process. Let us for now just call these $X_0,X_1,\ldots,X_n$. On the bottom of page 66, the MLE for the parameter $\kappa$ is given by $\hat{\kappa}=-\delta^{-1}\log(\hat{\beta}_1)$, where $$\hat{\beta}_1=\frac{\displaystyle n^{-1}\sum_{i=1}^nX_iX_{i-1} - n^{-2}\sum_{i=1}^n X_i\sum_{i=1}^n X_{i-1}}{\displaystyle n^{-1}\sum_{i=1}^n X_{i-1}^2 - n^{-2}\bigg(\sum_{i=1}^n X_{i-1}\bigg)^2}.$$

In order for this to work we must have $\hat{\beta}_1>0$. Is this the case? The reason why I am asking, is because I have made a function in R, which takes such observations and return the MLE's. However, in some cases I would get a negative $\hat{\beta}_1$. Below I have attached the code for calculating $\hat{\beta}_1$ (here $X$ is the vector of observations)

\begin{align} & N = \operatorname{length}(X) \\[6pt] & X_\mathrm{upper} = X[2:N] \\ [6pt] & X_\mathrm{lower} = X[1:(N-1)] \end{align}

$$\beta_1= \frac{(1/N) \sum(X_\mathrm{upper}\cdot X_\mathrm{lower})-(1/N^2)\sum(X_\mathrm{upper})\cdot\sum(X_\mathrm{lower})}{( (1/N)\sum(X_\mathrm{lower}^2)-(1/N^2)(\sum(X_\mathrm{lower}))^2 }$$

I have encountered a negative $\hat{\beta}_1$ value with the following observations ($\delta=0.05$ was used)

[1] 1.00000000 0.10991872 -0.36067351 0.20473833 0.17739777 0.01142066
[7] 0.60254001 0.14697592 0.57360277 0.32835403 0.21371114

Does the paper give a definition of $\beta_1$ (as opposed to $\hat\beta_1$? If so, could you tell us what it is? Certainly if $\hat\beta_1$ is the MLE for $\beta_1$ and $\delta$ is "known" and $\kappa = -\delta^{-1}\log \beta_1$, then the formula is correct. And if the parameter space in which $\beta_1$ is to be found is $(0,\infty)$, then the MLE for $\beta_1$ will also be in that space. It's clear from algebra that the denominator will be positive unless all of the $X_i$ values are equal, in which case it will be $0$, and that seems to be an event of probability $0$. –  Michael Hardy Jun 27 '12 at 19:16
@MichaelHardy: Yes, it is the numerator that is problem. The paper states that the discrete observations $(X_0,X_\delta,\ldots,X_{n\delta})$ follows an AR(1) process with $\beta_1=e^{-\kappa\delta}$ as the auto-regressive coefficient (i have never myself studied AR(1)-processes). Since $\kappa$ is a parameter varying in $(0,\infty)$, then $\beta_1$ varies in $(0,1)$. So I guess it would make sense that $\hat{\beta}_1$ is in $(0,1)$ aswell, but either that is not the case, or the program i have written has flaws. –  Stefan Hansen Jun 27 '12 at 19:34
An even more minimal example where it fails: $(X_0,X_1,X_2)=(1,0.1143,0.3188)$. Would it be an idea to put $\hat{\kappa}_1=0$ whenever this occurs? –  Stefan Hansen Jun 27 '12 at 19:49
If $\beta_1$ is always in $(0,1)$, then necessarily, the MLE for $\beta_1$ is always in $(0,1)$. Or maybe one could speak of some cases in which the MLE is undefined by saying the MLE is one of the boundary points, $0$ or $1$. –  Michael Hardy Jun 27 '12 at 21:05