Skip to content

The Issue with Ordered Factors #1

@Zhenglei-BCS

Description

@Zhenglei-BCS

The xeredar package, by default, treats the concentration variable (Conc) as an ordered factor. This encoding implies polynomial (orthogonal) contrasts that assume equally spaced dose levels on a transformed scale. This creates interpretational challenges:

For example, when Conc is declared as ordered():

# Default xeredar behavior
Conc <- ordered(c(0, 0.023, 0.07, 0.21, 0.63))
contrasts(Conc)

R assigns orthogonal polynomial contrasts (linear, quadratic, cubic, etc.):

.L .Q .C ^4
0 -0.632 0.535 -0.316 0.117
0.023 -0.316 -0.267 0.632 -0.469
0.07 0.000 -0.535 0.000 0.703
0.21 0.316 -0.267 -0.632 -0.469
0.63 0.632 0.535 0.316 0.117

These contrasts:

  • Assume equal spacing between factor levels (which is false for concentrations 0 → 0.023 → 0.07 → 0.21 → 0.63)
  • Make the amalgamated means ($\tilde{Y}_i$) in Williams' test difficult to interpret biologically
  • Do not directly align with the step-down comparison logic described in OECD TG 248

Alternative

We can convert Conc to an unordered factor with treatment contrasts:

# Our approach
Conc <- factor(Conc, ordered = FALSE)
contrasts(Conc)

This yields simple treatment (dummy) contrasts:

0.023 0.07 0.21 0.63
0 0 0 0 0
0.023 1 0 0 0
0.07 0 1 0 0
0.21 0 0 1 0
0.63 0 0 0 1

Benefits of this approach:

  1. Each coefficient directly represents the difference from control ($\mu_i - \mu_0$)
  2. The Williams' test amalgamated means are computed on the natural concentration ordering
  3. Results are directly interpretable as "effect at concentration X vs. control"

Impact on Results

This modification does not change the statistical conclusions, but it helps the interpretation. Output tables show intuitive concentration labels (e.g., "0.63 vs 0") rather than polynomial contrast names.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions