Hello,

I am trying to create a brownian motion model in the presence of measurement noise, but I am having trouble fitting situations when the particle is not moving.

The brownian motion model is governed by the following equation:

x_i = x_{i-1}+\epsilon_i where \epsilon_i\sim \mathcal{N}(0,\sigma^2)

and we also include measurement noise at each timepoint, so that each measured observation corresponds to the true observation plus some normal noise:

y_i = x_i + \eta_i where \eta_i \sim \mathcal{N}(0,\sigma_c^2)

I implemented this with the following stan program

```
model_code='data {
int<lower=1> N; // size of dataset
real<lower=0> measurementNoiseSigma;
real x_measured[N];
}
parameters {
real x_true[N];
real<lower=0> sigma;
}
model {
sigma ~ normal(50,50);
x_true[2:N] ~ normal(x_true[1:N-1], sigma);
x_measured ~ normal(x_true,measurementNoiseSigma);
}'
```

The data could be simulated as follows:

```
N <- 1000
sigma <- 30
measurementNoise <- 30
displacements <- rnorm(N,mean=0,sd=sigma)
trayectory <- cumsum(displacements)+rnorm(length(displacements),mean=0,sd=measurementNoise)
```

and the fitting works fine:

```
library(rstan)
stanFit <- rstan::stan(
model_code = model_code,
data = list(N=N,
x_measured=trayectory,
measurementNoiseSigma=measurementNoise),
chains = 4,
warmup = 2000,
iter = 4000,
cores = 4,
refresh = 0,
pars=c("sigma"))
```

However, as the signal becomes smaller (the sigma), then convergence becomes a problem. For example:

```
N <- 1000
sigma <- 5
measurementNoise <- 30
displacements <- rnorm(N,mean=0,sd=sigma)
trayectory <- cumsum(displacements)+rnorm(length(displacements),mean=0,sd=measurementNoise)
stanFit <- rstan::stan(
model_code = model_code,
data = list(N=N,
x_measured=trayectory,
measurementNoiseSigma=measurementNoise),
chains = 4,
warmup = 2000,
iter = 4000,
cores = 4,
refresh = 0,
pars=c("sigma"))
```

The issue is that these situations (sigma small) are of great scientific interest to us, as it reflects an immobile or very slowly moving particle, so it would be great if we could figure out a way to fit those as well as normal-moving particles.

Any suggestions on how this could be addressed?