fit.model | R Documentation |
Fits a model to each protein of a protdata
object and returns a corresponding protLM
object.
In its standard settings, the function returns a protLM
object containing robust ridge models as described in Goeminne et al. (2015).
However, the user can also specify to turn off the ridge regression and fit the models by ordinary least squares (OLS) and/or to turn off the down-weighing of outliers by M estimation with Huber weights and/or to turn off the Empirical Bayes squeezing of variances.
fit.model(protdata, response = NULL, fixed = NULL, random = NULL, add.intercept = TRUE, shrinkage.fixed = NULL, weights = "Huber", k = 1.345, par_squeeze = NULL, squeezeVar = TRUE, min_df = 1, robust_var = TRUE, robustM = TRUE, scaleUnshrFix = FALSE, modfiedGS = FALSE, tolPwrss = 1e-10, verbose = FALSE, printProgress = FALSE, shiny = FALSE, message_fitting = NULL, message_thetas = NULL, message_squeeze = NULL, message_update = NULL, ...)
protdata |
A |
response |
The name of the column in the data slot of the |
fixed |
Either a vector of names corresponding to the columns in the data slot of the |
random |
Either a vector of names corresponding to the columns in the data slot of the |
add.intercept |
A logical value indicating whether the fitted models should contain a fixed intercept. If missing, the value is set to |
shrinkage.fixed |
A numeric vector containing only 0 and/or 1 of length equal to the number of fixed effects, potential intercept included. The nth element in the shrinkage.fixed vector indicates whether the nth fixed effect should be shrunken (value 1) or not (value 0). If |
weights |
The type of weighing that should be performed. Supported weighing methods incluce |
k |
The tuning constant for the Huber mean when weighing down outliers. The default ( |
par_squeeze |
A character vector indicating which model parameters need to be squeezed. When squeezing random effects, provide their names. Fixed effects are present in shrinkage groups, e.g. ridgeGroup.1. If you want them to be squeezed as well, provide the names of the shrinkage groups that need to be squeezed. The default |
squeezeVar |
A logical indicating whether the residual standard deviation of all models should be squeezed towards a common value. Defaults to |
min_df |
A numeric value indicating the minimal degrees of freedom that will be taken into account for calculating the prior degrees of freedom and prior variance. Only used when |
robust_var |
A logical indicating wheter the estimation of the prior degrees of freedom and the prior variance (needed for shrinkage) should be robustified against outlier variances. Only used when |
robustM |
A logical indicating wheter the weighing of the observations in the M estimation step should be based on the Huber weights of the residuals devided by the median absolute deviation (mad) of the residuals instead of the residuals devided by the residual standard deviation. Older MSqRob implementations used the approach with the residual standard deviation as a default. With the new approach, downweighing outliers will be more efficient, as the mad is not strongly influenced by outliers. Defaults to |
modfiedGS |
A logical indicating wheter the Modified Gram-Schmidt algorithm should be used for orthogonalizing the fixed effects design matrix instead of the regular QR decomposition algorithm. Defaults to |
tolPwrss |
A numeric value indicating the maximally tolerated deviation on the penalized weighted residual sum of squares when iteratively estimating the weights by M estimation. |
verbose |
A logical value indicating whether the models should be printed out. Defaults to |
printProgress |
A logical indicating whether the R should print a message before fitting each model. Defaults to |
shiny |
A logical indicating whether this function is being used by a Shiny app. Setting this to |
message_fitting |
Only used when |
message_thetas |
Only used when |
message_squeeze |
Only used when |
message_update |
Only used when |
... |
Other parameters to be passed to the model fitting function internally. |
A protLM
object containing the names of all proteins in the input protdata
object and their corresponding fitted models.
Ludger Goeminne, Kris Gevaert and Lieven Clement. Peptide-level robust ridge regression improves estimation, sensitivity and specificity in data-dependent quantitative label-free shotgun proteomics. Molecular & Cellular Proteomics, 2016.
data(proteinsCPTAC, package="MSqRob") #Fitting models for the first 10 proteins in the protdata object proteinsCPTAC using the robust ridge approach of Goeminne et al. (2015): modelRRCPTAC <- fit.model(protdata=proteinsCPTAC[1:10], response="value", fixed="conc", random=c("Sequence","instrlab"), add.intercept=TRUE, shrinkage.fixed=NULL, weights="Huber", k = 1.345, tolPwrss = 1e-10, verbose=FALSE) #Fitting models for the first 10 proteins in the protdata object proteinsCPTAC using an ordinary least squares approach (i.e. no shrinkage and no M estimation): modelLmCPTAC <- fit.model(protdata=proteinsCPTAC[1:10], response="value", fixed=c("conc","Sequence","instrlab"), random=NULL, add.intercept=TRUE, shrinkage.fixed=c(0,0,0), weights=NULL, k = 1.345, tolPwrss = 1e-10, verbose=FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.