It performs old type Winnonlin regression.

wnl5(Fx, Data, pNames, IE, LB, UB, Error="A", ObjFx=ObjLS)

Arguments

Fx

Function for structural model. It should return a vector of the same length to observations.

Data

Data table which will be used in Fx. Fx should access this with e$DATA.

pNames

Parameter names in the order of Fx arguments

IE

Initial estimates of parameters

LB

Lower bound for optim function. The default value is 0.

UB

Upper bound for optim function. The default value is 1e+06.

Error

Error model. One of "POIS" for Poisson error, "P" for proportional error, and others for additive error model.

ObjFx

Objective function to be minimized. The default is least square function.

Details

This uses scaled transformed parameters and environment e internally. Here we do not provide standard error. If you want standard error, use nlr.

Value

PE

Point estimates

WRSS

Weighted Residual Sum of Square

run$m

Count of positive residuals

run$n

Count of negative residuals

run$run

Count of runs of residuals

run$p.value

P value of run test with excluding zero points

Objective Function Value

Minimum value of the objective function

AIC

Akaike Information Criterion

SBC

Schwarz Bayesian Information Criterion

Condition Number

Condition number

Message

Message from optim.

Prediction

Fitted(predicted) values

Residuals

Residuals

Elapsed Time

Consumed time by minimization

Author

Kyun-Seop Bae <k@acr.kr>

Examples

