Checks for orthogonality of all points by calculating the angle between the slope of the tangent at (x0i,y0i) and the slope of the Euclidean vector ∥Di∥ to (xi,yi), which should be 90∘ if the Euclidean distance has been minimized. See 'Details'.
latin1
check_o(object, plot =TRUE)
Arguments
object: an object returned from onls.
plot: logical. If TRUE, the α-values are plotted for a quick overview of orthogonality for all points.
Returns
A dataframe containing xi, x0i, yi, y0i, αi, dxdf and a logical for 89.95∘<αi<90.05∘. If plot = TRUE, a plot of the α-values in black if orthogonal, or red otherwise.
Details
This is a validation method for checking the orthogonality between all (x0i,y0i) and (xi,yi). The function calculates the angle between the slope mi of the tangent obtained from the first derivative at (x0i,y0i) and the slope ni of the onls-minimized Euclidean distance between (x0i,y0i) and (xi,yi):
## 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:20y <-10+3*x^2y <- 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)