Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Home
- /
- Analytics
- /
- Stat Procs
- /
- Re: PROC Mixed treatment effect percentage change

Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

🔒 This topic is **solved** and **locked**.
Need further help from the community? Please
sign in and ask a **new** question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 03-25-2021 10:40 AM
(2554 views)

Hi All,

I am running a treatment effect longitudinal analysis with the outcome being a log transformed value collected over 5 days.

My covariates are time and treatment group (intervention vs. control) and their interaction (treatment*time).

The aim of the analysis is to determine if there is a treatment effect in favour of the intervention but expressed as a percentage change.

I have fitted my model assuming a fixed effect for time, treatment group and their interaction with a random intercept.

proc mixed; class treatment; model outcome= time time*treatment / s; random intercept/subject=ID; run;

Could someone point me to literature or example that illustrates how the treatment effect is determined as a percentage? Or an example if any?

Regards

Kennedy

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

It looks to me that your response variable is a log-transformed variable. The percent difference in lsmeans that you want would be on the logged scale, correct?

Like @SteveDenham pointed out, you can save the LSMEANS results (using an ODS OUTPUT statement) and use SAS data steps to compute the percent difference in lsmeans. However, this will not give you standard errors / p-values / confidence intervals. If you also wanted to make inferences on the percentage, you might consider using PROC NLMIXED to fit your model, and use the ESTIMATE statement in PROC NLMIXED to compute the percent difference. The ESTIMATE statement would produce the p-value and 95% confidence interval for you on the estimate (which is the percent difference).

For method 2 suggested by @SteveDenham, I assume he wanted you to use the Log link on your log-transformed variable? I just wanted to point out that these two methods will not give you the same model. Also, Steve might mean pct_change = 100* (exp(diff in lsmeans) -1) rather than pct_change = 100* (diff in lsmeans -1). Please correct me if I am wrong @SteveDenham.

Jill

21 REPLIES 21

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

I can think of two ways, but neither is done entirely within PROC MIXED. I'll list them in order of probable appropriateness.

Method 1: Get the lsmeans and differences into datasets, merge them and post process it, dividing the difference from pretreatment for each post treatment time lsmean by the pretreatment time lsmean and multiply by 100.

Method 2: Shift to PROC GLIMMIX, use a log link. The differences will be ratios which are "fold" changes. From there convert to percentage changes by calculating pct_change = 100* (diff in lsmeans -1).

What you should NOT do is divide the values by each pretreatment value and analyze the ratios as if they were normal. This ignores all covariance within subject, plus ratios of variables with normal errors generally do not have normal errors.

SteveDenham

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Thank you very much Steve.

I will work to implement this approach and see what I get.

I will work to implement this approach and see what I get.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

It looks to me that your response variable is a log-transformed variable. The percent difference in lsmeans that you want would be on the logged scale, correct?

Like @SteveDenham pointed out, you can save the LSMEANS results (using an ODS OUTPUT statement) and use SAS data steps to compute the percent difference in lsmeans. However, this will not give you standard errors / p-values / confidence intervals. If you also wanted to make inferences on the percentage, you might consider using PROC NLMIXED to fit your model, and use the ESTIMATE statement in PROC NLMIXED to compute the percent difference. The ESTIMATE statement would produce the p-value and 95% confidence interval for you on the estimate (which is the percent difference).

For method 2 suggested by @SteveDenham, I assume he wanted you to use the Log link on your log-transformed variable? I just wanted to point out that these two methods will not give you the same model. Also, Steve might mean pct_change = 100* (exp(diff in lsmeans) -1) rather than pct_change = 100* (diff in lsmeans -1). Please correct me if I am wrong @SteveDenham.

Jill

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Thank you Jiltao.

I will look for PROC NLMIXED references that specifically address the percentage change.

This is definitely helpful.

I really thank you both.

I will look for PROC NLMIXED references that specifically address the percentage change.

This is definitely helpful.

I really thank you both.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Yes my response variable is log transformed.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

@Naviava1973 , I missed that your response was already log transformed. That means that for the first method I mentioned, the lsmeans need to be preprocessed by exponentiating. The same would apply to any confidence bounds. The second method could be applied directly to the lsmeans you currently obtain as well as any confidence bounds. As @jiltao said, you would have to use NLMIXED to get valid standard errors for the means on the original scale.

