Last chance! 50% off unlimited learning
Sale ends in
Find candidates for jumps in serial data by forward selection.
stepcand(y, x = 1:length(y), x0 = 2 * x[1] - x[2], max.cand = NULL,
family = c("gauss", "gaussvar", "poisson", "binomial", "gaussKern"), param = NULL,
weights = rep(1, length(y)), cand.radius = 0)
a numeric vector containing the serial data
a numeric vector of the same length as y
containing the corresponding sample points
a single numeric giving the last unobserved sample point directly before sampling started
single integer giving the maximal number of blocks to find; defaults to using all data (note: there will be one block more than the number of jumps
distribution of the errors, either "gauss"
, "poisson"
or "binomial"
; "gaussInhibit"
is like "gauss"
forbids jumps getting close together or to the ends in steppath.stepcand
, "gaussInhibitBoth" already forbids this in stepcand
(not recommended)
additional parameters specifying the distribution of the errors; the number of trials for family "binomial"
; for gaussInhibit
and gaussInhibitBoth
a numeric of length 3 with components "start"
, "middle"
and "end"
preventing the first jump from getting closer to x0
than the "start"
value, any two jumps from getting closer than the "middle"
value, and the last jump from geting closer than the "end"
value to the end, all distances measured by weights (cf. example below)
a numeric vector of the same length as y
containing non-negative weights
a non-negative integer: adds for each candidate found all indices that are at most cand.radius
away
An object of class stepcand
extending class stepfit
such that it can be used as an input to steppath.stepcand
: additionally contains columns
cumSum
The cumulative sum of x
up to rightEnd
.
cumSumSq
The cumulative sum of squares of x
up to rightEnd
(for family = "gauss"
).
cumSumWe
The cumulative sum of weights up to rightEnd
.
improve
The improvement this jump brought about when it was selected.
# NOT RUN {
# simulate 5 blocks (4 jumps) within a total of 100 data points
b <- c(sort(sample(1:99, 4)), 100)
f <- rep(rnorm(5, 0, 4), c(b[1], diff(b)))
rbind(b = b, f = unique(f), lambda = exp(unique(f) / 10) * 20)
# add gaussian noise
x <- f + rnorm(100)
# find 10 candidate jumps
stepcand(x, max.cand = 10)
# for poisson observations
y <- rpois(100, exp(f / 10) * 20)
# find 10 candidate jumps
stepcand(y, max.cand = 10, family = "poisson")
# for binomial observations
size <- 10
z <- rbinom(100, size, pnorm(f / 10))
# find 10 candidate jumps
stepcand(z, max.cand = 10, family = "binomial", param = size)
# }
Run the code above in your browser using DataLab