@BeginModule
@NewPage
@Name      = Trend
@Title     = Trend of time series
@Section   = Regression
@Class     = Regression
@Arguments = ifile ofile1 ofile2
@Operators = trend
@EndModule


@BeginOperator_trend
@Title     = Trend

@BeginDescription
@IfMan
The values of the input file @file{ifile} are assumed to be distributed as
N(a+b*t,S^2) with unknown a, b and S^2. This operator estimates the
parameter a and b. For every field element x only those timesteps 
t belong to the sample S(x), which have i(t,x) NE miss.
@EndifMan
@IfDoc
The values of the input file @file{ifile} are assumed to be distributed as
\begin{math}N(a+b t,\sigma^2)\end{math} with unknown @math{a},
@math{b} and \begin{math}\sigma^2\end{math}. This operator estimates the
parameter @math{a} and @math{b}.
For every field element @math{x} only those timesteps @math{t} belong
to the sample \begin{math}S(x)\end{math}, which have \begin{math}i(t,x) \neq \mbox{miss}\end{math}.
It is
@BeginDisplayMath
o_1(1,x) = \frac{1}{\#S(x)} \sum\limits_{t \in S(x)}i(t,x) - b(x)\left(\frac{1}{\#S(x)} \sum\limits_{t \in S(x)}t\right)
@EndDisplayMath
and
@BeginDisplayMath
o_2(1,x) = \frac{\sum\limits_{t \in S(x)}\left(i(t,x) - \frac{1}{\#S(x)} \sum\limits_{t' \in S(x)}i(t',x)\right)
                                     \left(t - \frac{1}{\#S(x)} \sum\limits_{t' \in S(x)}t'\right)}
            {\sum\limits_{t \in S(x)}\left(t - \frac{1}{\#S(x)} \sum\limits_{t' \in S(x)}t'\right)^{2}}
@EndDisplayMath
@EndifDoc
Thus the estimation for @math{a} is stored in @file{ofile1} and that for @math{b} is stored 
in @file{ofile2}. To subtract the trend from the data see operator @mod{subtrend}.
@EndDescription
@EndOperator
