Contributor
Posts: 39

# Dynamic simulation

I have a sample of 240 obs Yt, Xt.

I try to estimate the simple model:

Yt= a+bX{t-1}+Ut

Xt=c+dX{t-1}+Vt

I estimated from Historical regressions

1) a, b, Ut (for example a=2, b=-1)

2) c,d, Vt (for example c=4, d=3)

3) I Estimated the covariance matrix of the residuals from steps 1 and 2.  e.g {0.11 0.19,

0.19 0.15}

Simulations (1000 samples with 240 obs)

for each sample

4) I need to Generate an artificial dataset that replicates many of the key properties of the actual historical dataset.

--(i) has the same number of observations as the historical dataset (240 obs);

--(ii) Yt are NOT predictable (randomly generate Yt as Y = m + e, where m ( e.g. m=20 ) is the historical mean of actual Yt and e is a random draw from a normal distribution with mean zero); and

--(iii) the x variables have the same slopes and residual standard deviations as in the historical data from step 2 (randomly generate x’s by starting with the first observation in the actual historical dataset, x0, (e.g x0=5)and then generate

x1 = a + bx0 + s, where a and b are the intercept and slope(s) estimated in step 2 above and s is a random draw from a normal distribution with mean zero; once I have x1, move on to x2, x3, etc.).

--(iv) Important note: I need to use a random number generator to randomly draw e and s in steps 4(ii) and 4(iii).  I should make sure that e and s have standard deviations that match their historical values and that have the covariance matrix estimated in step 3.

5) Estimate the same regressions as in Steps 1 and 2, but using the artificial dataset created in Step 4. Record the intercept, slopes, and R2.

I would appreciate any help..

Thanks!

Orit

SAS Super FREQ
Posts: 4,242

## Re: Dynamic simulation

Chapter 13 of my book Simulating Data with SAS is titled “Simulating Data from Time Series Models.” Section
13.3 describes how to simulate multivariate autoregressive series by using the SAS/IML VARMASIM function. See also the
example in the SAS/IML documentation.

You can generate the 1000 samples in SAS/IML software and then write it to a data set to analyze the data with PROC ARIMA (or whatever regression procedure you are using).  There is an example of how to carry out this approach (simulate in IML, analyze with a PROC) efficiently on pp 206--207 of my book.

Contributor
Posts: 39

## Re: Dynamic simulation

Rick, hello,

I took your advice and I ordered both of your books to my faculty,

Meanwhile, until the books will arrive to the university, I'll appreciate if you will send me chapter 13, Section 13.3.

or an example to dynamic simulation, somthing that I can use.

Thank you,

Orit

SAS Super FREQ
Posts: 4,242

## Re: Dynamic simulation

All SAS Press books provide the complete code that appears in the book. You can download code for my books from the books' Web pages: SAS Press - Rick Wicklin Author Page

Contributor
Posts: 39

## Re: Dynamic simulation

Thank you!

Discussion stats
• 4 replies
• 276 views
• 4 likes
• 2 in conversation