Saturday, June 12, 2021

Stochastic and Deterministic trend using R (Applied Econometrics)

Stochastic and Deterministic trend using R

Let’s say that there are two variables. The share price of Nepal Lever Ltd and there’s a NEPSE index. We will now identify whether the NEPSE index has a stochastic or a deterministic trend.

For this we have to install the packages and import the data as in .csv files (this data import is skipped over here).

For this: tseries would be the package.

Now, in R studio, it is

library(tseries)

attach(NepaLever)

nepse = NepaLever $ NEPSEINDEX

Now it is to be noted that if the time series has trend then its parameters may not be stable and remain same in the future and our forecast may not be correct.

Let’s plot.

plot.ts(nepse)

See the figure. If the trending variable change in an uncertain amount in each period (vt) say, then it is known as the stochastic trend.

Now, let’s see for deterministic trend

Say, there is the data named as “datsalesyear”

Now, In R,

library(tseries)

attach(datsalesyear)

plot.ts(datsalesyear)

After this, view the graph. If the change is constant then there’s a deterministic trend.

SOLUTION: If the series has a deterministic trend the solution is de trending.

         If the series has a stochastic trend the solution is re trending.

Note: More will be discussed on re trending and de trending on upcoming blogs.


Thank You

P.S Comments are lauded.

Aditya Pokhrel

No comments:

Post a Comment

Regression Discontinuity - How to determine whether it is Sharp or Fuzzy RD ? Simplest Look.           Regression discontinuity design is ga...