changePoint: Find Variance Change Point

Description Usage Arguments Details Examples

View source: R/Variance_Threshold.R

Description

I was surprised to find that most all of the the work in detecting changes in varance are almost always associated with time-series objects. There are several packages that address change-in-means situations in regression problems. Given this, we will convert the problem to a change-in-mean by calculating a moving window of standard deviation values and then find the change-point on these.

Usage

1
changePoint(data, window.length = 0.01, interval = TRUE)

Arguments

data

A data frame where each row is a Peptide and column represents a repeated measurement.

window.length

The proportion of the data to be used for the sliding window.

interval

A TRUE/FALSE flag that indicates if a bootstrap confidence interval should be calculated.

Details

Once the sliding-window standard deviations are calculated, we use a "mob" regression tree that fits a linear model on each leaf is run and we just fit a simple intercept only model. Thus the leaves will have an intercept and different variance terms.

To calculate a confidence interval, we do a bootstrap procedure where we bootstrap by resampling the peptides, so all repeats of a peptide is removed included as a group.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
df <- data.frame(x=seq(0,1,by=0.005)) %>%
  mutate(y1 = x + rnorm(length(x), sd=ifelse(x<0.5, .1, .3)),
         y2 = x + rnorm(length(x), sd=ifelse(x<0.5, .1, .3)),
         y3 = x + rnorm(length(x), sd=ifelse(x<0.5, .1, .3)))
ggplot(df, aes(x=x)) +
  geom_point(aes(y=y1)) +
  geom_point(aes(y=y2)) +
  geom_point(aes(y=y3))

changePoint(df[, 2:4], .01)
data = df[,2:4]

dereksonderegger/PepSeq documentation built on July 24, 2019, 12:57 a.m.