Learn R Programming

NonCompart (version 0.2.6)

BestSlope: Choose best fit slope for the log(y) and x regression by the criteria of adjusted R-square

Description

It sequentially fits (log(y) ~ x) from the last point of x to the previous points with at least 3 points. It chooses a slope the highest adjusted R-square. If the difference is less then 1e-4, it chooses longer slope.

Usage

BestSlope(x, y, AdmMode = "Extravascular")

Arguments

x
vector values of x-axis, usually time
y
vector values of y-axis, usually concentration
AdmMode
one of "Bolus" or "Infusion" or "Extravascular" to indicate drug administration mode

Value

Details

Choosing the best terminal slope (y in log scale) in pharmacokinetic analysis is somewhat challenging, and it could vary by analysis performer. Currently this function uses ordinary least square method(OLS) only.

See Also

Slope

Examples

Run this code
BestSlope(Theoph[Theoph$Subject==1, "Time"],Theoph[Theoph$Subject==1, "conc"])
BestSlope(Indometh[Indometh$Subject==1, "time"],Indometh[Indometh$Subject==1, "conc"],
          AdmMode="Bolus")

Run the code above in your browser using DataLab