Learn R Programming

flagme (version 1.28.0)

rmaFitUnit: Fits a robust linear model (RLM) for one metabolite

Description

Using rlm from MASS, this procedure fits a linear model using all the fragments

Usage

rmaFitUnit(u,maxit=5,mzEffect=TRUE,cls=NULL,fitSample=TRUE,fitOrCoef=c("coef","fit"),TRANSFORM=log2)

Arguments

u
a metabolite unit (list object with vectors mz and rt for m/z and retention times, respectively and a data element giving the fragmentxsample intensitity matrix)
maxit
maximum number of iterations (default: 5)
mzEffect
logical, whether to fit m/z effect (default: TRUE)
cls
class variable
fitSample
whether to fit individual samples (alternative is fit by group)
fitOrCoef
whether to return a vector of coefficients (default: "coef"), or an rlm object ("fit")
TRANSFORM
function to transform the raw data to before fitting (default: log2)

Value

list giving elements of fragment and sample coefficients (if fitOrCoef="coef") or a list of elements from the fitting process (if fitOrCoef="fit")

Details

Fits a robust linear model.

References

Mark D Robinson (2008). Methods for the analysis of gas chromatography - mass spectrometry data PhD dissertation University of Melbourne.

See Also

peaksAlignment, clusterAlignment

Examples

Run this code
require(gcspikelite)

# paths and files
gcmsPath<-paste(find.package("gcspikelite"),"data",sep="/")
cdfFiles<-dir(gcmsPath,"CDF",full=TRUE)
eluFiles<-dir(gcmsPath,"ELU",full=TRUE)

# read data, peak detection results
pd<-peaksDataset(cdfFiles[1:2],mz=seq(50,550),rtrange=c(7.5,8.5))
pd<-addAMDISPeaks(pd,eluFiles[1:2])

# pairwise alignment using all scans
fullca<-clusterAlignment(pd, usePeaks = FALSE, df = 100)

# calculate retention time shifts
timedf<-calcTimeDiffs(pd, fullca)

Run the code above in your browser using DataLab