Thanks Rui and everyone for your help!
Using ` constraint = "increase"` and `lambda = 0.1` did it.
If we ignore the first point, `lambda = -1` option is also possible. `cobs`
will automatically choose a lambda value
plot(fit_result)
summary(fit_result)
# COBS smoothing spl
Sorry, I should have said "Spline Interpolation" (not spline fitting).
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-gui
This is probably the *simplest* approach:
> f = splinefun (dat$x, dat$y)
> #simple plot
> x = seq (0, 6,, 200)
> plot (dat)
> lines (x, f (x) )
If that's not what you want, perhaps you could expand on "constraints"
or "best fitting"...
Expanding on what Bert said, spline fitting and (regression
Hello,
This seems to "work". It doesn't give errors nor warnings and the fitted
line passes through the given points.
fit_result <- cobs(dat$x, dat$y,
constraint = "increase",
lambda = 0.1,
pointwise = con)
plot(y~x, dat)
pred <- predi
Hi
You probably has to use less points in con.
With just three points
> con1 <- con[c(1, 5, 10),]
> fit_result <- cobs(dat$x, dat$y, pointwise = con1)
qbsks2():
Performing general knot selection ...
Deleting unnecessary knots ...
function seems to work without error.
Cheers
Petr
> -Ori
Just a note: There is no such thing as "a best fitting curve" that must
pass through all the points.
You may wish to consult a statistician or spend time with references to
clarify your intent.
Bert Gunter
"The trouble with having an open mind is that people keep coming along and
sticking things
6 matches
Mail list logo