Group Abstract Group Abstract

Message Boards Message Boards

Specify a variable as random error?

Posted 7 years ago

I've been attempting to solve a difference equation similar to an ARMA process. The equation however contains a random disturbance / stochastic term that I'm not sure how to input. I've tried $ \epsilon$ and I've tried $ e[t] $. Anybody know of how to add this correctly?

I've managed to get the proper solutions using RSolveValue; but now just need to correctly specify the error term.

Thanks

POSTED BY: A.I. S
12 Replies
Posted 7 years ago

Hi Neil,

Sorry to flood the thread - just hoping to minimize your efforts and time spent at my expense. I was completely wrong in my previous response to which I say your code was outputting a 'wrong' solution I was looking for. It's indeed exactly correct and just specified in an unfamiliar way. It required some simple clerical simplifications and the solutions maintain the same solution.

$ \left\{\left\{a(n)\to (-3)^n 2^{1-2 n}\right\}\right\} $ is actually identical to $ a(n) \rightarrow (2)(-0.75)^t $ after simplification. My apologies for that.

And again thanks so much for the help.

Best, Ali

POSTED BY: A.I. S
Posted 7 years ago

In case you need any further examples I bring up an explicit problem. I included one above in a reply btw hopefully that adds some clarification. For clarify though here's the explicit form of the exact question I'm seeking an answer to:

I) Solve the following initial-value difference equations. Plot the time path of Yt and discuss the convergence or divergence of the solutions as $ t \rightarrow \infty $

$$ y_t = 1.6 + 0.75 y_{t-1} + \epsilon_t $$ $$y_0 = 2 $$

At first it was an issue with the error term. But now that you showed me the syntax for that -- all that would remain is how to specify the initial conditions correctly. What's odd is I'm not getting an error and your code is directly from the references so I can't see it being incorrect. But the solution it gives me when I use your code snippet on these problems with the initial conditions specified I get an unfamiliar answer as you see above.

Hope this clears some things up.

Thanks again.

POSTED BY: A.I. S
Posted 7 years ago

I'm not sure what's going on here but you might have some insight on this:

Following you code above using RSolve. I used it to find the solution to virtually the same problems with different coefficients.

RSolve[{4 a[n] + 3 a[n - 1] == 0, a[0] == 2}, a[n], n]

The (latex) output Mathematica gives is:

$ \left\{\left\{a(n)\to (-3)^n 2^{1-2 n}\right\}\right\}$

I'm not sure what exactly is going on here because that isn't exactly a solution I can make any sense of. The correct solution to this equation given initial conditions would be:

$ y^h_t = 2(-0.75)^t $ representing the homogenous portion of the solution. At least this is my understanding and am fairly confident is the correct solution. Oddly I get this solution when inputting the following text into Mathematica and ignoring the initial condition parameter:

RSolve[4 a[n] + 3 a[n - 1] == 0, a[n], n]

Gives me: $ \left\{\left\{a(n)\to c_1 \left(-\frac{3}{4}\right)^{n-1}\right\}\right\} $

Following setting up the initials I would get to my answer. Not sure you're able to see where my misunderstanding may lie, but I appreciate the time.

Best, Ali

POSTED BY: A.I. S
POSTED BY: Neil Singer
Posted 7 years ago

Sorry! After closing Mathematica and re-opening it seems it works again.

POSTED BY: A.I. S
Posted 7 years ago
POSTED BY: A.I. S

Ali,

Have you looked at the function ARMAProcess? The documentation is here. I think this is what you want. They show how to compute stationarity, etc.

Regards,

Neil

POSTED BY: Neil Singer
Posted 7 years ago
POSTED BY: A.I. S

Ali,

My previous post seems to have the "updating name" problem. I hope this helps -- Was this what you were asking?

Regards,

Neil

POSTED BY: Neil Singer
Posted 7 years ago

Ali,

I think what you need is something like this (I modified an example from the documentation)

RSolve[{a[n + 1] - 2 a[n] + eps[n] == 1, a[0] == 1}, a[n], n]

Which returns a[n] as a function of n and eps[n]. Your eps[n] is a random sequence. To simulate it you would need to generate points for your eps using something like RandomVariate[].

I am not sure you will obtain solutions for complicated equations and you may just have to numerically generate those solutions using the recurrence relationship like this:

In[20]:= RecurrenceTable[{a[n + 1] == 3 a[n], a[1] == 7}, a, {n, 1, 
  10}]

Out[20]= {7, 21, 63, 189, 567, 1701, 5103, 15309, 45927, 137781}

In[22]:= RecurrenceTable[{a[n + 1] == 
   3 a[n] + RandomVariate[NormalDistribution[1, 3]], 
  a[1] == 7}, a, {n, 1, 10}]

Out[22]= {7., 22.4549, 68.8196, 207.914, 625.196, 1877.04, 5632.58, \
16899.2, 50699., 152099.}
POSTED BY: Updating Name
Posted 7 years ago

Thanks for the suggestion Neil,

I apologize for any possible confusions. I’ll post an example. The nature of the question is to solve difference equations, in time, with a stochastic disturbance. In other words just solving for the particular solutions and all homogenous solutions to an SDE (stochastic difference equation). I believe on Mathematica this is referenced instead as a recurrence equation. As an example: Suppose an AR(1):

$$ \alpha_o + \beta_1 X_{t-1} + \epsilon_t = y_t $$

The solution to this would follow the null solution and the particular solutions. Regardless of which however I have to have a way to set the random parameter $ \epsilon_t $.

This is of course for pure conceptual and analytical understanding of the solutions behind ARMA process'. As far as I know, I'm not sure to it's direct application. But functionally an ARMA or AR process has a solution. I'm looking for how to derive to that solution but with an error added.

As an added example of what I managed to get correct. I got a solution to a difference equation specified as follows:

$$ RSolveValue[ y[t] == \alpha + \beta_1 x[t-1] + \beta_2 x[t-2], y[t], t] $$

This actually got me very close, if not exactly what I was looking for. But I had to truncate the equation so as to not contain the random disturbance term $ \epsilon_t $

Again any help is greatly appreciated. Thanks, Ali

POSTED BY: A.I. S

Ali,

I do not understand from your post what you want to do. I am guessing from your post that you have either a dynamic system with a random input or a random process. You really need to post some example code for anyone to help because it is not clear what "solve" means in your context. For example, are you trying to simulate the process or are you trying to obtain statistics (ie correlations or covariances) or are you trying to use ARMAProcess[] or a related function to create a model? If you post an example, people here can be more helpful.

Regards,

Neil

POSTED BY: Neil Singer
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard