Learn R Programming

chipPCR (version 1.0-2)

lm.coefs: Compute linear model coefficients

Description

Computes linear model using the robust linear regression.

Usage

lm.coefs(x, y, method.reg)

Arguments

x

a vector of ordinate values.

y

a vector of abscissa values.

method.reg

defines the method ("rfit", "lmrob", "rq", "least") for the linear regression.

Value

A data frame with one column and two rows representing coefficients of the linear model.

Details

lm.coefs is a convenient wrapper around few functions performing normal (least squares) and robust linear regression. If the robust linear regression is impossible, lm.coefs will give a warning and perform linear regression using the least squares method. This function can be used to calculate the background of an amplification curve. The coefficients of the analysis can be used for a trend based correction of the entire data set.

See Also

rq, rfit, lm, lmrob

Examples

Run this code
# NOT RUN {
plot(VIMCFX96_69[, 1], VIMCFX96_69[, 2], type = "l", xlab = "Cycle", 
     ylab = "Fluorescence")
rect(1,0,10,5000)
method <- c("lmrob", "rq", "least", "rfit")
for (i in 1:4) {
  tmp <- lm.coefs(VIMCFX96_69[1:10, 1], VIMCFX96_69[1:10, 2], 
		  method.reg = method[i])
  abline(a = tmp[1, 1], b = tmp[2, 1], col = i + 1, lwd = 1.5)
}
legend(2, 3000, c("Data", "lmrob", "rq", "least", "rfit"), lty = 1, col = 1:5, 
       cex = 1.5)
# }

Run the code above in your browser using DataLab