Learn R Programming

factDesign (version 1.48.0)

findFC: A function to find the fold change between two experimental conditions in a factorial experiment based on the linear model parameter estimates.

Description

'findFC' constructs a point estimate of fold change using the linear model coefficients in an lm object.

Usage

findFC(model, lambdaNum, lambdaDenom, logbase=NULL)

Arguments

model
An lm object.
lambdaNum
A numeric vector of coefficients for the parameters to be used in the numerator of the fold change estimate.
lambdaDenom
A numeric vector of coefficients for the parameters to be used in the denominator of the fold change estimate.
logbase
By default, set to NULL. For log-transformed data, the base of the logarithm. Specify "exp" for natural log-transformed data.

Value

A point estimate of the fold change between the experimental conditions specified in the lambdaNum and lambdaDenom vectors.

Details

logbase=NULL if the data have not been log-transformed. The fold change estimate is calculated as the ratio for the parameter estimates corresponding to the experimental conditions of interest.

logbase="exp" if the data have been natural log-transformed. The fold change is calculated as the difference in the parameter estimates for the two conditions of interest, then exponentiated using exp().

logbase can be set to any number, for example 2, for other log transforms. The fold change is calculated as the difference in the parameter estimates for the two conditions of interest, then exponentiated with logbase as the base.

See Also

par2lambda

Examples

Run this code

data(estrogen)
ES <- pData(estrogen)[["ES"]]
TIME <- pData(estrogen)[["TIME"]]   
fit <- lm(exprs(estrogen)["33744_at",] ~ ES + TIME + ES*TIME)
betaNames <- names(coef(fit))
betas <- list(c("(Intercept)","ESP","TIME48h","ESP:TIME48h"),
					c("(Intercept)","ESP"))
coefs <- list(c(1,1,1,1),c(1,1))
lambda <- par2lambda(betaNames,betas,coefs)
findFC(fit,lambda[1,],lambda[2,],logbase=2)

Run the code above in your browser using DataLab