Title

stata.com
pkcollapse — Generate pharmacokinetic measurement dataset
SyntaxRemarks and examples

Menu
Methods and formulas

Description
Also see

Options

Syntax
pkcollapse time concentration
optionsMain∗

id(id var)stat(measures)
trapezoid
fit(#)
keep(varlist)
force
nodots∗if , id(id var) options

Description
subject ID variable
create specified measures; default is all
use trapezoidal rule; default is cubic splines
use # points to estimate AUC0,∞ ; default is fit(3)keep variables in varlist
force collapse
suppress dots during calculation

id(id var) is required.

measures

Description

auc
auclineaucexparea under the concentration-time curve (AUC0,∞ )area under the concentration-time curve from 0 to ∞ using a linear extension
area under the concentration-time curve from 0 to ∞ using an exponential
extensionarea under the log-concentration-time curve extended with a linear fit
half-life of the drug
elimination rate
maximum concentration
time at last concentration
time of maximum concentration

aucloghalfkecmax
tmax
tomcMenu
Statistics > Epidemiology and related > Other > Generate pharmacokinetic measurement dataset

Description
pkcollapse generates new variables with the pharmacokinetic summary measures of interest.
pkcollapse is one of the pk commands. Please read [R] pk before reading this entry.
1

2

pkcollapse — Generate pharmacokinetic measurement dataset

Options

Main

id(id var) is required and specifies the variable that contains the subject ID over which pkcollapse
is to operate.
stat(measures) specifies the measures to be generated. The default is to generate all the measures.
trapezoid tells Stata to use the trapezoidal rule when calculating the AUC. The default is to use
cubic splines, which give better results for most functions. When the curve is irregular, trapezoid
may give better results.
fit(#) specifies the number of points to use in estimating the AUC0,∞ . The default is fit(3), thelast three points. This number should be viewed as a minimum; the appropriate number of points
will depend on your data.
keep(varlist) specifies the variables to be kept during the collapse. Variables not specified with thekeep() option will be dropped. When keep() is specified, the keep variables are checked toensure that all values of the variables are the same within id var.
force forces the collapse, even when the values of the keep() variables are different within theid var.
nodots suppresses the display of dots during calculation.

Remarks and examples

stata.com

pkcollapse generates all the summary pharmacokinetic measures.

Example 1
We demonstrate the use of pkcollapse with the data described in [R] pk. We have drugconcentration data on 15 subjects. Each subject is measured at 13 time points over a 32-hour period.
Some of the records are. use http://www.stata-press.com/data/r13/pkdata. list, sep(0)
id

seq

1.
2.
3.
4.
5.
6.

1
1
1
1
1
1

1
1
1
1
1
1

14.
15.
16.
17.
18.
19.

2
2
2
2
2
2

1
1
1
1
1
1

207.
208.

20
20

2
2time

concA

concB

0
0.5
3.073403
15.188444
1.5
5.898577
25.096378
36.094085(output omitted )00.5
2.48462
14.883569
1.57.253442
2
5.849345
3
6.761085(output omitted )24
4.673281
32
3.487347

03.712592
6.230602
7.885944
9.241735
13.10507
0.9209593
5.925818
8.710549
10.90552
8.429898
6.059818
5.213639

pkcollapse — Generate pharmacokinetic measurement dataset

3

Although pksumm allows us to view all the pharmacokinetic measures, we can create a dataset withthe measures by using pkcollapse.
. pkcollapse time concA concB, id(id) stat(auc) keep(seq)................................
. list, sep(8) abbrev(10)idseq

auc_concA

auc_concB

1.
2.
3.
4.
5.
6.
7.
8.

1
2
34
5
7
8
9

1
1
1
1
1
1
1
1

150.9643
146.7606
160.6548
157.8622
133.6957
160.639131.2604
168.5186

218.5551
133.3201126.0635
96.17461
188.9038
223.6922
104.0139
237.8962

9.
10.
11.
12.
13.
14.
15.
16.

10
12
13
14
15
18
19
20

2
2
2
2
2
22
2

137.0627
153.4038
163.4593
146.0462
158.1457
147.1977
164.9988
145.3823

139.7382
202.3942
136.7848
104.5191
165.8654
139.235166.2391
158.5146

The resulting dataset, which we will call pkdata2, contains 1 observation per subject. This dataset
is in wide format. If we want to use pkcross or pkequiv, we must transform these data to longformat, which we do in the last example of [R] pkshape.

Methods and formulas
The statistics generated by pkcollapse are described in [R] pkexamine.

Also see[R] pk — Pharmacokinetic (biopharmaceutical) data