check_o {onls} | R Documentation |
Check the fit for orthogonality of all points
Description
Checks for orthogonality of all points by calculating the angle between the slope of the tangent at and the slope of the Euclidean vector
to
, which should be
if the Euclidean distance has been minimized. See 'Details'.
Usage
check_o(object, plot = TRUE)
Arguments
object |
an object returned from |
plot |
logical. If |
Details
This is a validation method for checking the orthogonality between all and
. The function calculates the angle between the slope
of the tangent obtained from the first derivative at
and the slope
of the
onls
-minimized Euclidean distance between and
:
Value
A dataframe containing ,
,
,
,
,
and a logical for
. If
plot = TRUE
, a plot of the -values in black if orthogonal, or red otherwise.
Author(s)
Andrej-Nikolai Spiess
Examples
## Compare 'data range extended' orthogonal model with a
## 'data range restricted' model by setting "extend = c(0, 0)"
## => some x may not be orthogonal!
x <- 1:20
y <- 10 + 3*x^2
y <- sapply(y, function(a) rnorm(1, a, 0.1 * a))
DAT <- data.frame(x, y)
mod1 <- onls(y ~ a + b * x^2, data = DAT, start = list(a = 1, b = 1))
check_o(mod1)
mod2 <- onls(y ~ a + b * x^2, data = DAT, start = list(a = 1, b = 1),
extend = c(0, 0))
check_o(mod2)