turn on suggestions

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

Showing results for

Find a Community

- Home
- /
- Analytics
- /
- Forecasting
- /
- Parameter estimation with proc model and ODEs

Topic Options

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-31-2016 12:07 PM

Dear all,

I'm trying to fit a dataset with proc model and ordinary differential equations, but somehow it does not work.

SAS complains that I don't have the values A1 and A2 in the dataset, but they can't be in the dataset. Any ideas? The dataset and the code is attached below.

Many thanks in advance.

Thorsten

ata step01;

INPUT time conc;

datalines;

0.1 1.50

0.2 3.20

0.4 4.30

0.6 5.10

0.8 5.40

1 5.20

1.2 5.00

1.4 4.80

2 4.00

3 2.50

4 1.50

5 1.00

6 0.62

7 0.40

8 0.25

10 0.10

run;

proc model data=step01;

ENDOGENOUS A1 400 A2 0 ;

dert.A1 = -ka * A1;

dert.A2 = ka * A1 - (CL/V2)*A2;

CONC=A2/V2;

FIT CONC start=(KA 2.5 CL 20 V2 50) ;

run;

quit;

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

09-01-2016 11:00 AM

I got what look like satisfactory results by changing the ENDOGENOUS statement to a PARAMETERS statement. I'm pretty sure that SAS expects endogenous variables to be part of the input dataset here, so by shifting to PARAMETERS, it fits those at t=0.

Steve Denham

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

09-05-2016 03:59 AM

Dear Steve,

many thanks. It works perfectly.

Does anyone know how I can add a second input/pulse (i.e. a drug dosing) to the first differential equation after a certain time, e.g. 12 hours? How can I integrate this into a dataset?

Many thanks

Thorsten

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

09-21-2016 04:19 PM

Thorsten,

I was surprised to see that Steve's suggestion to change the ENDO statement into a PARMS statement does allow PROC MODEL to estimate this one compartment model; however, I would not recommend this approach as it exploits an unintended side effect in PROC MODEL and may not work in the future.

The more standard way of estimating this model would be to include the unobserved values, a1 and a2, in the data set:

```
data step02;
set step01;
a1 = .;
a2 = .;
run;
proc model data=step02;
endo a1 400 a2 0;
...
```

I would also like to point out that neither of these approaches may be exactly what you want. Presumably, in your model the dose is administered at time = 0. In your code the STEP01 data set's first observation is at time=0.1. That means when PROC MODEL integrates these ODEs it uses a1=400, and a2=0 as the initial conditions at time=0.1. To set the initial conditions a1=400, and a2=0 at time=0 you should add an extra observation with time=0 and conc=0 to the top of your data set.

Regarding adding a pulse, or bolus, dose to the first equation you could use code like the following:

`dert.A1 = -ka * A1 + dose*dirac(time - tbolus);`

after first defining a dirac function using PRC FCMP:

```
proc fcmp outlib=work.funcs.f;
function dirac(args[*]) varargs;
x = args[1];
if dim (args) = 1 then
delta = 1e-6;
else
delta = args[2];
if abs(x) < delta then
f = (delta - abs(x))/(delta*delta);
else
f = 0;
return (f);
endsub;
run;
options cmplib=funcs;
```

You would need to define the TBOLUS, and DOSE variables either in your data set, or your model program.

Marc

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

09-26-2016 01:25 PM

Sweet answer to use FCMP to come up with a Dirac function for a pulse input. That's something I wish I had known about $) years ago (of course, there was no PROC MODEL then, let alone PROC FCMP).

Steve Denham