Skip to content

Error in testInteractions when factor level combination is dropped #8

@MissTinger

Description

@MissTinger

When the fixed-effect model matrix is rank deficient, a column / coefficient / factor level combination will be dropped.
In this case this code:

phia::testInteractions(model)

will give the error:

Error in dimnames(x) <- dn : 
  length of 'dimnames' [2] not equal to array extent

from this section of the code:

colnames(L) <- rownames(as.matrix(getCoef(model)))

This is because the left hand matrix L contains all possible combination of levels as columns whereas getCoef(model) returns a matrix which rows are only the coefficients that were used in the model (not dropped), thus

ncol(L) > nrow(as.matrix(getCoef(model)))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions