boot.resid.linear.plateau {FertBoot} | R Documentation |
Linear plateau model estimation by bootstrapping residuals
Description
boot.resid.linear.plateau
is the core function to implement bootstrapping residuals on linear plateau models, which assumes
y ~ a + b * (x - c) * (x <= c). Note that this function may take minutes up to days. Parallel computing may be necessary.
We suggest users start with a smaller B
and moderate n.start to see if the bootstrap models can converge.
In general, increasing n.start and plus_minus may help with ease of convergence. For rigorous statistical inference, B should be on the order of a thousand.
Usage
boot.resid.linear.plateau(
mod,
data,
x.range = data.frame(x = seq(0, 280, by = 40)),
B = 100 - 1,
plus_minus = 100,
n.start = 1000,
print.progress = TRUE
)
Arguments
mod |
a full model list, probably from |
data |
data frame with two columns ( |
x.range |
vector of data.frame with one column for range of N rate of interested for prediction interval |
B |
bootstrap sample size |
plus_minus |
radius of random initial values (default: |
n.start |
total number of initial points considered (default: |
print.progress |
logical flag whether printing progress |
Value
boot.resid.linear.plateau
returns a list of two elements:
result
: matrix with B rows and columns containing bootstrap sample for parameter (a,b,c
), optimal N and yield (max_x, max_y
), log-likelihood (logLik
) and N values of interest;
x.range
: range of x considered for prediction interval (same as x.range
in vector form)
Examples
set.seed(1)
x <- rep(1:300, each=4)
a <- 8; b <- 0.05; c <- 100
y <- a + b * (x - c) * (x <= c) +
rnorm(length(x), sd=1)
d <- cbind(x,y)
# a converged example:
ans <- f.linear.plateau(d, start=list(a = 7, b = 0.1, c = 150),
plus_minus=10, n.start=10, msg=FALSE)
ans.boot <- boot.resid.linear.plateau(ans, d, x.range=seq(0,280,by=40),
B=9, plus_minus = 1e2, n.start=1000, print.progress=TRUE) # use larger B for inference