Description Usage Arguments Value Examples
View source: R/f.quad.plateau.R
f.quad.plateau
fits quadratic plateau model using multiple initial values. The multiple initial values are randomly sampled in a "cube" of parameter space. More precisely, quadratic plateau model assumes
y ~ (a + b * x + c *x^2) * (x <= -0.5*b/c) + (a + -b^2/(4 * c)) * (x > -0.5 * b/c).
1 2 3 4 5 6 7 | f.quad.plateau(
d,
start = list(a = 1, b = 1, c = 1),
plus_minus = 100,
n.start = 1000,
msg = FALSE
)
|
d |
data frame with two columns ( |
start |
initial estimate for non-linear least square (default value: |
plus_minus |
radius of random initial values (default: |
n.start |
total number of initial points considered (default: |
msg |
logical flag whether printing progress |
f.quad.plateau
returns a list of two components (if converged): nls.summary
: summary of the fitted model; nls.model
: nls object
1 2 3 4 5 6 7 8 9 10 11 12 | set.seed(3)
x <- rep(1:300, each=4)
a <- 8; b <- 0.05; c <- -1e-4
y <- (a + b * x + c *x^2) * (x <= -0.5*b/c) + (a + -b^2/(4 * c)) * (x > -0.5 * b/c) +
rnorm(length(x), sd=0.1)
d <- cbind(x,y)
# a converged example:
ans <- f.quad.plateau(d, start=list(a = 7, b = 0.02, c = 1e-5),
plus_minus=10, n.start=10, msg=FALSE)
summary(ans$nls.model)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.