BookmarkSubscribeRSS Feed
brophymj
Quartz | Level 8

I'm trying to figure out how the Contrasts statement works

 

I'm running a simple glm on a single factor (glm31_cover_type)

 

I want to test whether each of the parameter estimates is independent from the other levels of the factor cover type. I've read a few articles on this but it seems quite complicated. I thought there would just be a statement that would produce something like the attachment.

 

How would I adjust my code below so that I get something like the attached? So, for each level of the factor I want to get the standard error of the parameter differences. There are 5 levels so 5+4+3+2+1 = 15 standard errors.

 

 Specifically I'm confused by the "contrast label factor 1 -1" code. How do I change this to incororate a test of all parameter differences in the factor.  

 

 

proc genmod data=insurancedata;

class glm31_cover_type(ref="COMP");

Weight NbClaims;

model AvgClaim = glm31_cover_type/ dist=gamma link=log obstats SCALE=DEVIANCE CORRB;

contrast 'Label1' glm31_cover_type 1 -1 ;

ods output ParameterEstimates =myObStats CORRB = CorrMatrix Contrasts = TestOfContrasts;

run;


contrasts.GIF
3 REPLIES 3
data_null__
Jade | Level 19

I think you will find the LSMEANS effect(s) / diff; statement is more suited to the task of all differences.

brophymj
Quartz | Level 8
Will that give you an estimate of the significance of the difference for each of the 15 combinations above? I'm interested in the individual differences rather than an overall. If you open the attachment in my last post you will see what I'm after. It just allows me to group levels that are similar. For example looking at the effect of cover type on claim frequency I might group "adft" and "comp" together as there is no statistically significant difference in their parameter estimates.
data_null__
Jade | Level 19

LSMEANS will give you pair-wise differences.  Use the LSMESTIMATE to do what you are asking about where you take the mean of 1 or more levels and compare to mean 1 or more other levels.

 

It might look something like 

 

LSMESTIMATE effect -.5 -.5 .33333 .33333 .33333;

 

To compare the mean of levels 1+2 with mean of levels 3+4+5;  You may want more decimal places or use divisor option.

 

lsmestimate effect -3 -3 2 2 2 / divisor=6;

 

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 3 replies
  • 1422 views
  • 1 like
  • 2 in conversation