# Re: [R] Fitting ARMA model with known inputs.

From: mkondrin <mkondrin_at_hppi.troitsk.ru>
Date: Thu 02 Jun 2005 - 02:31:35 EST

Thank you very much for clearing my question (for me too ;)) The model I would like to fit is :

X_t = phi_1 * X_{t-1} + phi_2 * X_{t-2}

```                              + phi_3 * X_{t-3} +
```
A_1*f_{t-1}+A_2*f_{t-2}...+A_k*f_{t-k} + E_t (*)

(X_t and f_t time series are both known, k - fixed and more than 1). lm is a good answer (I surely try it), but I thought may be somethere in R exists a front-end to lm for this particular case. For example if I have a model
X_t = phi_1 * X_{t-1} + phi_2 * X_{t-2}

```                              + phi_3 * X_{t-3} + E_t (**), I would use
```
an "ar" command from "stats" package. My problem is how to make my model (*) suit "ar" command (may model (*) be rewritten in (**) form)?

Rolf Turner wrote:

>It is not at all clear what you want to do. One conjecture
>
> X_t = ``black box's state'' at time t
> f_t = ``force'' at time t
>
> Proposed model e.g. AR(3):
>
> X_t = phi_1 * X_{t-1} + phi_2 * X_{t-2}
> + phi_3 * X_{t-3} + f_t
>
> You wish to identify/estimate the coefficients phi_1, phi_2,
> phi_3.
>
>Remarks:
>
> (a) This model probably doesn't make a lot of sense, with
> known/observed f_t. It will almost surely not hold exactly,
> for ***any*** values of the phi_i.
>
> (b) A model which makes a bit more sense, in the abstract, is
>
> X_t = phi_1 * X_{t-1} + phi_2 * X_{t-2}
> + phi_3 * X_{t-3} + f_t + E_t
>
> where E_t is (unobserved) i.i.d. random ``error''.
>
> (c) This last model is just a simple regression model and
> may be fitted using lm().
>
> cheers,
>
> Rolf Turner
> rolf@math.unb.ca
>
>Original message:
>
>
>
>>Hello!
>>Is it possible to use R time series to identificate a process which is
>>subjected to known input? I.e. I have 2 sequences - one is measurements
>>of black box's state and the second is the "force" by which this black
>>box is driven (which is known too) and I want to fit thist two series
>>with AR-process. The "ar" procedure from stats package expects that the
>>force is always random. Is it possible to feed it known vector as input
>>parameter?
>>
>>
>
>______________________________________________
>R-help@stat.math.ethz.ch mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help