paired_test_continuous {depigner}R Documentation

Paired test for continuous variables


Statistical tests for paired continuous variable.


paired_test_continuous(group, x)



(fct) vector of groups


(num) vector of observations. Note: length of 'x' is considered equal to the number of subjects by the number of groups. Observation must be provided by subject (e.g. c(a1, b1, c1, a2, b2, c2, a3, b3, c3, a4, b4, c4), where the letters, a, b, c, and d represents the groups and the numbers represents the patients' ids). Note only patient with observation in all the levels considered will be used.


If the test is requested for two paired groups, the t.test is used.

If the test is requested for more than two groups, the test based on ANOVA for repeated measures is used (powered by aov)


A list with components 'P' (the computed P-value), 'stat' (the test statistic, either t or F), 'df' (degrees of freedom), 'testname' (test name), 'statname' (statistic name), 'namefun' ("paired_tstat", "rep_aov"), 'latexstat' (LaTeX representation of statname), 'plotmathstat' (for R - the plotmath representation of 'statname', as a character string), 'note' (contains a character string note about the test).


This function could be used as 'conTest' option in the summary.formula with method 'reverse'.



  ## two groups
  summary(Species ~ .,
    data = iris[iris[["Species"]] != "setosa", ],
    method = "reverse",
    test = TRUE,
    conTest = paired_test_continuous

  ## more than two groups
  summary(Species ~ .,
    data = iris,
    method = "reverse",
    test = TRUE,
    conTest = paired_test_continuous

  ## without Hmisc
  two_obs <- iris[["Sepal.Length"]][iris[["Species"]] != "setosa"]
  two_groups <- iris[["Species"]][iris[["Species"]] != "setosa"]
  paired_test_continuous(two_groups, two_obs)

  obs <- iris[["Sepal.Length"]]
  many_groups <- iris[["Species"]]
  paired_test_continuous(many_groups, obs)

[Package depigner version 0.8.4 Index]