How to estimate $\sigma^{2}$ How can I estimate the $\sigma^{2}$ appearing in the following model?
$$w_{t} = w_{t-1} + \text{sgn}(z_{t} - \rho_{t-1}), \quad z_{t} \sim \mathcal{N}(0.5, \sigma^{2})$$
For each time step I know both $w$ and $\rho$.
 A: This is a random walk with varying probabilities of moving up or down.  The probabilities depend on a single unknown parameter, $\sigma$.  The objective is to estimate $\sigma$ (which includes obtaining some quantitative expression of the uncertainty of that estimate, such as a standard error or confidence interval).
The nature of the problem may become clearer if we separate the formula for the walk from the details of how the probabilities change.  To this end, write the chance of moving up at step $t$ as
$$p_t(\sigma) = \Pr(w_t = w_{t-1}+1) = \Pr(z_t - \rho_{t-1} \ge 0) = \Phi\left(\frac{1/2-\rho_{t-1}}{\sigma}\right)$$
where $\Phi$ is the standard Normal distribution function.
You need to start the random walk somewhere, so let's suppose $w_0$ is a given number.  Then, because you must implicitly be assuming the $z_t$ are independent, the probabilities of the individual steps multiply to give the probability of the walk $\mathbf{w}=(w_0, w_1, w_2, \ldots, w_n)$.
There are various ways to write these probabilities, but one convenient method is
$$\eqalign{
\pi_{t}(u; \sigma) &= \begin{cases} p_t(\sigma) & u=1 \\ 1-p_t(\sigma) & u=-1\end{cases} \\
&=p_t(\sigma)^{(1+u)/2}\left(1-p_t(\sigma)\right)^{(1-u)/2}
}$$
(Although using exponents may seem strange, when we take logarithms later the resulting expression is easy to work with.)
Multiplying them all gives the formula
$$\Pr(\mathbf{w}) = \pi_{1}(w_1-w_0; \sigma)\pi_{2}(w_2-w_1; \sigma)\cdots \pi_{n}(w_n-w_{n-1}; \sigma) = L(\sigma;\mathbf{w}).$$
By definition, this is the likelihood $L(\sigma, \mathbf{w})$.  For convenience, let's abbreviate the steps $$w_i - w_{i-1} = \delta_i.$$  A standard way to estimate $\sigma$ finds the value(s) of $\sigma\gt 0$ at which the likelihood is as large as possible.  Equivalently, we maximize the log likelihood
$$\eqalign{
\Lambda(\sigma;\mathbf{w}) &= \log(L(\sigma;\mathbf{w})) \\
&= \sum_{i=1}^n \log \pi_{t}(w_i-w_{i-1}; \sigma) \\
&= \frac{1}{2}\sum_{i=1}^n (1+\delta_i) \log p_t(\sigma) + (1-\delta_i) \log \left(1-p_t(\sigma)\right).
}$$
This is a differentiable function of $\sigma$ when $\sigma \gt 0$, allowing us to use standard methods of Calculus to find the critical points.  They occur when $\sigma\to 0$, $\sigma\to \infty$, and at any places where the derivative is zero:
$$0 = \frac{d}{d\sigma}\Lambda(\sigma;\mathbf{w}) = \frac{1}{2}\sum_{i=1}^n (1+\delta_i) \frac{p_t^\prime(\sigma)}{p_t(\sigma)} - (1-\delta_i) \frac{p_t^\prime(\sigma)}{1-p_t(\sigma)}.\tag{1}$$
For brevity, I have written $$p_t^\prime(\sigma) = \frac{d}{d\sigma}p_t(\sigma) = -\frac{1/2-\rho_{t-1}}{\sigma^2}\phi\left(\frac{1/2-\rho_{t-1}}{\sigma}\right)$$
where $\phi$ is the standard Normal PDF. 
The likelihood equation $(1)$ has no closed-form solution.  Use numerical methods.  Any good solver, perhaps followed by a Newton-Raphson polishing step, will work well provided $\sigma$ is parameterized in terms of its logarithm.  In many circumstances it may be difficult to pin down $\sigma$: it will help to have a long series (that is, large $n$).

Here is an example of some data, the associated values of $\rho$ and $\delta$, and a graph of $\Lambda$ in the vicinity of $\log(\sigma)$.  The dashed black vertical line in that graph shows the true value of $\log(\sigma)$.  The solid red line is the estimate and the two dotted red lines delimit an approximate $95\%$ confidence interval for the estimate.

The graph of $\Lambda$ makes it evident that neither $\sigma=0$ nor $\sigma=\infty$ are going to maximize it: the estimate is uniquely at the peak of this graph.

