BookmarkSubscribeRSS Feed
RickyS
Quartz | Level 8

Good Afternoon,

I'm trying to follow Rick Wilkins great blog from Oct 20148 on bootstrapping but for a time series exercise.  The data on my end is pretty limited, while we have approximately 400 observations we only have 19 years of annual data on those observations right now.

 

The autocorrelations did not show lags but I think that is more a function of annual data and expect that when we are able to migrate to use monthly data we may see some laggards. 

 

In the interim bootstrapping seemed like a good idea to ensure we are comfortable with the estimates and confidence intervals for the potential predictors, and I found Rick's recent case resampling blog and I'm trying to work through it with Proc Arima.  Right now I'm struggling with some coding syntax as well as open ended questions of is this how and why.

 

Here is some sample data and sample variables

 

DATA COMMERCIAL_ALL_YEARS1;

input @1 Account_name $ 7.

@9 Date_Year mmddyy10.

@18 X1 13.

@32 X2 3.

@36 X3 4.2

@41 X4 5.4

@47 X5 4.3

@52 X6 4.3

@57 Y 4.3;

format Date_Year mmddyy10. X1 best13.;

cards;

 

Sample1 1/1/1999 2507741000000 145 0.46 5.330 3.00 1.77 0.30

Sample1 1/1/2000 2708403000000 187 -0.20 6.456 6.82 1.67 0.31

Sample1 1/1/2001 2901728000000 266 2.90 3.687 4.52 1.68 0.30

Sample1 1/1/2002 2923307000000 229 2.51 1.726 5.24 1.92 0.32

Sample1 1/1/2003 2963189000000 176 3.01 1.151 2.55 1.85 0.30

Sample1 1/1/2004 3004471000000 093 1.49 1.563 1.73 1.69 0.29

Sample1 1/1/2005 2998451000000 086 0.01 3.512 2.14 1.44 0.28

Sample1 1/1/2006 3148069000000 066 -0.31 5.153 1.61 1.26 0.27

Sample1 1/1/2007 3348322000000 078 0.70 5.268 3.00 1.17 0.26

Sample1 1/1/2008 3538114000000 138 1.88 2.965 8.47 1.55 1.90

Sample1 1/1/2009 3714737000000 211 3.38 0.556 3.01 2.62 1.60

Sample1 1/1/2010 3951332000000 106 3.01 0.312 2.96 3.70 1.00

Sample1 1/1/2011 4156222000000 086 1.77 0.303 3.74 3.18 0.50

Sample1 1/1/2012 4505611000000 087 1.62 0.283 2.78 2.58 0.30

Sample1 1/1/2013 4798944000000 071 2.91 0.167 1.86 2.08 0.28

Sample1 1/1/2014 5121573000000 054 1.92 0.124 3.20 1.69 0.27

Sample1 1/1/2015 5547467000000 079 1.62 0.227 4.54 1.45 0.26

Sample1 1/1/2016 5835106000000 099 1.60 0.644 2.28 1.35 0.29

Sample1 1/1/2017 6137421000000 071 0.64 1.153 2.31 1.29 1.00

Sample2 1/1/1999 2507741000000 145 0.46 5.330 3.00 1.77 0.30

Sample2 1/1/2000 2708403000000 187 -0.20 6.456 6.82 1.67 0.31

Sample2 1/1/2001 2901728000000 266 2.90 3.687 4.52 1.68 0.30

Sample2 1/1/2002 2923307000000 229 2.51 1.726 5.24 1.92 0.32

Sample2 1/1/2003 2963189000000 176 3.01 1.151 2.55 1.85 0.30

Sample2 1/1/2004 3004471000000 093 1.49 1.563 1.73 1.69 0.29

Sample2 1/1/2005 2998451000000 086 0.01 3.512 2.14 1.44 0.28

Sample2 1/1/2006 3148069000000 066 -0.31 5.153 1.61 1.26 0.27

Sample2 1/1/2007 3348322000000 078 0.70 5.268 3.00 1.17 0.26

Sample2 1/1/2008 3538114000000 138 1.88 2.965 8.47 1.55 1.90

Sample2 1/1/2009 3714737000000 211 3.38 0.556 3.01 2.62 1.60

Sample2 1/1/2010 3951332000000 106 3.01 0.312 2.96 3.70 1.00

Sample2 1/1/2011 4156222000000 086 1.77 0.303 3.74 3.18 0.50

Sample2 1/1/2012 4505611000000 087 1.62 0.283 2.78 2.58 0.30

Sample2 1/1/2013 4798944000000 071 2.91 0.167 1.86 2.08 0.28

Sample2 1/1/2014 5121573000000 054 1.92 0.124 3.20 1.69 0.27

Sample2 1/1/2015 5547467000000 079 1.62 0.227 4.54 1.45 0.26

Sample2 1/1/2016 5835106000000 099 1.60 0.644 2.28 1.35 0.29

Sample2 1/1/2017 6137421000000 071 0.64 1.153 2.31 1.29 1.00

;

RUN;

 

ods graphics on;

proc arima data=COMMERCIAL_ALL_YEARS1;

title "X Variables";

identify var=Y

crosscorr= (X1 X2 X3 X4 X5 X6) nlag= 3;

estimate

input= (X1 X2 X3 X4 X5 X6)

outcorr outcov outest= estimates1;

run;

quit;

title;

ods graphics off;

 

/*********************************************************************************************

Step 2 Resample 5000 times from the data to form 5000 bootstrap samples

currently using the parameter variable names and estimates from proc arima

**********************************************************************************************/

title "Bootstrap Distribution of Model Estimates";

title2 "Case Resampling";

%let NumSamples = 5000;

%let MU = .59032;

%let NUM1 = -3.011;

%let NUM2 = -0.004;

%let NUM3 = .15342;

%let NUM4 = -0.08528;

%let NUM5 = 0.18372;

%let NUM6 = 0.07935;

 

 

/* 2. Generate many bootstrap samples by using PROC SURVEYSELECT */

proc surveyselect data=COMMERCIAL_ALL_YEARS1 NOPRINT seed=1

out=BootCases1(rename=(Replicate=SampleID))

method=urs

samprate=1

/* OUTHITS */

reps=&NumSamples;

run;

title;

 

/*************************************************************************************************

Step 3 Compute the statistics for each bootstrap sample

Should I be using Proc Arima? Or do I use Proc Reg because I'm modeling

frequency of the observations that are being sampled ?

**************************************************************************************************/

proc arima data= BootCases1;

title "Bootstrap Distribution of Model Estimates";

identify var=Y

crosscorr= (X1 X2 X3 X4 X5 X6) nlag= 3;

estimate

input= (X1 X2 X3 X4 X5 X6)

outcorr outcov outest= PEBoot;

run;

quit;

title;

ods graphics off;

 

OR

 

proc reg data=BootCases1 outest=PEBoot1 noprint;

by SampleID;

freq NumberHits;

model Y = X1 X2 X3 X4 X5 X6;

run;

quit;

1 REPLY 1
Rick_SAS
SAS Super FREQ

IMHO, you should resample the residuals (innovations) from the ARIMA model and use them to create new series. That will preserve the autocorrelations and other time-dependent properties of the series. If you use ARIMA for the initial estimates, use ARIMA again to analyze each bootstrap sample.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 523 views
  • 0 likes
  • 2 in conversation