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

I am running two separate regressions using proc surveyreg as follows.

 

proc surveyreg data=have1; cluster date;
model y= x1 x2 x1*x2 x3 x4/ adjrsq;run;quit;

 

proc surveyreg data=have2; cluster date;
model y= x1 x2 x1*x2 x3 x4/ adjrsq;run;quit;

 

I would like to test whether the interaction term x1*x2 from the first model equals x1*x2 from the second model. I can compare coefficients within the same model by using the contrast statement but I want to do it for two separate models. I would appreciate any help.

1 ACCEPTED SOLUTION

Accepted Solutions
StatDave
SAS Super FREQ

To do this you need to fit a single model to all of the data. Combine (concatenate) the two data sets and add a binary group variable that indicates the observations in each part of the data. Then use that variable to interact with the model parameters as described in this note

View solution in original post

6 REPLIES 6
StatDave
SAS Super FREQ

To do this you need to fit a single model to all of the data. Combine (concatenate) the two data sets and add a binary group variable that indicates the observations in each part of the data. Then use that variable to interact with the model parameters as described in this note

lezgin
Obsidian | Level 7

@StatDave 

 

A quick question. What if I don't have the exact same set of independent variables in the two models? I still want to compare the coefficient of the interaction x1*x2 across models. How can I do an F-test here?

 

 

StatDave
SAS Super FREQ

Well, that complicates things. Let's say you have one additional predictor in one of the models. Fit the model that has the extra predictor, then modify the response in that data set by subtracting the product of the additional predictor and its associated parameter estimate. Now, if you fit the model without the additional predictor to that modified response, the parameter estimates for the other predictors should be unchanged. You can then proceed with the method I mentioned earlier now that the predictors in the two models are the same.

PaigeMiller
Diamond | Level 26

@StatDave wrote:

Well, that complicates things. Let's say you have one additional predictor in one of the models. Fit the model that has the extra predictor, then modify the response in that data set by subtracting the product of the additional predictor and its associated parameter estimate. Now, if you fit the model without the additional predictor to that modified response, the parameter estimates for the other predictors should be unchanged. You can then proceed with the method I mentioned earlier now that the predictors in the two models are the same.


But this no longer answers the original question. Once you add a term in the model, and then somehow try to subtract out its effect, you are not getting the same coefficient as when you fit the model to all terms. I consider the question of testing the equality of model coefficients to be one that cannot be logically answered unless both models have the same terms.

--
Paige Miller
StatDave
SAS Super FREQ

Try it.  Suppose you have, like OP suggests, two simple regression models, say: 

y=x1 x2 x3 , and 

y=x1 x2 x3 x4

if you fit the second model and the x4 parameter estimate is 2.3, then if you fit the model

y-2.3*x4=x1 x2 x3

you get the same parameter estimates for x1-x3 and you can then combine these data sets and make a comparison of, say, the two x1 parameters.

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!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 6 replies
  • 785 views
  • 1 like
  • 3 in conversation