SSspherical: self start for spherical function

SSsphericalR Documentation

self start for spherical function

Description

Self starter for a spherical function with parameters a (intercept), b (see below), xs (break-point)

Usage

spherical(x, a, b, xs)

SSspherical(x, a, b, xs)

Arguments

x

input vector

a

the intercept

b

the difference between the intercept and the asymptote, so that a + b = asymptote

xs

break-point of transition between nonlinear and plateau

Details

This equation was found in a publication by Dobermann et al. (2011) \Sexpr[results=rd]{tools:::Rd_expr_doi("doi:10.2134/agronj2010.0179")}

This function is nonlinear when x < xs and flat (asymptote = a + b) when x >= xs.

Value

a numeric vector of the same length as x containing parameter estimates for equation specified

spherical: vector of the same length as x using the spherical function

Examples


require(ggplot2)
set.seed(123)
x <- seq(0, 400, length.out = 50)
y <- spherical(x, 2, 5, 200) + rnorm(length(x), sd = 0.5)
dat <- data.frame(x = x, y = y)
fit <- nls(y ~ SSspherical(x, a, b, xs), data = dat)
## plot
ggplot(data = dat, aes(x = x, y = y)) + 
  geom_point() + 
  geom_line(aes(y = fitted(fit)))
## Confidence intervals
confint(fit)



nlraa documentation built on Aug. 21, 2025, 5:59 p.m.