fit_nonlinear {proBatch} | R Documentation |
Fit a non-linear trend (currently optimized for LOESS)
fit_nonlinear( df_feature_batch, measure_col = "Intensity", order_col = "order", feature_id = NULL, batch_id = NULL, fit_func = "loess_regression", optimize_span = FALSE, no_fit_imputed = TRUE, qual_col = "m_score", qual_value = 2, min_measurements = 8, ... )
df_feature_batch |
data frame containing response variable e.g. samples in order and explanatory variable e.g. measurement for a specific feature (peptide) in a specific batch |
measure_col |
if |
order_col |
column in |
feature_id |
the name of the feature, required for warnings |
batch_id |
the name of the batch, required for warnings |
fit_func |
function to use for the fit, e.g. |
optimize_span |
logical, whether to specify span or optimize it (specific entirely for LOESS regression) |
no_fit_imputed |
(logical) whether to fit the imputed (requant) values |
qual_col |
column to color point by certain value denoted
by |
qual_value |
value in |
min_measurements |
the absolute threshold to filter |
... |
additional parameters to be passed to the fitting function |
vector of fitted response values
test_peptide = example_proteome$peptide_group_label[1] selected_peptide = example_proteome$peptide_group_label == test_peptide df_selected = example_proteome[selected_peptide,] selected_batch = example_sample_annotation$MS_batch == 'Batch_1' batch_selected_df = example_sample_annotation[selected_batch,] df_for_test = merge(df_selected, batch_selected_df, by = 'FullRunName') fit_values = fit_nonlinear(df_for_test) #for the case where are two many missing values, no curve is fit selected_batch = example_sample_annotation$MS_batch == 'Batch_2' batch_selected_df = example_sample_annotation[selected_batch,] df_for_test = merge(df_selected, batch_selected_df, by = 'FullRunName') fit_values = fit_nonlinear(df_for_test) missing_values = df_for_test[['m_score']] == 2 all(fit_values[!is.na(fit_values)] == df_for_test[['Intensity']][!missing_values])