Programming the statistical procedures from SAS

Test for trend using median values

Accepted Solution Solved
Reply
Contributor
Posts: 23
Accepted Solution

Test for trend using median values

Hi all,

 

I'm trying to perform a test for trend in an ANOVA procedure. For example: I have 4 categories of a blood parameter (from which I obtained the median values), and I want to see whether some kind of baseline characteristic (e.g. age) increases linearly with this blood parameter.

 

This is what I've tried:

PROC GLM DATA=my.data;

CLASS bloodparameter;

MODEL age = bloodparameter;

CONTRAST "linear trend" bloodparameter 1.71 2.14 2.63 3.62 ;

MEANS bloodparameter;

RUN;

 

I searched on the internet and I saw the following code for the linear trend test: x -3 -1  1  3.

Therefore I replaced it with the median values, since they are not equally spaced.

However, SAS says the trend is not estimatable. What am I doing wrong?

 

Thanks a lot in advance.

Kind regards, M.


Accepted Solutions
Solution
‎11-04-2016 06:19 AM
Respected Advisor
Posts: 2,655

Re: Test for trend using median values

[ Edited ]

There are several on-line calculators that can give the coefficients for a linear trend with unequal spacing.  The key is that the coefficients in a CONTRAST statement must sum to zero.  You can do this by subtracting the mean of the values you have from each individual value.  In this case, I got -0.815 -0.385 0.105 1.095.  Try plugging in those values where you currently have 1.71 2.14 2.63 3.62,

 

Steve Denham

View solution in original post


All Replies
Grand Advisor
Posts: 9,466

Re: Test for trend using median values

Check PROC CATMOD which can perform ANOVA or REG analysis.

And there is already an example like yours about social ability in documentation.

Contributor
Posts: 23

Re: Test for trend using median values

I indeed did an ANOVA and I imputated the median values as new variable, and put this in the class statement! So it's solved! Thanks for the input!
Grand Advisor
Posts: 9,466

Re: Test for trend using median values

Or you can just check the correlation coefficient of row and column variable by PROC FREQ.

Check statistical  GAMMA,Kendall's Tau,Somer's D .........

Solution
‎11-04-2016 06:19 AM
Respected Advisor
Posts: 2,655

Re: Test for trend using median values

[ Edited ]

There are several on-line calculators that can give the coefficients for a linear trend with unequal spacing.  The key is that the coefficients in a CONTRAST statement must sum to zero.  You can do this by subtracting the mean of the values you have from each individual value.  In this case, I got -0.815 -0.385 0.105 1.095.  Try plugging in those values where you currently have 1.71 2.14 2.63 3.62,

 

Steve Denham

Contributor
Posts: 23

Re: Test for trend using median values

Thanks! It worked Smiley Very Happy

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 5 replies
  • 297 views
  • 0 likes
  • 3 in conversation