View source: R/lmerSeq_contrast_gls.R
| lmerSeq.contrast.gls | R Documentation |
Conducts t- or F-tests on linear contrasts of regression coefficients from fits done using lmerSeq.fit.gls function. If the contrast matrix has only 1 row, a t-test is done. If the contrast matrix has more than 1 row, an F-test is done
lmerSeq.contrast.gls( lmerSeq_results = NULL, contrast_mat = NULL, p_adj_method = "BH", sort_results = T )
lmerSeq_results |
Results object from running lmerSeq.fit.gls |
contrast_mat |
Numeric matrix representing the contrast to be tested. Matrix must have the same number of columns as the number of coefficients in the model. If the matrix has multiple rows, a simultaneous F-test will be done |
p_adj_method |
Method for adjusting for multiple comparisons (default is Benjamini-Hochberg). See p.adjust.methods |
sort_results |
Should the results table be sorted by adjusted p-value? |
data("expr_data")
vst_expr <- expr_example$vst_expr
sample_meta_data <- expr_example$sample_meta_data
##Only including 10 genes in the expression matrix
vst_expr <- vst_expr[1:10, ]
## Fit the Model
fit.lmerSeq.gls <- lmerSeq.fit.gls(form = ~ group * time,
cor_str = nlme::corCompSymm(form = ~ 1 | ids),
expr_mat = vst_expr,
sample_data = sample_meta_data,
method = 'REML')
## 1 dimensional contrast (t-test)
cont_mat1 <- rbind(c(0, 1, 0, 1)) # group diff. at followup
contrast_summary1 <- lmerSeq.contrast.gls(lmerSeq_results = fit.lmerSeq.gls,
contrast_mat = cont_mat1,
p_adj_method = 'BH',
sort_results = T)
print(contrast_summary1)
## multi-dimensional contrast (F-test)
cont_mat2 <- rbind(c(0, 1, 0, 0),
c(0, 0, 1, 0),
c(0, 0, 0, 1)) # simultaneous test of all coefficients
contrast_summary2 <- lmerSeq.contrast.gls(lmerSeq_results = fit.lmerSeq.gls,
contrast_mat = cont_mat2,
p_adj_method = 'BH',
sort_results = T)
print(contrast_summary2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.