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

I am using PROC MIANALYZE after PROC MIXED. 

 

In trying to run a post-estimation test comparing two linear combinations of variables, using the TEST statement in PROC MIANALYZE, I am having trouble with what I am trying to do, so I am hoping someone can tell me if it is possible.

 

This is an example of what I'm trying to do:

example1: test intercept + (b1*SOMECONSTANT) = intercept + (b1*SOMECONSTANT) + b2

 

In words, I have a value that I would like to plug into the linear equation to compare these two models to each other.  Essentially, this is comparing two predicted values to each other.

 

I know that I can run the test this way (because I have run this and it works):

example2: test intercept + b1= intercept + b1+ b2

 

But, is there any way to multiply those coefficients (ex. b1) by a number?  Or, conversely, is my 2nd example a satisfactory test?

 

Thank you for any advice!

Erin

1 ACCEPTED SOLUTION

Accepted Solutions
ErinB
Fluorite | Level 6

Steve (and any others looking for an answer to this question) --

 

I figured it out!

 

You CAN include multipliers in the test statement, you just have to enter them in a specific way...

 

For example, if this is what you are testing:

3*(x1 + x2) + 9*(x3 + x4) = 0

 

You have to type the code this way:

 

test 3*x1 +3*x2 + 9*x3 + 9*x4=0

 

In other words, factor it out.

 

Thanks for all of your help and feedback!

View solution in original post

6 REPLIES 6
SteveDenham
Jade | Level 19

I might be missing something obvious here, but why not use TEST b2=0, which comes out with a bit of algebra ?  I would think this would be valid for all values of SOMECONSTANT.

 

If I am missing the obvious, please post back.

 

Steve Denham

ErinB
Fluorite | Level 6

Steve,

Thanks for the reply.

 

I should've used my more complicated example, because what you're saying is accurate.  They would cancel out.

I'll use a few actual numbers here.

 

I have 2 long linear combinations of numbers that I can get down to this formula:

 

9* (x1) + 3*( x4 ) = 0

 

The reason why the 9 and the 3 are important is that they are indicators of time (months), so if I omit those constants, I am allowing x1, for example, to have the same "effect" as x4, for example.  x1 and x4 in this example are each something that reflects a 1 month change.  So in order to talk about the estimated effect of that 9 month time period, I need to multiply x1 by 9.  Similarly in order to talk about the estimated effect of the entire 3 month time period, I need to multiply the x4  by 3.

 

I'm trying to use this test to compare the actual predicted values I calculated.

 

Thanks in advance for any suggestions or comments if I'm thinking about this in the wrong way!

SteveDenham
Jade | Level 19

I would have to noodle this around some to see if it would even work, but what about preprocessing the output dataset from PROC MI to get a new variable that has the effect of getting the response down to what you are interested in, and then applying MIANALYZE to that?  It's the only thing I can think of currently.

 

Steve Denham

ErinB
Fluorite | Level 6

Thanks for responding, Steve.  I'm not quite sure what you're thinking here.

 

I'm using PROC MIXED for my analysis, so what are you thinking about what I could do in that step that would allow me to multiply variables and numbers together in the test statement for MIANALYZE?

 

I had one other alternative idea -- but I'm not sure how this would work either.

 

What if I just ran PROC MIXED on a single imputed data set (really, do it separately for each of my 10 data sets), and then ran some sort of post-estimation test after that? Not even worrying about the MIANALYZE step.   Would there be a way to do my hypothesis tests that way?  Would I have to get creative with the ESTIMATE command?  I haven't used it before, so I'm not sure that could even allow for the multiplication by my 3 and 9.

 

ErinB
Fluorite | Level 6

Steve (and any others looking for an answer to this question) --

 

I figured it out!

 

You CAN include multipliers in the test statement, you just have to enter them in a specific way...

 

For example, if this is what you are testing:

3*(x1 + x2) + 9*(x3 + x4) = 0

 

You have to type the code this way:

 

test 3*x1 +3*x2 + 9*x3 + 9*x4=0

 

In other words, factor it out.

 

Thanks for all of your help and feedback!

SteveDenham
Jade | Level 19

Mark your answer as correct!

 

Thanks for working this out, Erin.  It will be useful to many, including me.

 

Steve Denham

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 1574 views
  • 1 like
  • 2 in conversation