Skip to content

maxnet() sometimes fails with hinge features #26

Description

@AMBarbosa

With default parameters, maxnet() fails for some data frames:

dat <- read.csv("https://raw.githubusercontent.com/AMBarbosa/files/refs/heads/main/d.csv")
maxnet(p = dat[ , 1], data = dat[ , -1])
# Error in m[p == 1, ] : (subscript) logical subscript too long

I found that the error occurs within regfun(p, mm), at mm <- m[p == 1, ], because mm (the model matrix) has zero rows. The error does not occur if we do not use hinge features:

maxnet(p = dat[ , 1], data = dat[ , -1],
       f = maxnet.formula(p = dat[ , 1],
                          data = dat[ , -1], 
                          classes = "lqpt"))
# apparently OK

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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