BookmarkSubscribeRSS Feed
malakaext
Calcite | Level 5

Hi,

Can someone please help me with the following coding?

I need to create a data set of 1000 values for the following model:

X(t) = {(1-L)^0.4]^(-1)} e ,where e is a standard normal random variable and L is the lag operator. I don't know how to deal with the lag operator. finally I need to plot X vs. t.

Thanks

2 REPLIES 2
Tom
Super User Tom
Super User

Your formula blows up when L is greater than 1 as you will be trying to root of a negative number.

Assuming that by lag operator you mean you want to feed in the previous value of X?

57   data want ;

58    x=0;

59    do time=1 to 1000 ;

60      e=rannorm(0);

61      put time= x= e= ' -> ' @;

62      x= (1/((1-x)**0.4))*e ;

63      put x= ;

64      if x=. then stop;

65      output;

66    end;

67   run;

time=1 x=0 e=-0.107529115  -> x=-0.107529115

time=2 x=-0.107529115 e=0.3713905792  -> x=0.3565240426

time=3 x=0.3565240426 e=0.3788970702  -> x=0.4519686557

time=4 x=0.4519686557 e=-0.256832352  -> x=-0.326683778

time=5 x=-0.326683778 e=0.1424978021  -> x=0.1272627191

time=6 x=0.1272627191 e=0.3964266863  -> x=0.4186098767

time=7 x=0.4186098767 e=0.493639789  -> x=0.6132295837

time=8 x=0.6132295837 e=0.3337242418  -> x=0.4879849812

time=9 x=0.4879849812 e=2.3604100433  -> x=3.0851364281

NOTE: Invalid argument(s) to the exponential operator "**" at line 62 column 16.

time=10 x=3.0851364281 e=1.5859540911  -> x=.

x=. time=10 e=1.5859540911 _ERROR_=1 _N_=1

malakaext
Calcite | Level 5

Thanks . But I  need use the 1st 100 terms of the INFINITE  BINOMIAL expansion of the term (1/((1-x)**0.4)). Can you please modify your model according to it?

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 1445 views
  • 3 likes
  • 2 in conversation