\Header{fitPLM}{Fit a Probe Level Model to Affymetrix Genechip Data.}
\keyword{manip}{fitPLM}
\begin{Description}\relax
This function converts an \code{\Link{AffyBatch}} into an
\code{\Link{PLMset}} by fitting a specified robust linear model to the
probe level data
\end{Description}
\begin{Usage}
\begin{verbatim}
fitPLM(object,model=PM ~ -1 + probes +samples,
variable.type=c(default="factor"),
constraint.type=c(default="contr.treatment"),
background=TRUE, normalize=TRUE, background.method = "RMA.2",normalize.method = "quantile",background.param=list(),normalize.param=list(),output.param=list(),model.param=list())
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{object}] an \code{\Link{AffyBatch}}
\item[\code{model}] A formula describing the model to fit. This is slightly
different from the standard method of specifying formulae in R. Read
the description below
\item[\code{variable.type}] a way to specify whether variables in the model
are factors or standard variables
\item[\code{constraint.type}] should factor variables sum to zero or have
first variable set to zero (endpoint constraint)
\item[\code{normalize}] logical value. If \code{TRUE} normalize data using
quantile normalization
\item[\code{background}] logical value. If \code{TRUE} background correct
using RMA background correction
\item[\code{background.method}] name of background method to use.
\item[\code{normalize.method}] name of normalization method to use.
\item[\code{background.param}] A list of parameters for background routines
\item[\code{normalize.param}] A list of parameters for normalization
routines
\item[\code{output.param}] A list of parameters controlling optional output
from the routine.
\item[\code{model.param}] A list of parameters controlling model procedure
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
This function fits robust Probe Level Linear models to all the probesets in
an \code{\Link{AffyBatch}}.
\end{Details}
\begin{Value}
An \code{\Link{PLMset}}
\end{Value}
\begin{Author}\relax
Ben Bolstad \email{bolstad@stat.berkeley.edu}
\end{Author}
\begin{References}\relax
Under Preparation
\end{References}
\begin{SeeAlso}\relax
\code{\Link{express}},\code{\Link{expresso}},
\code{\Link{rma}}, \code{\Link{threestep}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
data(affybatch.example)
Pset <- fitPLM(affybatch.example,model=PM ~ -1 + probes + samples)
se(Pset)[1:5,]

# A larger example testing weight image function
data(Dilution)
Pset <- fitPLM(Dilution,model=PM ~ -1 + probes + samples)
image(Pset)
boxplot(Pset)

#now lets try a wider class of models
Pset <- fitPLM(Dilution,model=PM ~ -1 + probes +liver,normalize=FALSE,background=FALSE)
coefs(Pset)[1:10,]

Pset <- fitPLM(Dilution,model=PM ~ -1 + probes + liver + scanner,normalize=FALSE,background=FALSE)
coefs(Pset)[1:10,]

#try liver as a covariate
logliver <- log2(c(20,20,10,10))
Pset <- fitPLM(Dilution,model=PM~-1+probes+logliver+scanner,normalize=FALSE,background=FALSE,variable.type=c(logliver="covariate"))
coefs(Pset)[1:10,]

#try a different se.type
Pset <- fitPLM(Dilution,model=PM~-1+probes+scanner,normalize=FALSE,background=FALSE,model.param=list(se.type=2))
se(Pset)[1:10,]
Pset <- fitPLM(Dilution,model=PM~-1+probes+scanner,normalize=FALSE,background=FALSE,model.param=list(se.type=3))
se(Pset)[1:10,]
\end{ExampleCode}
\end{Examples}

