data(gcd)
res <- ush.test(x = gcd$amount, y = gcd$qual)
res
#optimal knot is not found so candidate can be defined as follows:
direction.t <- res$candidate[res$candidate$direction, ]
optimal.k <- direction.t$cp[direction.t$deviance%in%min(direction.t$deviance)]
optimal.k
Run the code above in your browser using DataLab