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
- /
- Proc NLIN! Is it helpful?

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 08-09-2012 02:00 PM
(1966 views)

I am a student and I am working on a dataset which has multiple follow-ups/observations per subject. The follow ups are not at fixed interval and number of follow-ups for patients range from 1-5 follow ups. I want to show exponential trend and hoping to perform a non linear regression.

**data** test;

input followup volume time;

datalines;

1 1 5

2 5 10

1 1 10

2 7 20

3 10 25

4 11 25

1 1 15

2 9 30

3 12 15

4 19 30

1 1 20

2 10 50

3 11 28

4 12 20

5 15 50

6 25 28

;

**run**;

1 ACCEPTED SOLUTION

Accepted Solutions

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

Thank you. I get it now.

Step one: Change time to cumulative days in a data step, so that the data looks something like:

input id followup volume time days;

datalines;

1 1 1 0 0

1 2 5 10 10

2 1 1 0 0

2 2 7 20 20

2 3 10 25 45

2 4 11 25 70

3 1 1 0 0

3 2 9 30 30

3 3 12 15 45

3 4 19 30 75

4 1 1 0 0

4 2 10 50 50

4 3 11 28 78

4 4 12 20 98

4 5 15 50 148

4 6 25 28 176

Step two: Applying the methods in Rick's link (http://support.sas.com/documentation/cdl/en/statug/63962/HTML/default/viewer.htm#statug_nlmixed_sect...), devise the appropriate form for the model you wish to fit, and use PROC NLMIXED. It accounts for correlations within subjects that varies from subject to subject, when PROC NLIN assumes it is the same for all subjects. In your model, volume will be the dependent and days the independent variable.

I hope this helps.

Steve Denham

12 REPLIES 12

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

Does this data reflect four subjects, each with a followup indexed from 1 to as high as 6, volume as a dependent variable, and time as the independent variable? My first thought is NLMIXED rather than NLIN, if my guess about the data is correct. That would take into account the variability both within and between subjects.

Steve Denham

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

Data consist of 38 subjects and yes, you are correct about volume as dependent and time as a independent variable (and other covariates). Also, do i need to convert data from multiple row per subject to one row per subject? My understanding was that I would not be able to do that, as subject will get divided based on their follow up which will further reduce N?? Also, can you explain more why not to NLIN?

10 subjects with 1 follow up; 5 with 2; 7 with 3; 10 with 5; 6 with 6 follow up

Thanks Rohit

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

If time is the independent variable, why isn't it a monotone function of FOLLOWUP? For example, I don't understand the TIME variable for the 4th subject.

Steve is assuming that the errors are correlated among each individual, which leads to a mixed model analysis. See this example in the MIXED doc: http://support.sas.com/documentation/cdl/en/statug/63962/HTML/default/viewer.htm#statug_mixed_sect03...

A similar mixed model, but nonlinear, is here: http://support.sas.com/documentation/cdl/en/statug/63962/HTML/default/viewer.htm#statug_nlmixed_sect...

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

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

I think we may be missing something here. Is it that at any single followup, time is independent and volume dependent, such that for the first subject, on their first followup, they were measured for a period of 5 and generated a volume of 1, while on the second followup, they were measured for a period of 10 and generated a volume of 5?

If so, we have a factor effect, and this is going to get messy, since neither NLIN nor NLMIXED directly accommodates this kind of an effect.

Could you elucidate the experimental design, so that an appropriate approach can be devised?

Thanks,

Steve Denham

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

Maybe this clear a bit:

I have considered time= 0 at first follow up

**data** test;

input followup volume time;

datalines;

1 1 0

2 5 10

1 1 0

2 7 20

3 10 25

4 11 25

1 1 0

2 9 30

3 12 15

4 19 30

1 1 0

2 10 50

3 11 28

4 12 20

5 15 50

6 25 28

;

**run**;

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

Not helpful to me. Consider the second subject:

1 1 0

2 7 20

3 10 25

4 11 25

Does this mean that the third and fourth followup were done at exactly the same time? Also consider the fourth subject:

1 1 0

2 10 50

3 11 28

4 12 20

5 15 50

6 25 28

How does time go backwards from the second followup to the third? Also, the second and fifth followup have the same time, as do the third and sixth.

There is a disconnect between what I think of as time and followup, and how I think you are presenting them. Could you please describe how the data for the fourth subject were generated? Once we have that in hand, I think we can identify what is going on, and then move on to an analysis plan.

Steve Denham

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

**Time: number of days from between the scans (follow-up). for subject 2 first scan at time 0, second scan at after 20 days from the previous scan, 3rd scan after 25 days from the previous scan and 4th scan again after 25 days from the previous scan. similarly for other patients. **

**for 4th subject: first scan at time 0, second scan at after 50 days from the previous scan, 3rd scan after 28 days from the previous scan, 4th scan again after 20 days from the previous scan, 5th scan after 50 days from the previous scan and last 6th scan after 28 days from the previous scan. **

**data** test;

input followup volume time;

datalines;

1 1 0

2 5 10

1 1 0

2 7 20

3 10 25

4 11 25

1 1 0

2 9 30

3 12 15

4 19 30

1 1 0

2 10 50

3 11 28

4 12 20

5 15 50

6 25 28

;

**run**;

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

Thank you. I get it now.

Step one: Change time to cumulative days in a data step, so that the data looks something like:

input id followup volume time days;

datalines;

1 1 1 0 0

1 2 5 10 10

2 1 1 0 0

2 2 7 20 20

2 3 10 25 45

2 4 11 25 70

3 1 1 0 0

3 2 9 30 30

3 3 12 15 45

3 4 19 30 75

4 1 1 0 0

4 2 10 50 50

4 3 11 28 78

4 4 12 20 98

4 5 15 50 148

4 6 25 28 176

Step two: Applying the methods in Rick's link (http://support.sas.com/documentation/cdl/en/statug/63962/HTML/default/viewer.htm#statug_nlmixed_sect...), devise the appropriate form for the model you wish to fit, and use PROC NLMIXED. It accounts for correlations within subjects that varies from subject to subject, when PROC NLIN assumes it is the same for all subjects. In your model, volume will be the dependent and days the independent variable.

I hope this helps.

Steve Denham

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

Thanks Steve! Just one more thing, I don't have to convert from multiple observation (row) per subject to one row (observation) per subject?

Thanks and Regards,

Rohit

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

No, stick with what I have as each observation on its own row.

Steve Denham

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

Yep. (Not that Steve is ever wrong!)

**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.