Test multiple starting levels for linear regression model, select best and plot
The aim of this function is to select the data suiting set of levels of the main input data to construct a linear regression model.
In real world measurements one may be confronted to the case of very low level analytes below the detection limit (LOD) and resulting read-outs fluctuate around around a common baseline (instead of NA
).
With such data it may be preferable to omit the read-outs for the lowest concentrations/levels of analytes if they are spread around a base-line value.
This function allows trying to omit all starting levels designed in startLev
, then the resulting p-values for the linear regression slopes will be checked and the best p-value chosen.
The input may also be a MArrayLM-type object from package limma or from moderTestXgrp
or moderTest2grp
.
In the graphical representation all points assocoated to levels omitted are shown in light green.
For the graphical display additional information can be used : If the dat
is list or MArrayLM-type object, the list-elements $raw (according to argument lisNa
will be used to display points initially given as NA ad imputed lateron in grey.
Logarithmic (ie log-linear) data can be treated by settting argument logExpect=TRUE
. Then the levels will be taken as exponent of 2 for the regression, while the original values will be displayed in the figure.
linModelSelect( rowNa, dat, expect, logExpect = FALSE, startLev = NULL, lisNa = c(raw = "raw", annot = "annot", datImp = "datImp"), plotGraph = TRUE, tit = NULL, pch = c(1, 3), cexLeg = 0.95, cexSub = 0.85, xLab = NULL, yLab = NULL, cexXAxis = 0.85, cexYAxis = 0.9, xLabLas = 1, cexLab = 1.1, silent = FALSE, callFrom = NULL )
rowNa |
(character, length=1) rowname for line to be extracted from |
dat |
(matrix, list or MArrayLM-object from limma) main input of which columns should get re-ordered, may be output from |
expect |
(numeric of character) the expected levels; if character, constant unit-characters will be stripped away to extact the numeric content |
logExpect |
(logical) toggle to |
startLev |
(integer) specify all starting levels to test for omitting here (multiple start sites for modelling linear regression may be specified to finally pick the best model) |
lisNa |
(character) in case |
plotGraph |
(logical) display figure |
tit |
(character) optional custom title |
pch |
(integer) symbols to use n optional plot; 1st for regular values, 2nd for values not used in regression |
cexLeg |
(numeric) size of text in legend |
cexSub |
(numeric) text-size for line (as subtitle) giving regression details of best linear model) |
xLab |
(character) custom x-axis label |
yLab |
(character) custom y-axis label |
cexXAxis |
(character) |
cexYAxis |
(character) |
xLabLas |
(integer) |
cexLab |
(numeric) |
silent |
(logical) suppress messages |
callFrom |
(character) allow easier tracking of message(s) produced |
list with $coef (coefficients), $name (as/from input rowNa
), $startLev the best starting level)
moderTestXgrp
for single comparisons, order
## Construct data li1 <- rep(c(4,3,3:6),each=3) + round(runif(18)/5,2) names(li1) <- paste0(rep(letters[1:5], each=3), rep(1:3,6)) li2 <- rep(c(6,3:7), each=3) + round(runif(18)/5, 2) dat2 <- rbind(P1=li1, P2=li2) exp2 <- rep(c(11:16), each=3) ## Check & plot for linear model linModelSelect("P2", dat2, expect=exp2) ## Log-Linear data ## Suppose dat2 is result of measures in log2, but exp4 is not exp4 <- rep(c(3,10,30,100,300,1000), each=3) linModelSelect("P2", dat2, expect=exp4, logE=FALSE) # bad linModelSelect("P2", dat2, expect=exp4, logE=TRUE)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.