Skip to content

pi0est returns error if there is no p-value in the top lambda interval #17

Description

@jh-206

The function breaks on lines 29-30:

pi0 <- cumsum(tabulate(findInterval(p, vec = lambda))[ind])/(length(p) * 
      (1 - lambda[ind]))

tabulate returns a vector of length equal to the largest bin number of lambda that has a value. Therefore, if no value appears in the highest interval of lambda, which by default would be over .95, then tabulate returns a shorter vector than ind. NA's are then generated by extracting elements with [ind].

Example, modifying the code example from the qvalue function documentation:

data(hedenfalk)
p <- hedenfalk$p
qvalue(p[-which(p > .95)])

Error in smooth.spline(lambda, pi0, df = smooth.df) :
missing or infinite values in inputs are not allowed

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions