Skip to content

Error with clm objects #38

@ryanvosbigian

Description

@ryanvosbigian

There is an error when using resids (and other functions) with clm objects.

Error in X[, -1L, drop = FALSE] %*% object$beta :
non-conformable arguments

The error originates from the getMeanResponse.clm function.

I think I fixed it with:

getMeanResponse.clm <- function(object) {
  # Have to do this the long way, for now! :(
  mf <- model.frame(object)
  if (!is.null(cl <- attr(object$terms, "dataClasses"))) {
    .checkMFClasses(cl, mf)
  }
  X <- model.matrix(object$terms, data = mf, contrasts = object$contrasts)
  if(sum(object$aliased$beta) > 0) {
    X <- X[, !c(object$aliased$beta), drop = FALSE]
    # X <- X[, !c(FALSE, object$aliased$beta), drop = FALSE] # ERROR WAS HERE
  }

  
  drop(X[, -1L, drop = FALSE] %*% object$beta[!object$aliased$beta] - object$alpha[1L])
  ### drop(X[, -1L, drop = FALSE] %*% object$beta - object$alpha[1L]) # ERROR ALSO HERE
  
}

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