Learn R Programming

crmn (version 0.0.21)

standardsPred: Predict effect for new data (or get fitted data)

Description

Predicted values for the standards

Usage

standardsPred(model, newdata, factors, lg = TRUE, ...)

Arguments

model

result from standardsFit

newdata

an ExpressionSet or matrix with new data (or the data used to fit the model to get the fitted data)

factors

the biological factors described in the pheno data slot if object is an ExpressionSet or a design matrix if object is a matrix.

lg

logical indicating that the data should be log transformed

...

passed on to standards and analytes

Value

the corrected data

Details

There is often unwanted variation in among the labeled internal standards which is related to the experimental factors due to overlapping peaks etc. This predicts this effect given a model of the overlapping variance. The prediction is given by \(\hat{X}_{IS}=X_{IS}-X_{IS}B\)

See Also

makeX, standardsFit

Examples

Run this code
# NOT RUN {
data(mix)
fullFit <- standardsFit(mix, "type", ncomp=3)
sfit <- standardsFit(mix[,-1], "type", ncomp=3)
pred <- standardsPred(sfit, mix[,1], "type")
cor(scores(sfit$fit$pc)[1,], scores(fullFit$fit$pc)[1,])
## could just as well have been done as
Y <- exprs(mix)
G <- model.matrix(~-1+mix$type)
isIS <- fData(mix)$tag == 'IS'
fullFit <- standardsFit(Y, G, ncomp=3, standards=isIS)
sfit    <- standardsFit(Y[,-1], G[-1,], ncomp=3,
                        standards=isIS)
pred <- standardsPred(sfit, Y[,1,drop=FALSE], G[1,,drop=FALSE], standards=isIS)
cor(scores(sfit$fit$pc)[1,], scores(fullFit$fit$pc)[1,])
# }

Run the code above in your browser using DataLab