pd_row_t_test {proDA} | R Documentation |
This is a helper function that combines the call of proDA()
and test_diff()
. If you need more flexibility use those
functions.
pd_row_t_test(X, Y, moderate_location = TRUE, moderate_variance = TRUE, alternative = c("two.sided", "greater", "less"), pval_adjust_method = "BH", location_prior_df = 3, max_iter = 20, epsilon = 0.001, return_fit = FALSE, verbose = FALSE) pd_row_f_test(X, ..., groups = NULL, moderate_location = TRUE, moderate_variance = TRUE, pval_adjust_method = "BH", location_prior_df = 3, max_iter = 20, epsilon = 0.001, return_fit = FALSE, verbose = FALSE)
X, Y, ... |
the matrices for condition 1, 2 and so on. They must have the same number of rows. |
moderate_location |
boolean values
to indicate if the location and the variances are
moderated. Default: |
moderate_variance |
boolean values
to indicate if the location and the variances are
moderated. Default: |
alternative |
a string that decides how the
hypothesis test is done. This parameter is only relevant for
the Wald-test specified using the 'contrast' argument.
Default: |
pval_adjust_method |
a string the indicates the method
that is used to adjust the p-value for the multiple testing.
It must match the options in |
location_prior_df |
the number of degrees of freedom used
for the location prior. A large number (> 30) means that the
prior is approximately Normal. Default: |
max_iter |
the maximum of iterations |
epsilon |
if the remaining error is smaller than |
return_fit |
boolean that signals that in addition to the
data.frame with the hypothesis test results, the fit from
|
verbose |
boolean that signals if the method prints messages
during the fitting. Default: |
groups |
a factor or character vector with that assignes the
columns of |
The pd_row_t_test
is not actually doing a t-test, but rather
a Wald test. But, as the two are closely related and term t-test is
more widely understood, we choose to use that name.
If return_fit == FALSE
a data.frame is returned with the content
that is described in test_diff
.
If return_fit == TRUE
a list is returned with two elements:
fit
with a reference to the object returned from proDA()
and a test_result()
with the data.frame returned from
test_diff()
.
proDA
and test_diff
for more
flexible versions. The function was inspired
by the rowFtests
function in the genefilter
package.
data1 <- matrix(rnorm(10 * 3), nrow=10) data2 <- matrix(rnorm(10 * 4), nrow=10) data3 <- matrix(rnorm(10 * 2), nrow=10) # Comparing two datasets pd_row_t_test(data1, data2) # Comparing multiple datasets pd_row_f_test(data1, data2, data3) # Alternative data_comb <- cbind(data1, data2, data3) pd_row_f_test(data_comb, groups = c(rep("A",3), rep("B", 4), rep("C", 2))) # t.test, lm, pd_row_t_test, and pd_row_f_test are # approximately equivalent on fully observed data set.seed(1) x <- rnorm(5) y <- rnorm(5, mean=0.3) t.test(x, y) summary(lm(c(x, y) ~ cond, data = data.frame(cond = c(rep("x", 5), rep("y", 5)))))$coefficients[2,] pd_row_t_test(matrix(x, nrow=1), matrix(y, nrow=1), moderate_location = FALSE, moderate_variance = FALSE) pd_row_f_test(matrix(x, nrow=1), matrix(y, nrow=1), moderate_location = FALSE, moderate_variance = FALSE)