Programming the statistical procedures from SAS

Proc NLIN! Is it helpful?

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 7
Accepted Solution

Proc NLIN! Is it helpful?

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;


Accepted Solutions
Solution
‎08-09-2012 03:44 PM
Respected Advisor
Posts: 2,655

Re: Proc NLIN! Is it helpful?

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

View solution in original post


All Replies
Respected Advisor
Posts: 2,655

Re: Proc NLIN! Is it helpful?

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

Occasional Contributor
Posts: 7

Re: Proc NLIN! Is it helpful?

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

SAS Super FREQ
Posts: 3,551

Re: Proc NLIN! Is it helpful?

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

Occasional Contributor
Posts: 7

Re: Proc NLIN! Is it helpful?

Follow up time (in days) is random (depending upon availability of patient). Time is not fixed (no specific interval).

Respected Advisor
Posts: 2,655

Re: Proc NLIN! Is it helpful?

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

Occasional Contributor
Posts: 7

Re: Proc NLIN! Is it helpful?

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;

Respected Advisor
Posts: 2,655

Re: Proc NLIN! Is it helpful?

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

Occasional Contributor
Posts: 7

Re: Proc NLIN! Is it helpful?

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;

Solution
‎08-09-2012 03:44 PM
Respected Advisor
Posts: 2,655

Re: Proc NLIN! Is it helpful?

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

Occasional Contributor
Posts: 7

Re: Proc NLIN! Is it helpful?

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

Respected Advisor
Posts: 2,655

Re: Proc NLIN! Is it helpful?

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

Steve Denham

SAS Super FREQ
Posts: 3,551

Re: Proc NLIN! Is it helpful?

Yep. (Not that Steve is ever wrong!)

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 12 replies
  • 296 views
  • 0 likes
  • 3 in conversation