yesterday
sasalex2024
Obsidian | Level 7
Member since
07-22-2024
- 32 Posts
- 24 Likes Given
- 1 Solutions
- 1 Likes Received
-
Latest posts by sasalex2024
Subject Views Posted 44 Tuesday 249 Tuesday 320 Friday 391 Thursday 254 3 weeks ago 257 3 weeks ago 325 3 weeks ago 758 4 weeks ago 813 4 weeks ago 873 4 weeks ago -
Activity Feed for sasalex2024
- Posted Re: Clarification on Pre-Whitening Commands in SAS ARIMA on SAS Forecasting and Econometrics. Tuesday
- Liked Re: Clarification on Pre-Whitening Commands in SAS ARIMA for SASCom1. Tuesday
- Posted Re: Clarification on Pre-Whitening Commands in SAS ARIMA on SAS Forecasting and Econometrics. Tuesday
- Liked Re: Clarification on Pre-Whitening Commands in SAS ARIMA for SASCom1. Tuesday
- Posted Re: Clarification on Pre-Whitening Commands in SAS ARIMA on SAS Forecasting and Econometrics. Friday
- Posted Clarification on Pre-Whitening Commands in SAS ARIMA on SAS Forecasting and Econometrics. Thursday
- Liked Re: Testing for Constant Variance in Residuals Using PROC ARIMA for sbxkoenk. 2 weeks ago
- Liked Re: Testing for Constant Variance in Residuals Using PROC ARIMA for sbxkoenk. 2 weeks ago
- Posted Re: Testing for Constant Variance in Residuals Using PROC ARIMA on SAS Forecasting and Econometrics. 3 weeks ago
- Posted Re: Testing for Constant Variance in Residuals Using PROC ARIMA on SAS Forecasting and Econometrics. 3 weeks ago
- Liked Re: Testing for Constant Variance in Residuals Using PROC ARIMA for sbxkoenk. 3 weeks ago
- Posted Testing for Constant Variance in Residuals Using PROC ARIMA on SAS Forecasting and Econometrics. 3 weeks ago
- Liked Re: Likelihood Ratio Test for ARIMA Models for Rick_SAS. 3 weeks ago
- Posted Re: Likelihood Ratio Test for ARIMA Models on SAS Forecasting and Econometrics. 4 weeks ago
- Liked Re: Likelihood Ratio Test for ARIMA Models for Rick_SAS. 4 weeks ago
- Liked Re: Likelihood Ratio Test for ARIMA Models for Ksharp. 4 weeks ago
- Posted Re: Likelihood Ratio Test for ARIMA Models on SAS Forecasting and Econometrics. 4 weeks ago
- Liked Re: Likelihood Ratio Test for ARIMA Models for Ksharp. 4 weeks ago
- Posted Likelihood Ratio Test for ARIMA Models on SAS Forecasting and Econometrics. 4 weeks ago
- Got a Like for Re: Accessing standardized residuals: arima. a month ago
-
Posts I Liked
Subject Likes Author Latest Post 1 2 1 1 1 -
My Liked Posts
Subject Likes Posted 1 12-20-2024 04:50 PM
Tuesday
Thank you again SASCom1, very much.
However, one code produces the graph of CCF of Xt and Yt, and the other code produces the graph of CCF of Xt(1) and Yt(1). From what I heard, they are similar for practical purposes, but technically are not identical. So, if the two codes are the same, I am curious why the CCF graphs produced are not. Thank you again.
... View more
Tuesday
Dear SASCom1,
Thank you for your detailed and helpful reply.
So, I suppose this code is the correct one:
proc arima data=a;
identify var=Xt(1);
estimate p=0 q=1 method=ml noconstant;
identify var=Yt crosscorr=Xt;
run;
Is that right? If, for example, I write instead
proc arima data=a;
identify var=Xt(1);
estimate p=0 q=1 method=ml noconstant;
identify var=Yt(1) crosscorr=Xt(1);
run;
the latter will not be correct? I am somewhat confused, because when I read Pankratz (1991, p. 197), who writes:
"Consider the case of a single-input DR model. It is assumed that both X, and Y, have been transformed to induce constant variances. If differencing is needed to induce stationary means, we consider the differenced series, xt, and yt, with constant means mu_x and mu_y, respectively."
So, are we supposed to get crosscorrelation between xt and yt, or between X and Y? The 2nd code above gets CCF for xt (=Xt(1)) and yt (=Yt(1), but the first one gets CCF for X and Y.
Thank you very much.
... View more
Friday
I think I might have figured it out. Please let me know if what I wrote below is correct.
Assume, for simplicity, the absence of any seasonality. If in the first identity line Xt is differenced, say Xt(1), the same differencing must be noted in the cross-correlation line, i.e., crosscorr=Xt(1).
However, for Yt, whether it is Yt or Yt(1) depends on whether the original Yt series is stationary to begin with. The idea is to pre-whiten the stationary input (Xt or Xt(1)) first and apply the same filter to the stationary output, whether the latter is Yt or Yt(1).
If there is no need to difference Yt to induce stationarity, then we leave it as Yt in the last identify line. Otherwise, if it is necessary to difference Yt, we state it as Yt(1).
... View more
Thursday
Dear SAS Community,
I’d appreciate your help with the pre-whitening command statements. Suppose my original Xt series has the best model as ARIMA(0,1,1) (with no constant). Obviously, I need to filter my original Yt series with the same ARIMA(0,1,1) model for Xt, and then cross-correlate the filtered response with the filtered input series. However, I am unsure about the correct command in the second “identify” statement (after "estimate"). The example given in the SAS ARIMA manual (on pp. 238-239) is for an ARMA(1,1) model for Xt, meaning Xt does not get differenced. Is the following code correct for my case?
proc arima data=a;
identify var=Xt(1);
estimate p=0 q=1 method=ml noconstant;
identify var=Yt crosscorr=Xt;
run;
Or do I need to include the “(1)” in the second "identify" statement? Should the code be then:
proc arima data=a;
identify var=Xt(1);
estimate p=0 q=1 method=ml noconstant;
identify var=Yt(1) crosscorr=Xt(1);
run;
Thank you for your assistance.
... View more
3 weeks ago
Thank you very much sbxkoenk for the quick and detailed reply. Based on this, I've replied to my own question with a code, do you think it is acceptable as a solution? Thank you very much again.
... View more
3 weeks ago
proc arima data=a
identify var=Zt(1,12);
estimate p=(0)(0) q=(1)(12) method=ml noconstant;
forecast lead=0 interval=month id=Date out=results;
run;
data residuals_only;
set results;
if not missing(residual) then do;
Time + 1;
output;
end;
keep residual Time;
run;
/* Test for heteroscedastic residuals */
proc autoreg data=residuals_only;
model residual = Time / archtest;
output out=r r=yresid;
run;
... View more
3 weeks ago
Dear SAS Community,
I would like to ask for your advice on how to perform a formal test for constant variance (homoscedasticity) in the innovation series when using the proc arima procedure.
For example, the code below runs SARIMA (0,1,1)x(0,1,1)_12 model and generates a residual plot, which can visually help in identifying variance changes:
proc arima data=a
plots(only)=(residual(smooth));
identify var=Zt(1,12);
estimate p=(0)(0) q=(1)(12) method=ml noconstant;
run;
However, I was wondering if it is possible to conduct a formal test to determine whether the residuals of a fitted model are homoscedastic.
I’ve heard about a series of tests developed by McLeod and his co-authors, but I’m not sure how to implement such (or any relevant) tests in SAS.
I would greatly appreciate your guidance on this topic.
... View more
4 weeks ago
Thank you very much Rick_SAS, this is way better than mine. The only thing is, the printed table at the end doesn't display LL values (LOGLIK) in the 1st two columns, but apparently the number of paramaters in those model.
... View more
4 weeks ago
Dear Ksharp,
Thank you very much for the prompt and insightful reply. I've used the modified version of the code you referred to, and though my version perhaps is not the most efficient one, it seems to work. Do you think it can be accepted as a solution? Here is the code below.
/* ARIMA Model 1 (with more parameters) */
proc arima data=a plots=none;
identify var=zt;
estimate p=3 q=0 method=ml outstat=LLFull;
run;
/* ARIMA Model 2 (with fewer parameters) */
proc arima data=a plots=none;
identify var=zt;
estimate p=(1 3) q=0 method=ml outstat=LLRed;
run;
/* NOTE: If 'Pr > ChiSq' value exceeds 0.05, the model with more parameters is preferred */ data LRTEST; retain LR_Test; merge LLFULL(keep=_VALUE_ rename=(_VALUE_=valueFull)) LLRED(keep=_VALUE_ rename=(_VALUE_=valueRed)); if _N_ = 3 then LR_Test = 2 * abs(valueFull - valueRed); if _N_ = 6 then do DF = valueFull - valueRed; pValue = sdf("ChiSq", LR_Test, DF); end; label LR_Test='LR_Stat' pValue = 'Pr > ChiSq'; drop valueFull valueRed DF; run; proc print data=LRTEST (firstobs=6 obs=6) label noobs; run;
... View more
4 weeks ago
Dear SAS Community,
I would appreciate your assistance with a question regarding the discrimination between two ARIMA models using a likelihood ratio test.
Suppose, the full model is as follows:
proc arima data=a;
identify var=zt;
estimate p=3 q=0 method=ml;
run;
The restricted model is:
proc arima data=a; identify var=zt; estimate p=(1 3) q=0 method=ml; run;
I understand that one approach is to manually compute the test statistic using the formula:
LR=2*(LL_Full−LL_Restricted) and then compare it with the chi-squared distribution with the appropriate degrees of freedom.
However, I was wondering if there is a more efficient or automated way to perform this test within SAS (for any arbitrary full vs restricted ARIMA models), rather than calculating it manually.
Any guidance or suggestions would be greatly appreciated!
Thank you in advance for your help.
... View more
12-21-2024
08:05 PM
Dear Koen,
I also tried the code below, do yo think it is correct and consistent with yours? (even though I am sure it is not as efficient as yours). I've created standardized residuals by dividing the residuals by Std Error Estimate. (I have Time column in my original data.) The code is below, thank you very much again.
proc arima data=series_31; identify var=Yt(1) crosscorr=(X1t(1) X2t(1) X3t(1)) noprint; estimate q=1 input=( (1) X1t (1) X2t (1) X3t) method=ml outcorr outest=est3 outmodel=model3; forecast lead=0 interval=month id=Time out=results; run;
/* Creating standardized residuals */ data results; set results; st_resid = residual / 23.79973; run;
/* Plotting st. residuals over time */ proc sgplot data=results; vbar Time / response=st_resid; xaxis label="Time"; yaxis label="Standardized Residuals"; run;
... View more
12-21-2024
11:51 AM
Thank you very much for your lightning-fast response! Amazing how it works elegantly! Thanks again.
... View more
12-21-2024
10:38 AM
Thank you so much, I have run your code and it works too! It produces the same values as in the method given by Koen. Again, thank you very much.
... View more
12-21-2024
10:32 AM
Thank you very much for your help. I ran the following code based on yours (shown below this message), and although the log shows an error: "ERROR: Variable region is not on file WORK.SERIES_31," it still produces the abc table in the Work directory.
I apologize for troubling you again, but there is a column in that table (the 10th column, I believe) named "residual." I assume these are the residuals from the model, correct? And they are sorted I suppose. If so, could you please tell me how I can obtain these residuals in their original, "unsorted" order? I also need to plot them over time.
Thank you again!
----
proc arima data=series_31; where region=1 AND line=1 and product=1; identify var=Yt(1) crosscorr=(X1t(1) X2t(1) X3t(1)) noprint; estimate q=1 input=( (1) X1t (1) X2t (1) X3t) method=ml;
run; quit;
... View more
12-20-2024
04:50 PM
1 Like
Hi, thank you. This is the log:
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
NOTE: ODS statements in the SAS Studio environment may disable some output features.
69
70 ODS TRACE ON;
71 proc arima data=series_31;
72 identify var=Yt(1) crosscorr=(X1t(1) X2t(1) X3t(1)) noprint;
73 estimate q=1 input=( (1) X1t (1) X2t (1) X3t) method=ml;
74 run;
NOTE: The ODS graphics associated with the IDENTIFY statement is suppressed because of the presence of NOPRINT option.
Output Added:
-------------
Name: ParameterEstimates
Label: Maximum Likelihood Estimation
Template: ets.Arima.ParameterEstimates
Path: Arima.Estimate.ParameterEstimates
-------------
Output Added:
-------------
Name: FitStatistics
Label: Fit Statistics
Template: ets.Arima.FitStatistics
Path: Arima.Estimate.FitStatistics
-------------
Output Added:
-------------
Name: CorrB
Label: Correlations of Parameter Estimates
Template: ets.Arima.CorrB
Path: Arima.Estimate.CorrB
-------------
Output Added:
-------------
Name: ChiSqAuto
Label: Autocorrelation Check of Residuals
Template: ets.Arima.ChiSqAuto
Path: Arima.Estimate.ChiSqAuto
-------------
Output Added:
-------------
Name: ResidualCorrPanel
Label: Residual Correlation Panel
Template: ets.arima.Graphics.CorrPanel
Path: Arima.Estimate.ResidualCorrPanel
-------------
Output Added:
-------------
Name: ResidualNormalityPanel
Label: Residual Normality Panel
Template: ets.arima.Graphics.NormalityPanel
Path: Arima.Estimate.ResidualNormalityPanel
-------------
Output Added:
-------------
Name: ModelDescription
Label: Model for variable Yt
Template: ets.Arima.ModelDescription
Path: Arima.Estimate.Filter.ModelDescription
-------------
Output Added:
-------------
Name: MAPolynomial
Label: Moving Average Factors
Template: ets.Arima.Equation
Path: Arima.Estimate.Filter.MAPolynomial
-------------
Output Added:
-------------
Name: InputDescription
Label: Input Number 1
Template: ets.Arima.InputDescription
Path: Arima.Estimate.Filter.InputDescription
-------------
Output Added:
-------------
Name: NumPolynomial
Label: Numerator Factors
Template: ets.Arima.Equation
Path: Arima.Estimate.Filter.NumPolynomial
-------------
Output Added:
-------------
Name: InputDescription
Label: Input Number 2
Template: ets.Arima.InputDescription
Path: Arima.Estimate.Filter.InputDescription
-------------
Output Added:
-------------
Name: NumPolynomial
Label: Numerator Factors
Template: ets.Arima.Equation
Path: Arima.Estimate.Filter.NumPolynomial
-------------
Output Added:
-------------
Name: InputDescription
Label: Input Number 3
Template: ets.Arima.InputDescription
Path: Arima.Estimate.Filter.InputDescription
-------------
Output Added:
-------------
Name: NumPolynomial
Label: Numerator Factors
Template: ets.Arima.Equation
Path: Arima.Estimate.Filter.NumPolynomial
-------------
75 quit;
NOTE: PROCEDURE ARIMA used (Total process time):
real time 0.25 seconds
user cpu time 0.13 seconds
system cpu time 0.02 seconds
memory 15596.43k
OS Memory 36812.00k
Timestamp 12/20/2024 09:47:05 PM
Step Count 57 Switch Count 12
Page Faults 0
Page Reclaims 8661
Page Swaps 0
Voluntary Context Switches 531
Involuntary Context Switches 8
Block Input Operations 0
Block Output Operations 952
76
77 ODS TRACE OFF;
78
79 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
89
------------------
This is the code:
ODS TRACE ON; proc arima data=series_31; identify var=Yt(1) crosscorr=(X1t(1) X2t(1) X3t(1)) noprint; estimate q=1 input=( (1) X1t (1) X2t (1) X3t) method=ml; run; quit;
ODS TRACE OFF;
... View more