[R] cmptl_analy.R
Oscar Linares
olinares at med.umich.edu
Fri Jan 23 01:36:54 CET 2004
Dear Michael,
One key is adjustment of nls optimizer tolerance. I notice it has to be
higher than usual, but, I recovered your noisy "known" parameter values
with an error of K1 (-7%) and k1 (-6%):
#### Miller problem with Dalgaard modifications
## Linares 1/22/2004
## Solution 1
nls(noisy ~ lsoda(xstart, time, one.compartment.model, c(K1=K1,
k2=k2))[,2],
data=C1.lsoda,
start=list(K1=0.3, k2=0.7),
control=nls.control(maxiter=50,tol=1),
trace=T
)
0.3594355 : 0.3 0.7
0.006118908 : 0.3456684 0.3518834
0.002828044 : 0.4057868 0.4081200
Nonlinear regression model
model: noisy ~ lsoda(xstart, time, one.compartment.model, c(K1 = K1,
k2 = k2))[, 2]
data: C1.lsoda
K1 k2
0.4057868 0.4081200
(-19%) (-18%)
residual sum-of-squares: 0.002828044
## Solution 2 (lower nls optimizer tolerance)
nls(noisy ~ lsoda(xstart, time, one.compartment.model, c(K1=K1,
k2=k2))[,2],
data=C1.lsoda,
start=list(K1=0.3, k2=0.7),
control=nls.control(maxiter=50,tol=0.01),
trace=T
)
> nls(noisy ~ lsoda(xstart, time, one.compartment.model, c(K1=K1,
k2=k2))[,2],
+ data=C1.lsoda,
+ start=list(K1=0.3, k2=0.7),
+ control=nls.control(maxiter=50,tol=0.01),
+ trace=T
+ )
0.3594355 : 0.3 0.7
0.006118908 : 0.3456684 0.3518834
0.002828044 : 0.4057868 0.4081200
0.002775223 : 0.4092802 0.4104112
0.002729966 : 0.4085296 0.4114600
0.001975772 : 0.4628794 0.4688428
0.001973953 : 0.4628974 0.4682051
0.001973698 : 0.4631627 0.4686185
0.001973422 : 0.4673921 0.4729379
0.001973413 : 0.4673957 0.4729418
Error in nls(noisy ~ lsoda(xstart, time, one.compartment.model, c(K1 =
K1, :
step factor 0.000488281 reduced below `minFactor' of 0.000976563
#### Solution 3 (increase nls optimizer tolerance a notch)
nls(noisy ~ lsoda(xstart, time, one.compartment.model, c(K1=K1,
k2=k2))[,2],
data=C1.lsoda,
start=list(K1=0.3, k2=0.7),
control=nls.control(maxiter=50,tol=0.1),
trace=T
)
> nls(noisy ~ lsoda(xstart, time, one.compartment.model, c(K1=K1,
k2=k2))[,2],
+ data=C1.lsoda,
+ start=list(K1=0.3, k2=0.7),
+ control=nls.control(maxiter=50,tol=0.1),
+ trace=T
+ )
0.3594355 : 0.3 0.7
0.006118908 : 0.3456684 0.3518834
0.002828044 : 0.4057868 0.4081200
0.002775223 : 0.4092802 0.4104112
0.002729966 : 0.4085296 0.4114600
0.001975772 : 0.4628794 0.4688428
0.001973953 : 0.4628974 0.4682051
Nonlinear regression model
model: noisy ~ lsoda(xstart, time, one.compartment.model, c(K1 = K1,
k2 = k2))[, 2]
data: C1.lsoda
K1 k2
0.4628974 0.4682051
(-7%) (-6%)
residual sum-of-squares: 0.001973953
> errK1=(0.4628974-0.5)/0.5
> errK1
[1] -0.0742052
> errk1=(0.4682051-0.5)/0.5
> errk1
[1] -0.0635898
Oscar
Oscar A. Linares, MD, PhD
Prof. Experimental Medicine
Michigan Diabetes Institute
olinares at med.umich.edu
Oscar A. Linares, MD, PhD ///////
Michigan Diabetes Institute S c I S O F T ///=20=03
Molecular Medicine Unit ______////////=20=04
SciSoft Working Group \_\_\_\/////
Ann Arbor, MI \_\_\_\///
Tel. (734) 637-7997 \_\_\_\/
Fax. (734) 453-7019
***************************************************************************
IMPORTANT CONFIDENTIALITY NOTICE: The documents and/or accom...{{dropped}}
More information about the R-help
mailing list