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;
I think you will find the LSMEANS effect(s) / diff; statement is more suited to the task of all differences.
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;
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.