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
Cheers
Petr
> -Original Message-
> From: R-help On Behalf Of Tung Nguyen
> Sent: Wednesday, January 22, 2020 4:01 PM
> To: r-help@r-project.org
> Subject: [R] Error with constrained curve fitting through specific points
>
> Hello R-Help,
>
> I'm trying to find t
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
Hello R-Help,
I'm trying to find the best fitting curve through a given set of points.
The fitted curve must also pass through these points. I found an answer on
Cross Validated which suggested to use the `cobs: Constrained B-Splines
(Sparse Matrix Based)` package. However, I got an error while te
7 matches
Mail list logo