Time Series homework 1
Homework 1
Review of Dates, cubic splines, merging
Questions
(note: Click on SAS Code at the bottom to see the initial
SAS code for this problem - copy and paste it into SAS then
modify as needed)
In the SAS Code link below there are some (artifical) data
on calls to a shipping firm. One dataset has calls, and the
next has shipments. The dates are not exactly the same as you
can see.
- Run the program unmodified. From the correlations,
and keeping in mind the offset, what do you think is a
typical delay (in days) between an order being called
in and the resutling shipment? Plot the graph of shipments
and versus the lagged calls (lagged as you decided above)
Notes:
- Y=lag(X) sets Y to the X from the previous record
- Y=lag3(X) sets Y to the X 3 records back.
- @@ leaves the pointer where it is until line is
exhausted (optional: try removing it and see what
happens)
- See class notes or suggestions below for plot options.
- Using the information in the class notes, create date
variables for both data sets. Then merge by date as suggested
(remove the * from the by date statement) Plot calls and
shipments against date.
Note:
- You could use (for generic Y and X variables)
PROC PLOT; PLOT X*DATE="*" Y*DATE="+"/OVERLAY;
or
- PROC GPLOT; PLT (X Y)*DATE/OVERLAY;
SYMBOL1 V=NONE I=JOIN C=GREEN;
SYMBOL2 V=NONE I=JOIN C=BLACK;
- Now, either before or after merging, use PROC EXPAND to fill
in some values for shipments where they are missing. In this way,
get a dataset with date, calls and shipments where missing shipments
have been imputed. Repeat the correlation and the plot from part (1)
with the newly completed shipments data. Comment on the effect of
the imputations.
- Give the equation that is used to interpolate between the 5th
and 7th value of shipments.
- Explain what these are doing:
- (obs=10)
- the label option in proc print
- call1-call3 (versus call1 call3 without the "-")
- (optional)
Try this in the merged dataset
PROC ARIMA; I VAR=SHPMNTS CROSSCOR=(CALLS); RUN;
SAS Code
output