Turn on suggestions

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

Showing results for

- Home
- /
- Programming
- /
- SAS Procedures
- /
- Re: Longitudinal study - how to plot the outcome with CI against time

Options

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

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

Posted 07-13-2024 11:14 PM
(749 views)

Hello, everyone

Today I read this research paper "Plozasiran (ARO-APOC3) for Severe Hypertriglyceridemia

The SHASTA-2 Randomized Clinical Trial" (doi:10.1001/jamacardio.2024.0959).

I am very interested in the line of Figure 2. According to my understanding, the model used in this research probably is a linear mixed model, and follow-up time is an independent factor. What I am not sure is how the author estimated the confidence interval of the outcomes in Figure 2? Using the linear mixed model? Or other methods?

Please let me know your ideas. Thank you.

Figure 2

13 REPLIES 13

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

Check @Rick_SAS blogs:

https://blogs.sas.com/content/iml/2016/06/22/sas-effectplot-statement.html

```
data have;
call streaminit(123);
do subject=1 to 100;
do time=1 to 10;
sex=ifc(rand('bern',0.4),'F','M');
weight=rand('normal',4,100);
height=rand('normal',0,2);
output;
end;
end;
run;
proc mixed data=have;
class subject sex time;
model weight=height sex time/s;
random int/subject=subject;
repeated time/subject=subject ;
store out=mixedmodel;
run;
proc plm source=mixedmodel;
effectplot INTERACTION(x=time sliceby=sex /*plotby=CigsPerDay*/ )/limits connect;
run;
```

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

@Ksharp Hello, Ksharp. Thank you for your answer. Would you mind if you tell me whether it is appropriate to use only one of the random and repeated statements?

I think either the random or repeated statement can adjust the intra-individual relationship.

Tom

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

Yes. You can. But you have to have TIME variable in MODEL to plot the interaction graph.

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

One more thing, I am thinking of what the codes should be if the response variable is not continuous (e.g., weight) but binary (e.g., event present). In this case, individuals are repeatedly measured to collect their status of the binary response variable and we would like to have a similar series graph. The x-axis remains the sequence of the repeated measurement, but the y-axis represent the risk (i.e., proportion) for the event to occur, along with its confidence interval.

Many thanks.

Tom

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

If your Y variable is a binary variable,you could use PROC GLIMMIX instead of PROC MIXED.

```
data have;
call streaminit(123);
do subject=1 to 10;
do time=1 to 5;
y=rand('bern',0.8);
sex=ifc(rand('bern',0.4),'F','M');
weight=rand('normal',4,100);
height=rand('normal',0,2);
output;
end;
end;
run;
/*Take TIME as R side random effect */
proc glimmix data=have;
class subject sex time;
model y=height sex time/solution dist=binary ;
random int/subject=subject;
random time/subject=subject residual;
store out=mixedmodel;
run;
proc plm source=mixedmodel;
effectplot INTERACTION(x=time sliceby=sex /*plotby=CigsPerDay*/ )/limits connect;
run;
```

```
/*Take TIME as G side random effect */
proc glimmix data=have;
class subject sex ;
model y=height sex time/solution dist=binary ;
random int time/subject=subject;
store out=mixedmodel;
run;
proc plm source=mixedmodel;
effectplot slicefit(x=time sliceby=sex /*plotby=CigsPerDay*/ )/limits ;
run;
```

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

Thank you for your information.

What will happen if we treat the variable of time as a category variable in the class statement? Here, the time we use is not a continuous variable. Instead, it's a proxy of the number of a series of repeated measurements. For example, we monitor the individuals and we test their blood several times during the following period. Thx.

What will happen if we treat the variable of time as a category variable in the class statement? Here, the time we use is not a continuous variable. Instead, it's a proxy of the number of a series of repeated measurements. For example, we monitor the individuals and we test their blood several times during the following period. Thx.

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

Check my code

/*Take TIME as R side random effect */

..........

/*Take TIME as R side random effect */

..........

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

NOTE: An R-side variance component is confounded with the profiled variance.

NOTE: The GLIMMIX procedure is modeling the probability that inr_attain='1'.

NOTE: Did not converge.

NOTE: The GLIMMIX procedure deleted the model item store WORK.MIXEDMODEL because of incomplete information for a subsequent

analysis.

Problem with the raw data?

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

Yes.

NOTE: Did not converge.

it stands for your model is not right or trust .

Change your model syntax or Check the data.

NOTE: Did not converge.

it stands for your model is not right or trust .

Change your model syntax or Check the data.

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

```
proc glimmix data = highlow_1;
class Patient_ID Gender;
model inr_attain(event = '1') = measure Gender / dist = binary solution;
random intercept / subject = Patient_ID;
*random measure / subject = Patient_ID residual;
store out = mixedmodel;
run;
proc plm source = mixedmodel;
effectplot slicefit(x = measure sliceby = Gender) / limits;
run;
```

This is the measure as G side random effect and it produces the graph.

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

But we would like to treat the variable of measure as a class variable.

```
proc glimmix data = highlow_1;
class Patient_ID Gender measure;
model inr_attain(event = '1') = measure Gender / dist = binary solution;
random intercept / subject = Patient_ID;
random measure / subject = Patient_ID residual;
store out = mixedmodel;
run;
proc plm source = mixedmodel;
effectplot interaction(x = measure sliceby = Gender) / limits connect;
run;
```

And this produced the "Did not converge." outcome.

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

The fix should be this,

```
proc glimmix data = highlow_1;
class Patient_ID Gender measure;
model inr_attain(event = '1') = measure Gender / dist = binary solution;
*random intercept / subject = Patient_ID;
random measure / subject = Patient_ID residual;
store out = mixedmodel;
run;
proc plm source = mixedmodel;
effectplot interaction(x = measure sliceby = Gender) / limits connect;
run;
```

The graph

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

Yes.

That what my code wrote for R side random effect (take variable of measure as a class variable.).

That what my code wrote for R side random effect (take variable of measure as a class variable.).

Are you ready for the spotlight? We're accepting content ideas for **SAS Innovate 2025** to be held May 6-9 in Orlando, FL. The call is **open **until September 16. Read more here about **why** you should contribute and **what is in it** for you!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.