BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
yalexhouser
Calcite | Level 5

Hi,

I'm trying to estimate a simple VAR(2) model with a time trend. 

Code is:

proc varmax data=sim_data noprint;

model spend1 spend2 prod1 prod2 = time_period / p=2 xlag=0;

run;

When I run this   I get the following error message:

ERROR: The model is not full rank when the forecasts of regressors are computed. The VARMAX

procedure stopped processing further steps.

When I run the model without time period it works fine:

proc varmax data=sim_data noprint;

model spend1 spend2 prod1 prod2/ p=2 xlag=0;

run;

It also runs fine with one lag:

proc varmax data=sim_data noprint;

model spend1 spend2 prod1 prod2 = time_period / p=1 xlag=0;

run;

But two lags with a  time trend fails...  This is simulated data for the moment, so I'm pretty sure there's no colinearity between the regressors and the time trend,

What's going on here?

1 ACCEPTED SOLUTION

Accepted Solutions
user24feb
Barite | Level 11

If you try

Proc Varmax Data=sim_data;

  Model spend1 spend2 prod1 prod2 / p=2 Trend=Linear; /* or Quad */

  ID Time Interval=Month; /* if it is Month .. */

Run;

instead of

proc varmax data=sim_data noprint;

model spend1 spend2 prod1 prod2 = time_period / p=2 xlag=0;

run;

?

View solution in original post

4 REPLIES 4
stat_sas
Ammonite | Level 13

I think this is happening because of exogenous variable time_period that contains equally spaced values introducing a linearly dependency for higher lags.

yalexhouser
Calcite | Level 5

Yeah, that's what I figured, but it shouldn't be an issue, since xlag is equal to zero.   I  understand why it would be a problem with this model:

proc varmax data=sim_data noprint;

model spend1 spend2 prod1 prod2 = time_  p=2 xlag=1;

run;

since there would be no way to differentiate the impact of time_period(t) and time_period(t-1)

But that's not the model I'm running.

I feel like the SAS internals are running some model with multiple lagged exogenous variables in the forecasting step, instead of running the model I want.

If forecasting is going wrong, I'd like some way of stopping the VARMAX internals from attempting to forecast anything, since that's not of interest in this case.

Of course, via the frisch-Waugh theorem, I could just detrend the endogenous varialbes and then drop time_period from the VAR, but I'd prefer not to... especially as I've run into similar issues with VARMAX and dummy variables who are not in their own right colinear, but for whom a larger set of  lagged values are. 

user24feb
Barite | Level 11

If you try

Proc Varmax Data=sim_data;

  Model spend1 spend2 prod1 prod2 / p=2 Trend=Linear; /* or Quad */

  ID Time Interval=Month; /* if it is Month .. */

Run;

instead of

proc varmax data=sim_data noprint;

model spend1 spend2 prod1 prod2 = time_period / p=2 xlag=0;

run;

?

yalexhouser
Calcite | Level 5

That is closer to what I was looking for, of course since this is simulated data there is not a date interval per-say type but I could create something in a datastep I'm sure.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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
  • 4 replies
  • 2471 views
  • 0 likes
  • 3 in conversation