pk1.csv
### read the dataset
> pk1<-read.csv("C:/data/pk1.csv")
### conc-time profile
> coplot(conc~time|factor(subject), data=pk1)
### subject 1
subject time conc
1 1 10 920
2 1 20 800
3 1 30 750
4 1 40 630
5 1 50 610
6 1 60 530
7 1 70 520
8 1 90 380
9 1 110 350
10 1 150 200
### estimate inital values with linear regression with log-transformation
> lm.beta<-coef(lm(log(conc)~time, data=pk1, subset=subject==1))
> lm.beta
(Intercept) time
6.91891347 -0.01044090
## conc = C0 * exp(-K*time)
> beta0<-c(exp(lm.beta[1]),-lm.beta[2])
> out1<-nls(conc~C0*exp(-K*time), data=pk1, start=list(C0=beta0[1],K=beta0[2]), subset=subject==1)
> summary(out1)
Formula: conc ~ C0 * exp(-K * time)
Parameters:
Estimate Std. Error t value Pr(>|t|)
C0 1.002e+03 2.059e+01 48.68 3.51e-11 ***
K 1.026e-02 4.329e-04 23.69 1.07e-08 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 23.26 on 8 degrees of freedom
Number of iterations to convergence: 2
Achieved convergence tolerance: 6.187e-08
## conc = X0/V * exp(-K*time)
> beta0<-c(exp(lm.beta[1])/10000 ,-lm.beta[2])
> out2<-nls(conc~10000/V*exp(-K*time), data=pk1, start=list(V=beta0[1],K=beta0[2]), subset=subject==1)
> summary(out2)
Formula: conc ~ 10000/V * exp(-K * time)
Parameters:
Estimate Std. Error t value Pr(>|t|)
V 9.9784334 0.2049941 48.68 3.51e-11 ***
K 0.0102561 0.0004329 23.69 1.07e-08 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 23.26 on 8 degrees of freedom
Number of iterations to convergence: 11
Achieved convergence tolerance: 2.810e-08
## conc = X0/V * exp(-Cl/V*time)
> beta0<-c(10000/exp(lm.beta[1]) ,-10000*lm.beta[2]/exp(lm.beta[1]))
> out3<-nls(conc~10000/V*exp(-Cl/V*time), data=pk1, start=list(V=beta0[1],Cl=beta0[2]), subset=subject==1)
> summary(out3)
Formula: conc ~ 10000/V * exp(-Cl/V * time)
Parameters:
Estimate Std. Error t value Pr(>|t|)
V 9.978433 0.204994 48.68 3.51e-11 ***
Cl 0.102340 0.002902 35.26 4.58e-10 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 23.26 on 8 degrees of freedom
Number of iterations to convergence: 2
Achieved convergence tolerance: 1.464e-06