SteveDenham

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Hi Steve,

Thanks for the advise.

I really appreciate.

Regards

KO

Thanks for the advise.

I really appreciate.

Regards

KO

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Hi Jil,

I have run the approach proposed by Steve Denham. I was wondering if you could point me to a reference for NLMIXED that has done something similar so I can compare findings from both methods.

Naviava

I have run the approach proposed by Steve Denham. I was wondering if you could point me to a reference for NLMIXED that has done something similar so I can compare findings from both methods.

Naviava

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Here is the documentation for PROC NLMIXED, where you can find syntax and example code --

Suppose your treatment contains levels A and P, and your data is already sorted by ID. Then if this is your PROC MIXED statement --

```
proc mixed;
class treatment;
model outcome= time treatment time*treatment / s;
random intercept/subject=ID;
lsmeans treatment / e;
run;
```

You might write the following PROC NLMIXED program to fit the same model. Please note that the LSMEANS statement in PROC MIXED above was computed at mean value for TIME, which would be displayed in the E option output. For illustration purpose, I used 5 as the mean value for time for my sample code below. You would need to replace that with whatever mean value was used in PROC MIXED.

```
proc nlmixed;
parms b0=2 b1=1.2 b2=0.5 b3=1.2 sb=2 se=1; ** you might want to specify more reasonable starting values;
mu = b0 + b1*time + b2*(treatment="A") + b3*time*(treatment="A") + u;
model outcome ~ normal(mu, se);
random u ~ normal(0, sb) subject=ID;
estimate 'percent difference in the A and P at the mean time of 5' 100*(b2+b3*5)/(b0+b1*5);
run;
```

Please let me know if this does not work out.

Jill

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Dear Jill,

Thank you very much.

This has worked out perfectly and I can now see the outcome I was looking for though I noticed wide 95% CIs.

Once more, I really appreciate the support from you and the SAS users group.

Regards

KO

Thank you very much.

This has worked out perfectly and I can now see the outcome I was looking for though I noticed wide 95% CIs.

Once more, I really appreciate the support from you and the SAS users group.

Regards

KO

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

- Tags:
- denham

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Here is how I would approach this. There are two levels of group (say A and B) and two levels of time (t0 and t+2). I would use PROC MIXED as you have correlated responses. Follow this up with a post-analysis processing to get the percent change. Something like this:

```
proc mixed data=have;
class group time subject; /* subject is a member of one of the levels of group */
model response = group time group*time;
repeated time/type=un subject=subject;
lsmestimate group*time 'Baseline Group A' 1 0 0 0;
lsmestimate group*time 'Baseline Group B' 0 0 1 0;
lsmestimate group*time 'Difference over time for Group A' 1 -1 0 0;
lsmestimate group*time 'Difference over time for Group B' 0 0 1 -1;
```

lsmestimate group*time 'Difference between groups over time (B - A)' -1 1 1 -1;
ods output lsmestimates=lsmestimates;
run;

Then you can calculate the percent change in each group by dividing the difference over time by the baseline for that group. The p value from the last lsmestimate would apply to the difference in group changes. No place along here would there be an analysis of percent change.

I strongly recommend against analyzing the percent changes as a response variable. See Harrell's *Applied Regression Strategies* or the website run by the Vanderbilt University biostats department https://discourse.datamethods.org/t/author-checklist/3407 . In particular, see this webpage: http://hbiostat.org/bbr/md/change.html#sec:changegen for the many caveats on analyzing change scores.

SteveDenham

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

```
proc glm data=have;
class group covA covB;
model response = covA covB covC baseline group group*baseline;
lsmeans group/pdiff;
run;
```

@Rhea1234, this code should help you accommodate the things brought up in your private message. At this point, I would recommend responding here rather than be a private message - there are other folks who can help.

The code above will give the difference between groups, averaged over the categorical effects covA and covB,, and estimated at the mean values of the continuous effects covC and baseline. The F test for group*baseline will tell you whether the adjustment is the same in both groups. Now I'll recommend getting a good text on analysis of covariance to see how to proceed. If you have access to SAS for Mixed Models, there is a great chapter that goes through this step by step, and how to get the comparisons needed if the adjustments for baseline are not equal.

SteveDenham

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

**Available on demand!**

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

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.