search for: curveobject

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

2003 Feb 26
0
Re: R-help digest, Vol 1 #89 - 53 msgs
...example.spline # that's closest to X1? # Euclidean distance MyDistance <- function(x1, x2) { sqrt(sum((x2 - x1)^2)) } # For convenient re-use, a function that makes point-specific loss 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 "opt...