Description Usage Arguments Examples
Function to compute a constrained L2 spline.
1 2 | constrSpline(t, y, gfun, mp = 100, constr = -1, sign = 1,
lambda = 1e-04)
|
t |
Numeric vector of measurement times. |
y |
Numeric vector of values to be fitted. |
gfun |
Choice of Greens function (choose from G1-G10). |
mp |
Numeric value. Number of points to evaluate spline in. |
constr |
Numeric value in (-1, 0, 1, 2). Choice of constraint. -1: No constraint. 0: Positivity contraint. 1: Monotonicity constraint. 2: Convexity/concavity constraint. |
sign |
Numeric value in (-1, 1). 1: Increasing, convexity. -1: Decreasing, concavity. |
lambda |
Smoothness parameter. |
1 2 3 4 5 6 7 8 9 10 11 12 | t = generate.t(m = 25); y = generate.y(type = 2)(t) + generate.noise(t) + generate.noise(t)
plot(t, y, col = "blue")
S = constrSpline(t, y, G3, constr=1)
lines(attr(S, "t"), S)
t = generate.t(m = 25); y = -generate.y(type = 3)(t) + generate.noise(t) + generate.noise(t)
plot(t, y, col = "blue")
S = constrSpline(t, y, G3, constr=2, sign=-1)
lines(attr(S, "t"), S)
t = generate.t(m = 40); y = generate.y(type = 4)(t) + generate.noise(t)
plot(t, y, col = "blue")
S = constrSpline(t, y, G1, constr=0)
lines(t, S)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.