Learn R Programming

pcr (version 1.2.2)

pcr_test: Statistical testing of PCR data

Description

A unified interface to different statistical significance tests for qPCR data

Usage

pcr_test(df, test = "t.test", ...)

Arguments

df

A data.frame of \(C_T\) values with genes in the columns and samples in rows rows

test

A character string; 't.test' default, 'wilcox.test' or 'lm'

...

Other arguments for the testing methods

Value

A data.frame of 5 columns in addition to term when test == 'lm'

  • term The linear regression comparison terms

  • gene The column names of df. reference_gene is dropped

  • estimate The estimate for each term

  • p_value The p-value for each term

  • lower The low 95% confidence interval

  • upper The high 95% confidence interval

For details about the test methods themselves and different parameters, consult t.test, wilcox.test and lm

Details

The simple t-test can be used to test the significance of the difference between two conditions \(\Delta C_T\). t-test assumes in addition, that the input \(C_T\) values are normally distributed and the variance between conditions are comparable. Wilcoxon test can be used when sample size is small and those two last assumptions are hard to achieve.

Two use the linear regression here. A null hypothesis is formulated as following, $$ C_{T, target, treatment} - C_{T, control, treatment} = C_{T, target, control} - C_{T, control, control} \quad \textrm{or} \quad \Delta\Delta C_T $$ This is exactly the \(\Delta\Delta C_T\) as explained earlier. So the \(\Delta\Delta C_T\) is estimated and the null is rejected when \(\Delta\Delta C_T \ne 0\).

References

Yuan, Joshua S, Ann Reed, Feng Chen, and Neal Stewart. 2006. <U+201C>Statistical Analysis of Real-Time PCR Data.<U+201D> BMC Bioinformatics 7 (85). BioMed Central. doi:10.1186/1471-2105-7-85.

Examples

Run this code
# NOT RUN {
# locate and read data
fl <- system.file('extdata', 'ct4.csv', package = 'pcr')
ct4 <- read.csv(fl)

# make group variable
group <- rep(c('control', 'treatment'), each = 12)

# test using t-test
pcr_test(ct4,
         group_var = group,
         reference_gene = 'ref',
         reference_group = 'control',
         test = 't.test')

# test using wilcox.test
pcr_test(ct4,
         group_var = group,
         reference_gene = 'ref',
         reference_group = 'control',
         test = 'wilcox.test')

# testing using lm
pcr_test(ct4,
         group_var = group,
         reference_gene = 'ref',
         reference_group = 'control',
         test = 'lm')

# testing advanced designs using a model matrix
# make a model matrix
group <- relevel(factor(group), ref = 'control')
dose <- rep(c(100, 80, 60, 40), each = 3, times = 2)
mm <- model.matrix(~group:dose, data = data.frame(group, dose))

# test using lm
pcr_test(ct4,
         reference_gene = 'ref',
         model_matrix = mm,
         test = 'lm')

# using linear models to check the effect of RNA quality
# make a model matrix
group <- relevel(factor(group), ref = 'control')
set.seed(1234)
quality <- scale(rnorm(n = 24, mean = 1.9, sd = .1))
mm <- model.matrix(~group + group:quality, data = data.frame(group, quality))

# testing using lm
pcr_test(ct4,
         reference_gene = 'ref',
         model_matrix = mm,
         test = 'lm')

# using linear model to check the effects of mixing separate runs
# make a model matrix
group <- relevel(factor(group), ref = 'control')
run <- factor(rep(c(1:3), 8))
mm <- model.matrix(~group + group:run, data = data.frame(group, run))

# test using lm
pcr_test(ct4,
         reference_gene = 'ref',
         model_matrix = mm,
         test = 'lm')

# }

Run the code above in your browser using DataLab