matchatr
  1. Reference
  2. print.matchatr_homogeneity
  • Home
  • Getting started
    • Introduction
  • Classical odds ratios
    • Unmatched case-control odds ratios
    • Matched case-control odds ratios
    • Multiple case / control groups
  • Risk-set designs
    • Nested case-control
  • Reference
    • case_cohort
    • contrast
    • counter_matched
    • matcha
    • matched_cc
    • nested_cc
    • print.matchatr_design
    • print.matchatr_fit
    • print.matchatr_homogeneity
    • print.matchatr_result
    • sample_ncc
    • summary.matchatr_fit
    • test_homogeneity
    • tidy.matchatr_fit
    • tidy.matchatr_homogeneity
    • tidy.matchatr_result
    • two_phase
    • unmatched_cc
  • News
  • License
  • Citation

On this page

  • Print a matchatr homogeneity test
    • Description
    • Usage
    • Arguments
    • Value
    • See Also
    • Examples

Code Links

  1. Reference
  2. print.matchatr_homogeneity

Print a matchatr homogeneity test

Description

Displays a compact summary of a matchatr_homogeneity object: the estimator and engine, the baseline reference group, the analysis size, and the table of per-exposure common (pooled) odds ratios with their homogeneity Wald chi-squared statistic, degrees of freedom, and p-value.

Usage

## S3 method for class 'matchatr_homogeneity'
print(x, ...)

Arguments

x A matchatr_homogeneity object returned by test_homogeneity().
… Unused; present for S3 consistency.

Value

Invisibly returns x.

See Also

test_homogeneity()

Examples

library("matchatr")

set.seed(5)
n <- 2000
x <- rbinom(n, 1, 0.4)
eta <- cbind(control = 0, A = -1 + log(2) * x, B = -1.4 + log(2) * x)
prob <- exp(eta) / rowSums(exp(eta))
g <- apply(prob, 1, function(p) sample(c("control", "A", "B"), 1, prob = p))
d <- data.frame(g = g, x = x)
fit <- matcha(d, outcome = "g", exposure = "x",
              design = unmatched_cc(), estimator = "polytomous",
              reference = "control")
print(test_homogeneity(fit))
<matchatr_homogeneity>
 Estimator:  polytomous  (engine: multinom)
 Test:       Homogeneity of subtype odds ratios (Wald)
 Reference:  control
 N:          2000

Common (pooled) odds ratio per exposure term and homogeneity test:
     term common_or        se ci_lower ci_upper statistic    df   p.value
   <char>     <num>     <num>    <num>    <num>     <num> <int>     <num>
1:      x  2.168761 0.2006846 1.809033 2.600022 0.6589249     1 0.4169398

Per-subtype odds ratios (pooled):
   comparison       or ci_lower ci_upper
       <char>    <num>    <num>    <num>
1:       A: x 2.267207 1.836532 2.798877
2:       B: x 2.035590 1.605604 2.580728

A small p-value is evidence the exposure odds ratio differs across subtypes.