search for: myloss

Displaying 1 result from an estimated 1 matches for "myloss".

Did you mean: myboss
2003 Feb 26
0
Re: R-help digest, Vol 1 #89 - 53 msgs
...s functions. # (For some model objects, the predict method requires something # like "predict(CurveObject, newdata = data.frame(x = s))".) MakeLoss <- function(x, CurveObject) { function(s) MyDistance(x, c(s, predict(CurveObject, s)$y)) } # Now make the loss function for X1... MyLoss <- MakeLoss(X1, example.spline) # ...and optimize. For a higher-dimensional problem, use "optim" # rather than "optimize". closest.x <- optimize(MyLoss, interval = c(-1, 1))$minimum lines(c(X1[1], closest.x), c(X1[2], predict(example.spline, closest.x)$y)) Good lu...