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

Hi all,

 

I am using PROC GLM Contrast statement to see if my data displays any trend like linear or quadratic. Somehow when I use two CONTRAST statements at the same time, the CONTRAST output does not come out.

 

Below is my code:

PROC GLM DATA=mydata;

CLASS RESP_TIME;

MODEL score= RESP_TIME ;

CONTRAST 'Linear' RESP_TIME -2 -1 0 1 2;

CONTRAST 'Quadratic' RESP_TIME 2 -1 -2 -1 2;

run;

 

Another question is: is it possible to do the trend plot along with CONTRAST statement?

 

Thanks a lot!

Lizi

1 ACCEPTED SOLUTION

Accepted Solutions
sld
Rhodochrosite | Level 12 sld
Rhodochrosite | Level 12

Although it is possible to fit a quadratic model to only 3 time points, so few points provide very little support for the fit. 

 

SAS Usage Note 22912 illustrates how to acquire coefficients for polynomial contrasts.

 

I hope this helps.

 

View solution in original post

9 REPLIES 9
Reeza
Super User
Please post the log from that code. I think GLM may need a QUIT instead of RUN as well, which is why it may not be completing.
lizzy28
Quartz | Level 8

Thanks Reeza.

 

I added QUIT, and the log remains as below:

WARNING: More coefficients than levels specified for effect resp_time. Some coefficients will be ignored.

NOTE: CONTRAST Linear is not estimable.

WARNING: More coefficients than levels specified for effect resp_time. Some coefficients will be ignored.

NOTE: CONTRAST Quadratic is not estimable.

Reeza
Super User
Your contrast statements are not correct then. I don't know enough on how to fix those unfortunately. I would expect to run a quadratic model to have to test the quadratic, but I could be totally off base here. I'll move this to the Stat's forum as well.
PaigeMiller
Diamond | Level 26

@lizzy28 wrote:

Thanks Reeza.

 

I added QUIT, and the log remains as below:

WARNING: More coefficients than levels specified for effect resp_time. Some coefficients will be ignored.

NOTE: CONTRAST Linear is not estimable.

 


How many levels of the variable RESP_TIME are there?

 

Are there levels of RESP_TIME that have no Y values (due to missing data)?

--
Paige Miller
lizzy28
Quartz | Level 8

Thank you Reeza!

 

Paige, RESP_TIME has three levels with numeric values 1, 2 and 3, and it has not missing values. Thank you for looking into my question!

PaigeMiller
Diamond | Level 26

Then you can't specify a CONTRAST statement with 5 levels. You can only specify a CONTRAST statement with 3 levels.

 

My other question was about your Y variable, in this case SCORE, does it have a lot of missing values such that there is a level of RESP_TIME for which all the Y variables are missing?

--
Paige Miller
lizzy28
Quartz | Level 8

I see that I should only set three levels. One further question is how I should decide the L matrix for linear vs quadratic.

 

Yes, there are about 8% missing values in SCORE.

sld
Rhodochrosite | Level 12 sld
Rhodochrosite | Level 12

Although it is possible to fit a quadratic model to only 3 time points, so few points provide very little support for the fit. 

 

SAS Usage Note 22912 illustrates how to acquire coefficients for polynomial contrasts.

 

I hope this helps.

 

lizzy28
Quartz | Level 8

That makes sense. Thanks for the link. It provides me a quick understanding of polynomial coefficients.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 9 replies
  • 4047 views
  • 2 likes
  • 4 in conversation