# How to fit the coefficients of a first order linear auto-regressive function without noise in the model, and the coefficient are equal?

I have a simple auto-regressive function:

$x_{i+1} = c - cx_{i}$

It is linear and first order. There is no noise in the model although there is in the data. I am using Matlab and have a vector (time series) of numbers that has arisen from a process governed by the above equation. I would like to obtain the value of the coefficient $c$ for the least squares fit to this data.

How can this be done in Matlab by using a library function or toolbox? I have looked at the ar command, but fail to see how this can be used in my case. I consider writing instead a function to take the data and calculate the root-mean-squared error over a set of possible values for $c$ choosing the one that is smallest.

-
For any $1 \leq i < n$, we have $c = x_{i+1} / (1-x_i)$. –  cardinal Mar 9 '12 at 0:53
@cardinal, I think that I made a mistake in the question which I edited, there is no noise modeled although the data contains noise. –  Vass Mar 9 '12 at 0:57
What do you mean "There is no noise in the model but there is in the data"? That doesn't seem to make a whole lot of sense on the surface. –  cardinal Mar 9 '12 at 0:59
@cardinal, I want to say is that the data I am fitting to has noise, and I want to find the best value of c without including any extra parameters to account for the noise –  Vass Mar 9 '12 at 1:03
Even in the regression setting, the gist of my statement still stands. If $\mathbb E( X_{i+1} \mid X_i ) = c - c X_i$, then the least-squares estimate of $c$ is $$\hat c = \frac{\sum_i x_{i+1}(1-x_i)}{\sum_i (1-x_i)^2} \> .$$ –  cardinal Mar 9 '12 at 1:05

It makes no sense to say there is no noise in the model but there is in the data. I think your model should be a standard AR(1) with a parameter constraint: $$x_{i+1} = c(1-x_i) + e_i$$ where $e_i$ is white noise.
Then the least squares estimate of $c$ is $$\hat{c} = \frac{\sum x_{i+1}(1-x_i)}{\sum (1-x_i)^2}.$$
@RobHyndman and @cardinal, is this available in Matlab to be computed as a function (just out of curiosity). Also, in the case where the equation has 2 parameters and a squared x_i term is there an analogous method of evaluation? –  Vass Mar 9 '12 at 7:52