L2splineC: Constrained L2 spline. Function to compute a constrained L2...

Usage Arguments Examples

View source: R/L2splineC.R

Usage

1
2
L2splineC(t, y, gfun, y0 = 0, mp = 100, constr = 0, sign = 1,
  lambda = 1e-04)

Arguments

t

Numeric vector of measurement times.

y

Numeric vector of values to be fitted.

gfun

Choice of Greens function (choose from G1-G10).

y0

Numeric value to move y-values up or down. Per default y0 = 0.

mp

Integer value. Number of points to evaluate spline in.

constr

Integer value in (0, 1, 2). Choice of 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.

Examples

 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 = L2splineC(t, y, 3, 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 = L2splineC(t, y, 3, 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 = L2splineC(t, y, 1, constr=0)
lines(t, S)

helenecharlotte/L1splines documentation built on May 17, 2019, 3:24 p.m.