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

I am currently analyzing the impact of an intervention on medication numbers using difference-in-difference analysis, but I have encountered several challenges.

 

Following the SAS support instructions, I conducted the difference-in-difference analysis. However, I noticed a discrepancy between my results and SAS's example (Usage Note 61830: Estimating the difference in differences of means).

 

In the example, the value of 'Mean Estimate' in 'Contrast Estimate Results' is identical to the 'Estimate' in 'Least Squares Means Estimate'. However, in my case, these values were different. I suspect this could be due to my use of the negative binomial distribution with a log link, resulting in exponential values. Consequently, I am unsure whether to rely on the 'Mean Estimate' in 'Contrast Estimate Results' or the 'Estimate' in 'Least Squares Means Estimate', and how to interpret the results."

 

Contrast Estimate Results

LabelMean EstimateMean Confidence LimitsL'Beta EstimateStandard Error
diff in diff1.511.490.410.0051

 

a*b Least Squares Means

abEstimateStandard Errorz valuePr > |z|
110.770.00434178.19<.0001
100.030.005086.5<.0001
010.720.00408177.71<.0001
000.400.0042693.11<.0001

 

Least Squares Means Estimate

EffectLabelEstimationStandard Errorz valuePr > |z|
time*hospitalizediff in diff0.410.0050981.01<.0001
1 ACCEPTED SOLUTION

Accepted Solutions
StatDave
SAS Super FREQ
If your response is a count of medications, then it is a discrete, categorical variable which is typically modeled using either the Poisson or negative binomial distribution. The "Generalized Linear Models with a Non-Identity Link" section of the note that you mentioned (61830) deals with the range of generalized linear models which includes many response distributions including Poisson, negative binomial, gamma and others, not just binary response models. The note just uses a binary response model as an example, but the methods discussed in that section apply to the range of models.

View solution in original post

8 REPLIES 8
sbxkoenk
SAS Super FREQ

This is the same question as posted in the programming board.

 

Home > Programming > Programming > Difference-in-difference
https://communities.sas.com/t5/SAS-Programming/Difference-in-difference/m-p/927128


Please do not duplicate your question on multiple boards.

Also take the right board. I will move this one to "Statistical Procedures"-board in a minute.

 

Koen

StatDave
SAS Super FREQ
Reread the text at the beginning of the "Generalized Linear Models with a Non-Identity Link" section - this section, and not the first section on a normal response, applies to your log-linked model. As stated there:

"Because this is not a linear combination of the model parameters or of the LS-means, you cannot use the ESTIMATE or LSMESTIMATE statements to estimate the difference in differences of means. "
Emily_Chi
Fluorite | Level 6

Thank you for providing clarification on this issue! It's really helpful for me.

StatDave
SAS Super FREQ
Note that when you use the ESTIMATE statement in PROC GENMOD, the results automatically include a "Mean Estimate" which, in your case, is 1.51. But this is a mean only when the contrast specified in the statement defines one population and not a comparison of populations such as a difference in difference contrast. The Mean estimate just applies the inverse of the link function to the computed contrast and is often meaningless. For the difference in difference contrast (1 -1 -1 1) in a log linked model, the Mean estimate is exp[log(mean_11)-log(mean_10)-log(mean_01)+log(mean_00)] which, when simplified is the ratio of mean ratios rather than the difference of mean differences: (mean_11/mean_10)/(mean_01/mean_00).
Emily_Chi
Fluorite | Level 6

If the outcome is not binary, I cannot use logistic regression in DID, right?

 

The outcome of my study is the number of medications, which is not the binary outcome. The outcome is continuous, however, it is a gamma distribution, so I used a log link to address the right-skew problem. I think that it could not use the DID with normal distribution, is there any suggestion for analysis of gamma distribution outcome in DID? Thank you.

 

sbxkoenk
SAS Super FREQ

https://communities.sas.com/t5/Statistical-Procedures/Difference-in-difference-for-gamma-distributio...

 

For difference in difference analysis with non-normal responses, see this note

 

Koen

StatDave
SAS Super FREQ
If your response is a count of medications, then it is a discrete, categorical variable which is typically modeled using either the Poisson or negative binomial distribution. The "Generalized Linear Models with a Non-Identity Link" section of the note that you mentioned (61830) deals with the range of generalized linear models which includes many response distributions including Poisson, negative binomial, gamma and others, not just binary response models. The note just uses a binary response model as an example, but the methods discussed in that section apply to the range of models.
Emily_Chi
Fluorite | Level 6

Thanks for your response.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 8 replies
  • 687 views
  • 5 likes
  • 3 in conversation