turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

06-11-2015 09:36 AM

Is there a way to simulate data points that have been drawn from a Geometric Brownian Motion (Weiner Process)?

I am looking at this function:SAS(R) 9.2 Language Reference: Dictionary, Fourth Edition

But I don't see an option for a Weiner process.

I know the Black Scholes internally simulates a Weiner process but is it possible to see what a set of 10,000 numbers drawn from a Weiner process looks like?

Accepted Solutions

Solution

06-11-2015
02:47 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to eagles_dare13

06-11-2015 02:47 PM

I'll show you the standard Weiner process (mean=0, std dev=1) and you can generalize it if necessary.

A reference is https://me.ucsb.edu/~moehlis/APC591/tutorials/tutorial7/node2.html

The key observation is that the STEP SIZES of the Weiner process are Gaussian distribution, so you can use the RAND function in the DATA step to simulate the step sizes. In SAS/IML, you can use the RANDGEN or RANDFUN functions to generate the normally distributed step sizes.

proc iml;

/* simulate N time steps from Weiner process on interval [0,Tf] */

N = 1000;

Tf = 5;

call randseed(12345);

/* algorithm: step sizes are normally distributed */

N = N-1; /* X(0)=0, so N-1 random values */

dt = Tf/N;

sd = sqrt(dt);

steps = randfun(N, "Normal", 0, sd); /* random step sizes */

x = 0 // cusum(steps); /* X(0)=0 */

All Replies

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to eagles_dare13

06-11-2015 01:13 PM

I suggest you post this under the "SAS Statistical Procedures" and "SAS/IML Software and Matrix Computations" forums, I think you'll be more likely to catch the eye of someone familiar with this topic.

Tom

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to TomKari

06-11-2015 01:30 PM

Thanks Tom! **eagles_dare13**, I moved this thread to the SAS/IML community.

Anna

Solution

06-11-2015
02:47 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to eagles_dare13

06-11-2015 02:47 PM

I'll show you the standard Weiner process (mean=0, std dev=1) and you can generalize it if necessary.

A reference is https://me.ucsb.edu/~moehlis/APC591/tutorials/tutorial7/node2.html

The key observation is that the STEP SIZES of the Weiner process are Gaussian distribution, so you can use the RAND function in the DATA step to simulate the step sizes. In SAS/IML, you can use the RANDGEN or RANDFUN functions to generate the normally distributed step sizes.

proc iml;

/* simulate N time steps from Weiner process on interval [0,Tf] */

N = 1000;

Tf = 5;

call randseed(12345);

/* algorithm: step sizes are normally distributed */

N = N-1; /* X(0)=0, so N-1 random values */

dt = Tf/N;

sd = sqrt(dt);

steps = randfun(N, "Normal", 0, sd); /* random step sizes */

x = 0 // cusum(steps); /* X(0)=0 */

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Rick_SAS

06-11-2015 02:54 PM

Thank you. I copied your code but am getting:

ERROR: Invocation of unresolved module RANDFUN

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to eagles_dare13

06-11-2015 03:07 PM

Then replace that line with

steps = j(N,1);

call randgen(steps, "Normal", 0, sd); /* random step sizes */