jsmurf {stepR} | R Documentation |
Reconstruct filtered piecewise constant functions with noise
Description
Reconstructs a piecewise constant function to which white noise was added and the sum filtered afterwards.
Deprecation warning: This function is mainly used for patchlamp recordings and may be transferred to a specialised package.
Usage
jsmurf(y, x = 1:length(y), x0 = 2 * x[1] - x[2], q, alpha = 0.05, r = 4e3,
lengths = 2^(floor(log2(length(y))):floor(log2(max(length(param$kern) + 1,
1 / param$param$cutoff)))), param, rm.out = FALSE,
jumpint = confband, confband = FALSE)
Arguments
y |
a numeric vector containing the serial data |
x |
a numeric vector of the same length as |
x0 |
a single numeric giving the last unobserved sample point directly before sampling started |
q |
threshold value, by default chosen automatically |
alpha |
significance level; if set to a value in (0,1), |
r |
numer of simulations; if specified along |
lengths |
length of intervals considered; by default up to a sample size of 1000 all lengths, otherwise only dyadic lengths |
param |
a |
rm.out |
a |
jumpint |
|
confband |
|
Value
An object object of class stepfit
that contains the fit; if jumpint == TRUE
function jumpint
allows to extract the 1 - alpha
confidence interval for the jumps, if confband == TRUE
function confband
allows to extract the 1 - alpha
confidence band.
References
Hotz, T., Schütte, O., Sieling, H., Polupanow, T., Diederichsen, U., Steinem, C., and Munk, A. (2013) Idealizing ion channel recordings by a jump segmentation multiresolution filter. IEEE Transactions on NanoBioscience 12(4), 376–386.
See Also
stepbound
, bounds
, family, MRC.asymptotic
, sdrobnorm
, stepfit
Examples
# simulate filtered ion channel recording with two states
set.seed(9)
# sampling rate 10 kHz
sampling <- 1e4
# tenfold oversampling
over <- 10
# 1 kHz 4-pole Bessel-filter, adjusted for oversampling
cutoff <- 1e3
df.over <- dfilter("bessel", list(pole=4, cutoff=cutoff / sampling / over))
# two states, leaving state 1 at 10 Hz, state 2 at 20 Hz
rates <- rbind(c(0, 10), c(20, 0))
# simulate 0.5 s, level 0 corresponds to state 1, level 1 to state 2
# noise level is 0.3 after filtering
sim <- contMC(0.5 * sampling, 0:1, rates, sampling=sampling, family="gaussKern",
param = list(df=df.over, over=over, sd=0.3))
plot(sim$data, pch = ".")
lines(sim$discr, col = "red")
# fit using filter corresponding to sample rate
df <- dfilter("bessel", list(pole=4, cutoff=cutoff / sampling))
fit <- jsmurf(sim$data$y, sim$data$x, param=df, r=1e2)
lines(fit, col = "blue")
# fitted values take filter into account
lines(sim$data$x, fitted(fit), col = "green3", lty = 2)