Tell me more ×
Cross Validated is a question and answer site for statisticians, data analysts, data miners and data visualization experts. It's 100% free, no registration required.

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.

share|improve this question
1  
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
2  
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
4  
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

1 Answer

up vote 5 down vote accepted

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}.$$

share|improve this answer
(+1) Is this a subtle hint I should be posting my comments as an answer? :) – cardinal Mar 9 '12 at 1:37
Sorry. I think your comment must have gone up at about the same time as my answer. In any case, I didn't see it before I posted. If we both derived the same result, it is probably correct! – Rob Hyndman Mar 9 '12 at 2:41
No reason to be sorry at all! :) It was interesting how similar it was. I'm glad you posted it! Cheers. – cardinal Mar 9 '12 at 2:42
@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
1  
@Vass. You will need to write your own Matlab function. It should be about 3 lines at most. For the version with squared x_i, you will need to derive the estimators and then write the corresponding function. – Rob Hyndman Mar 9 '12 at 10:17
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.