tData = Theoph colnames(tData) = c("ID", "BWT", "DOSE", "TIME", "DV") fPK = function(THETA) # Prediction function { DOSE = 320000 # in microgram TIME = e$DATA[,"TIME"] # use data in e$DATA K = THETA[1] Ka = THETA[2] V = THETA[3] Cp = DOSE/V*Ka/(Ka - K)*(exp(-K*TIME) - exp(-Ka*TIME)) return(Cp) } IDs = unique(tData[,"ID"]) nID = length(IDs) for (i in 1:nID) { Data = tData[tData$ID == IDs[i],] Res = wnl5(fPK, Data, pNames=c("k", "ka", "V"), IE=c(0.1, 3, 500)) print(paste("## ID =", i, "##")) print(Res) }
#> [1] "## ID = 1 ##" #> $PE #> k ka V #> 5.395422e-02 1.777418e+00 2.939423e+04 #> #> $WRSS #> [1] 4.286009 #> #> $run #> $run$m #> [1] 5 #> #> $run$n #> [1] 6 #> #> $run$run #> [1] 5 #> #> $run$p.value #> [1] 0.2619048 #> #> #> $AIC #> [1] 22.00892 #> #> $SBC #> [1] 23.2026 #> #> $`Condition Number` #> [1] 309673.7 #> #> $Convergence #> NULL #> #> $Message #> [1] "CONVERGENCE: REL_REDUCTION_OF_F <= FACTR*EPSMCH" #> #> $Prediction #> [1] 0.000000 3.877505 6.810849 9.035307 9.758252 9.123555 8.525226 7.683266 #> [9] 6.889941 5.838204 3.014651 #> #> $Residual #> [1] 0.7400000000 -1.0375046146 -0.2408485580 1.4646927960 -0.0982521984 #> [6] -0.5435548712 -0.1652264087 -0.2132664514 0.0000587706 0.1017956934 #> [11] 0.2653489787 #> #> $`Elapsed Time` #> Time difference of 0.006874084 secs #> #> [1] "## ID = 2 ##" #> $PE #> k ka V #> 1.016619e-01 1.942665e+00 3.202467e+04 #> #> $WRSS #> [1] 8.948304 #> #> $run #> $run$m #> [1] 5 #> #> $run$n #> [1] 5 #> #> $run$run #> [1] 6 #> #> $run$p.value #> [1] 0.6428571 #> #> #> $AIC #> [1] 30.1061 #> #> $SBC #> [1] 31.29979 #> #> $`Condition Number` #> [1] 252599.2 #> #> $Convergence #> NULL #> #> $Message #> [1] "CONVERGENCE: REL_REDUCTION_OF_F <= FACTR*EPSMCH" #> #> $Prediction #> [1] 0.0000000 4.0181902 6.1615127 8.0136431 8.4213763 7.3754430 6.3288913 #> [8] 5.1597038 4.2232611 3.1131092 0.8915273 #> #> $Residual #> [1] 0.000000000 -2.298190199 1.748487323 0.296356941 -0.091376322 #> [6] -0.525443020 -0.248891313 0.240296157 0.326738949 -0.103109243 #> [11] 0.008472741 #> #> $`Elapsed Time` #> Time difference of 0.006561041 secs #> #> [1] "## ID = 3 ##" #> $PE #> k ka V #> 8.142465e-02 2.453575e+00 3.431936e+04 #> #> $WRSS #> [1] 0.4362739 #> #> $run #> $run$m #> [1] 5 #> #> $run$n #> [1] 5 #> #> $run$run #> [1] 7 #> #> $run$p.value #> [1] 0.3571429 #> #> #> $AIC #> [1] -3.124334 #> #> $SBC #> [1] -1.930649 #> #> $`Condition Number` #> [1] 296071 #> #> $Convergence #> NULL #> #> $Message #> [1] "CONVERGENCE: REL_REDUCTION_OF_F <= FACTR*EPSMCH" #> #> $Prediction #> [1] 0.000000 4.462163 6.875371 8.086059 8.113669 7.180844 6.377126 5.423212 #> [9] 4.634548 3.586049 1.347602 #> #> $Residual #> [1] 0.00000000 -0.06216287 0.02462942 0.11394105 -0.31366936 0.31915648 #> [7] -0.17712596 -0.12321194 0.26545180 0.11395092 -0.29760201 #> #> $`Elapsed Time` #> Time difference of 0.003648043 secs #> #> [1] "## ID = 4 ##" #> $PE #> k ka V #> 8.746660e-02 1.171479e+00 3.109748e+04 #> #> $WRSS #> [1] 5.731951 #> #> $run #> $run$m #> [1] 4 #> #> $run$n #> [1] 6 #> #> $run$run #> [1] 5 #> #> $run$p.value #> [1] 0.4047619 #> #> #> $AIC #> [1] 25.20661 #> #> $SBC #> [1] 26.4003 #> #> $`Condition Number` #> [1] 308020.5 #> #> $Convergence #> NULL #> #> $Message #> [1] "CONVERGENCE: REL_REDUCTION_OF_F <= FACTR*EPSMCH" #> #> $Prediction #> [1] 0.000000 3.405237 5.045601 6.951971 8.313095 8.003647 7.137540 6.015146 #> [9] 5.052011 3.899856 1.287549 #> #> $Residual #> [1] 0.00000000 -1.51523728 -0.44560090 1.64802919 0.06690531 -0.46364700 #> [7] -0.25754034 -0.23514616 0.27798861 0.29014360 -0.13754874 #> #> $`Elapsed Time` #> Time difference of 0.00334692 secs #> #> [1] "## ID = 5 ##" #> $PE #> k ka V #> 8.843543e-02 1.471499e+00 2.692502e+04 #> #> $WRSS #> [1] 13.46347 #> #> $run #> $run$m #> [1] 4 #> #> $run$n #> [1] 6 #> #> $run$run #> [1] 6 #> #> $run$p.value #> [1] 0.5952381 #> #> #> $AIC #> [1] 34.59978 #> #> $SBC #> [1] 35.79347 #> #> $`Condition Number` #> [1] 243812.3 #> #> $Convergence #> NULL #> #> $Message #> [1] "CONVERGENCE: REL_REDUCTION_OF_F <= FACTR*EPSMCH" #> #> $Prediction #> [1] 0.000000 4.181820 6.193477 8.671561 9.929052 9.205387 8.103807 6.796231 #> [9] 5.654659 4.375498 1.467915 #> #> $Residual #> [1] 0.000000000 -2.161820037 -0.563476852 2.728439105 -0.599051529 #> [6] -0.465387141 -0.543806521 0.293769212 0.245341139 -0.005498253 #> [11] 0.102085145 #> #> $`Elapsed Time` #> Time difference of 0.003294945 secs #> #> [1] "## ID = 6 ##" #> $PE #> k ka V #> 9.952616e-02 1.163725e+00 4.110450e+04 #> #> $WRSS #> [1] 2.44424 #> #> $run #> $run$m #> [1] 5 #> #> $run$n #> [1] 5 #> #> $run$run #> [1] 4 #> #> $run$p.value #> [1] 0.1666667 #> #> #> $AIC #> [1] 15.83108 #> #> $SBC #> [1] 17.02476 #> #> $`Condition Number` #> [1] 394091.1 #> #> $Convergence #> NULL #> #> $Message #> [1] "CONVERGENCE: REL_REDUCTION_OF_F <= FACTR*EPSMCH" #> #> $Prediction #> [1] 0.0000000 2.0696822 3.7009282 5.3594841 6.1538400 5.8337236 5.1504111 #> [8] 4.2390624 3.4004957 2.5531761 0.7928734 #> #> $Residual #> [1] 0.00000000 -0.77968225 -0.62092822 1.08051591 0.16616004 -0.30372357 #> [7] -0.21041106 -0.21906242 0.05950431 0.22682389 0.12712658 #> #> $`Elapsed Time` #> Time difference of 0.003592014 secs #> #> [1] "## ID = 7 ##" #> $PE #> k ka V #> 1.022454e-01 6.797419e-01 3.262157e+04 #> #> $WRSS #> [1] 0.9965572 #> #> $run #> $run$m #> [1] 4 #> #> $run$n #> [1] 7 #> #> $run$run #> [1] 5 #> #> $run$p.value #> [1] 0.3333333 #> #> #> $AIC #> [1] 5.962064 #> #> $SBC #> [1] 7.15575 #> #> $`Condition Number` #> [1] 442629.3 #> #> $Convergence #> NULL #> #> $Message #> [1] "CONVERGENCE: REL_REDUCTION_OF_F <= FACTR*EPSMCH" #> #> $Prediction #> [1] 0.0000000 1.5130550 2.7514630 4.6307093 6.4667071 7.0051005 6.5391194 #> [8] 5.5553854 4.5749861 3.3647392 0.9704201 #> #> $Residual #> [1] 0.15000000 -0.66305495 -0.40146295 0.38929073 0.11329294 0.08489951 #> [7] 0.12088064 -0.30538543 -0.18498610 0.16526083 0.17957988 #> #> $`Elapsed Time` #> Time difference of 0.003391027 secs #> #> [1] "## ID = 8 ##" #> $PE #> k ka V #> 9.195633e-02 1.375526e+00 3.569203e+04 #> #> $WRSS #> [1] 3.683351 #> #> $run #> $run$m #> [1] 5 #> #> $run$n #> [1] 5 #> #> $run$run #> [1] 7 #> #> $run$p.value #> [1] 0.3571429 #> #> #> $AIC #> [1] 20.34205 #> #> $SBC #> [1] 21.53574 #> #> $`Condition Number` #> [1] 343413.6 #> #> $Convergence #> NULL #> #> $Message #> [1] "CONVERGENCE: REL_REDUCTION_OF_F <= FACTR*EPSMCH" #> #> $Prediction #> [1] 0.000000 2.577415 4.460461 6.284223 7.382243 6.869908 6.029557 4.977828 #> [9] 4.172570 3.157918 1.045608 #> #> $Residual #> [1] 0.0000000 0.4725845 -1.4104607 1.0257767 0.1777571 -0.2799079 #> [7] -0.1495567 -0.2478284 0.3974301 -0.1579183 0.2043925 #> #> $`Elapsed Time` #> Time difference of 0.003400803 secs #> #> [1] "## ID = 9 ##" #> $PE #> k ka V #> 8.663171e-02 8.865652e+00 3.894823e+04 #> #> $WRSS #> [1] 2.488854 #> #> $run #> $run$m #> [1] 5 #> #> $run$n #> [1] 5 #> #> $run$run #> [1] 6 #> #> $run$p.value #> [1] 0.6428571 #> #> #> $AIC #> [1] 16.03005 #> #> $SBC #> [1] 17.22373 #> #> $`Condition Number` #> [1] 227498.8 #> #> $Convergence #> NULL #> #> $Message #> [1] "CONVERGENCE: REL_REDUCTION_OF_F <= FACTR*EPSMCH" #> #> $Prediction #> [1] 0.0000000 7.5037054 7.8252721 7.5749345 6.9650945 6.1110420 5.3710104 #> [8] 4.4582570 3.8711367 3.0373317 0.9994947 #> #> $Residual #> [1] 0.0000000 -0.1337054 1.2047279 -0.4349345 -0.6350945 -0.4510420 #> [7] 0.2989896 -0.2182570 0.2388633 0.1226683 0.1205053 #> #> $`Elapsed Time` #> Time difference of 0.003857136 secs #> #> [1] "## ID = 10 ##" #> $PE #> k ka V #> 7.396572e-02 6.955052e-01 2.551976e+04 #> #> $WRSS #> [1] 1.351402 #> #> $run #> $run$m #> [1] 5 #> #> $run$n #> [1] 6 #> #> $run$run #> [1] 6 #> #> $run$p.value #> [1] 0.7380952 #> #> #> $AIC #> [1] 9.31257 #> #> $SBC #> [1] 10.50626 #> #> $`Condition Number` #> [1] 371870.2 #> #> $Convergence #> NULL #> #> $Message #> [1] "CONVERGENCE: REL_REDUCTION_OF_F <= FACTR*EPSMCH" #> #> $Prediction #> [1] 0.000000 2.804848 5.041307 6.109314 8.685332 9.603184 9.239402 8.209422 #> [9] 6.990599 5.730368 2.431040 #> #> $Residual #> [1] 0.24000000 0.08515203 0.17869287 0.30068633 -0.85533237 0.60681594 #> [7] -0.05940195 -0.18942220 0.14940116 -0.05036829 -0.01103956 #> #> $`Elapsed Time` #> Time difference of 0.003312826 secs #> #> [1] "## ID = 11 ##" #> $PE #> k ka V #> 9.812327e-02 3.849036e+00 3.794529e+04 #> #> $WRSS #> [1] 0.4262162 #> #> $run #> $run$m #> [1] 4 #> #> $run$n #> [1] 6 #> #> $run$run #> [1] 4 #> #> $run$p.value #> [1] 0.1904762 #> #> #> $AIC #> [1] -3.380894 #> #> $SBC #> [1] -2.187208 #> #> $`Condition Number` #> [1] 258109.8 #> #> $Convergence #> NULL #> #> $Message #> [1] "CONVERGENCE: REL_REDUCTION_OF_F <= FACTR*EPSMCH" #> #> $Prediction #> [1] 0.0000000 5.1380994 6.9764935 7.6613284 7.1215104 6.0784762 5.2878956 #> [8] 4.3413814 3.5677890 2.6346364 0.8148028 #> #> $Residual #> [1] 0.00000000 -0.27809935 0.26350654 0.33867160 -0.31151044 -0.20847623 #> [7] -0.06789563 0.10861855 0.05221103 0.05536364 0.04519716 #> #> $`Elapsed Time` #> Time difference of 0.003494024 secs #> #> [1] "## ID = 12 ##" #> $PE #> k ka V #> 1.055750e-01 8.329044e-01 2.401758e+04 #> #> $WRSS #> [1] 2.809197 #> #> $run #> $run$m #> [1] 5 #> #> $run$n #> [1] 5 #> #> $run$run #> [1] 5 #> #> $run$p.value #> [1] 0.3571429 #> #> #> $AIC #> [1] 17.36189 #> #> $SBC #> [1] 18.55557 #> #> $`Condition Number` #> [1] 281046.1 #> #> $Convergence #> NULL #> #> $Message #> [1] "CONVERGENCE: REL_REDUCTION_OF_F <= FACTR*EPSMCH" #> #> $Prediction #> [1] 0.000000 2.470626 4.412475 7.095100 9.469061 9.708586 8.709873 7.190761 #> [9] 5.872767 4.274807 1.191767 #> #> $Residual #> [1] 0.00000000 -1.22062563 -0.45247544 0.72490019 0.25093928 0.04141420 #> [7] -0.13987302 -0.60076052 0.23723348 0.29519337 -0.02176698 #> #> $`Elapsed Time` #> Time difference of 0.003410101 secs #>