Here is the R code that produced the data and performed the fit.  Its output, in addition to the figure, summarizes the results:
Maximum Likelihood estimation
Newton-Raphson maximisation, 5 iterations
Return code 1: gradient close to zero
Log-Likelihood: -172.5586 
1  free parameters
Estimates:
     Estimate Std. error t value Pr(> t)  
[1,]   0.6213     0.3235   1.921  0.0548 .

It has estimated $\log(\sigma)=\log(2)\approx 0.693$ as $\hat\sigma=0.621\pm 0.3235$ based on $n=256$ consecutive observations of this random walk.  It took only five Newton-Raphson iterations to do so: that was a fast calculation.
library(maxLik)
#
# Define the log likelihood and its derivative in terms of log(sigma),
# delta (the data), and rho (given).
#
p <- function(sigma, rho) pnorm((1/2-rho)/sigma)
dp <- function(sigma, rho) -(1/2-rho)*dnorm((1/2-rho)/sigma) / sigma^2
Lambda <- function(sigma, delta, rho) {
  sigma <- exp(sigma)
  p0 <- p(sigma, rho)
  ((1+delta) * log(p0) + (1-delta) * log(1-p0))/2
}
grad <- function(sigma, delta, rho) { # Gradient of Lambda
  sigma <- exp(sigma)
  p0 <- p(sigma, rho)
  dp0 <- dp(sigma, rho)
  ((1+delta) * dp0/p0 - (1-delta) * dp0 / (1-p0))/2 * sigma
}
#
# Create data.
#
set.seed(17)
n <- 256
rho <- rnorm(n, -1/2, 1/4) + 0.8*(1 + sin(seq(0, pi, length.out=n)))
sigma <- 2
z <- rnorm(n, 1/2, sigma)
delta <- sign(z - rho)
w <- cumsum(c(0, delta))
#
# Estimate log(sigma).
#
fit <- maxLik(Lambda, grad=grad, start=0, delta=delta, rho=rho)
summary(fit)
se <- summary(fit)$estimate[1, "Std. error"]
#
# Plot the data, the log likelihood, the estimate of log(sigma), and a
# confidence interval for it.
#
par(mfrow=c(2,2))
plot(rho, type="l", xlab="t-1", main="Rho")
plot(delta, type="p", pch="|", xlab="t", main="Delta")
plot(w, type="l", xlab="t", main="Random Walk")

s <- seq(log(sigma) - 3*se, log(sigma) + 3*se, length.out=100)
y <- sapply(s, function(s) sum(Lambda(s, delta, rho)))
plot(s, y, type="l", xlab="Log sigma", ylab="Lambda", main="Log Likelihood")
abline(v=log(sigma), col="Black", lty=2)
abline(v=coef(fit), col="Red")
abline(v=coef(fit) + qnorm(0.975)*c(-1,1)*se, lty=3, col="Red")

A: At the moment, this is more an answer sketch. I can fill out more details later if needed.
I recommend starting by looking at the differences $w_t - w_{t-1}$. This also eliminates the dependence on the initial value $w_1$.
Note that $\Delta_t w_t - w_{t-1} = 1$ iff $z_t \geq p_{t-1}$. You can use this to construct a likelihood function and use maximum likelihood estimation or bayesian methods. 
To do so, first note that unlike the $w_t$ the differences $\Delta_t = w_t - w_{t-1}$ are independent, so that you can multiply the individual likelihoods.
Finally
$$
P(\Delta_t = -1|\sigma^2)=p_{0.5, \sigma^2}(p_t{-1})
$$
with $p$ being the cumulative distribution function for the normal distribution. 
This suffices, since
$$
P(\Delta_t = 1|\sigma^2) = 1- P(\Delta_t = -1|\sigma^2).
$$
The CDF is complicated, but implemented in any statistical software package. 
For example, in WinBUGS you can use the following modelling code, where I rewrote the indices for $p$ to use $i$ instead of $i-1$:
model {
  for (i in 1:N) {
    diffw[i] ~  dbern(prob[i])
    prob[i] <- step(z[i] - p[i])
    z[i] ~ dnorm(0.5, prec)
  }
  prec <- 1/variance
  variance ~ dunif(0, 1000000)
}

Some additional remarks:


*

*If you use the bayesian approach, you need to make certain that your initial values for $z$ are consistent with the observed data. This means the initial value $z_t$ must be larger than $p_t$ if the corresponding difference is 1. 

*Finally, depending on your observed values you might learn very little about $\sigma^2$. Consider the case that all the $p_t = 0.5$. Then $z_t > p_t$ with probability 0.5 regardless of $\sigma^2$. 

