Learn R Programming

FCSlib (version 1.2.1)

polyDetrend: Polynomial detrending of a time series

Description

Performs the polynomial detrending algorithm over a vector

Usage

polyDetrend(f, acqTime, nIntervals, degree = 3, plot = TRUE)

Arguments

f

A vector

acqTime

Point acquisition rate (in seconds)

nIntervals

Number of intervals into which the vector will be grouped before a polynomial model fit

degree

The degree of the polynomial function

plot

Boolean, set to TRUE (default) to plot the result

Value

A vector

Details

First, the binTimeSeries() function is used to obtain a binned version of 'f' of 'nIntervals' points. A polynomial model of user-specified degree is then adjusted to the binned vector. The full time series is then evaluated using the obtained model and the residuals are calculated. Finally, the maximum value of the fitted time series is added to the residuals for trend correction.

See Also

expDetrend boxcarDetrend binTimeSeries

Examples

Run this code
# NOT RUN {
### Please navigate to
### (https://github.com/FCSlib/FCSlib/tree/master/Sample%20Data)
### to find this sample data

x <- read.table("PB030.dat", header = F)

x.d <- polyDetrend(x[,2], acqTime = 4e-6, nIntervals = 100, degre = 5)
# }

Run the code above in your browser using DataLab