wnl5: Old type WinNonlin - Least Square not MLE

View source: R/wnl5.R

wnl5R Documentation

Old type WinNonlin - Least Square not MLE

Description

It performs old type Winnonlin regression.

Usage

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(s)

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)
}


wnl documentation built on April 25, 2023, 9:11 a.m.