Consider the Gaussian sequence model $$y_i=\theta_i+\frac{w_i}{\sqrt{n}}, \ \text{for} \ 1\le i\le n$$ and $w_i \sim N(0,1)$ are i.i.d. My goal is to estimate $\{\theta_i\}_{i=1}^{n}$ based on $y_1,...,y_n$.
Assume that there exists an $S \subset \{1,2,...,n\}$ such that $|S|=s$ and $\theta_i \in \{-1,+1\}$ for $i \in S$ and $\theta_i=0$ for $i \in S^{c}$. What should be the MLE of $\theta = (\theta_1,...,\theta_n)$?
The likelihood in this case becomes: $$L(\theta)=\left(\frac{\sqrt{n}}{\sqrt{2 \pi}} \right)^{n} \exp\left\{-\frac{n}{2} \left(\sum_{i \in S^{c}} y_i ^2 + \sum_{i \in S} (y_i - \theta_i)^2\right)\right\}.$$
We need to minimize the exponent and thus we need $\theta_i = y_i$ for $i \in S$, but in order to respect the fact that $\theta_i = \pm 1$, we need $y_i = \pm 1$ for $i \in S$, but it is not always the case. So, how should I go about this?
$\theta_i = \text{sgn}(y_i)$ and use the fact that $\left(x-\text{sgn}(x)\right)^2 \le \left(x+\text{sgn}(x)\right)^2 $