# How to calculate conditional maximum likelihood estimator

I have a function , for instance $$\lambda(S, B)=\left(\frac{n-(S+B)}{\sigma_{\text {stat }}}\right)^{2}+\left(\frac{B^{\text {obs }}-B}{\sigma_{\text {syst }}}\right)^{2}$$ maximum likelihood estimator $$\hat{S}=n-\theta^{\text {obs }} ,~~~\hat{B}=B^{\text {obs }}$$ can be probably taken as $$\partial\lambda/\partial S= 0, ~~~ \partial\lambda/\partial B= 0$$ Then, how can I get conditional maximum likelihood estimator $$\hat{\hat{B}}(S)$$

Just treat $$S$$ as a known constant and maximise with respect to $$B$$. So you have:

\begin{align} \frac{\partial \lambda}{\partial B}(S,B) &= -2 \Bigg[ \frac{n-S-B}{\sigma_\text{stat}} + \frac{B^\text{obs}-B}{\sigma_\text{syst}} \Bigg], \\[12pt] \frac{\partial^2 \lambda}{\partial B^2}(S,B) &= 2 \Bigg[ \frac{1}{\sigma_\text{stat}} + \frac{1}{\sigma_\text{syst}} \Bigg] > 0. \\[12pt] \end{align}

This shows that $$\lambda$$ is strictly convex in $$B$$, so its maximum occurs at the unique critical point that solves:

$$\frac{n-S-\hat{B}(S)}{\sigma_\text{stat}} + \frac{B^\text{obs}-\hat{B}(S)}{\sigma_\text{syst}} = 0,$$

which gives the conditional MLE:

$$\hat{B}(S) = \frac{(n-S) \sigma_\text{syst} + B^\text{obs} \sigma_\text{stat}}{\sigma_\text{syst} - \sigma_\text{stat}}.$$

(Your value $$\theta^\text{obs}$$ does not appear in the original objective function and is not defined, so it is not clear where this came from in your question.)