jp | R Documentation |
A symbolic routine to define that the underlying mean curve has a jump point in the formula argument to changept.
jp(x, trd1 = -1, trd2 = -1, up = TRUE)
x |
The predictor variable. |
trd1 |
If trd1 is |
trd2 |
If trd2 is |
up |
The jump direction at the jump point. The default is up = TRUE, i.e., there is an upward jump; otherwise, there is a downward jump. |
For the jump-point case, the user can choose either to impose a shape constraint on the estimated curve or not. If no shape constraint is imposed, only a jump point will be detected by the changept routine; otherwise, a jump point will be detected and the shape of the curve will be constrained according to the parameters trd1 and trd2 in a subinterval which is made of two consecutive knots and contains the jump point.
The vector "x" with five attributes, i.e., nm: the name of x; categ: the category of the change-point, "jump"; trd1 and trd2: -1
(non-increasing) or 1
(non-decreasing); up: the jump direction.
The nm and categ attributes are used in the plot routine; the trd1, trd2, and up attributes are used to set up a shape-constrained regression.
Xiyue Liao
tp
, ip
## Not run:
# simulated curve with an upward jump at .7
n = 1000
x = seq(1/n, 1, length = n)
set.seed(123)
y = 4 * sin(5 * x) + 3 * x + (x >= .7) + rnorm(n, sd = 1)
ans = changept(y ~ jp(x))
plot(ans)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.