Code Monkey home page Code Monkey logo

Comments (5)

jdoiii avatar jdoiii commented on August 11, 2024 1

Re: "ValueError: 'xerr' must not contain negative values."

I just experienced this when my ll and hl were reversed. So you might check that.

from forestplot.

jdoiii avatar jdoiii commented on August 11, 2024 1

In Feature A, D, E, "Hazard Ratio" and "2.5%" look to be identical, and in Feature F and G, "Hazard Ratio" and "97.5%" are identical. What happens if you remove those and rerun the data?

If that fixes the problem, then you may need to fudge the 2.5% values or 97.5% values to make the lower limits slightly lower than the Hazard Ratios or the higher limits slightly higher.

from forestplot.

LSYS avatar LSYS commented on August 11, 2024

@Aleksandra130501 do you have minimal code and data example i can use to reproduce your error?

from forestplot.

liberaliscomputing avatar liberaliscomputing commented on August 11, 2024

Okay, it looks like this error was reported a while ago but hasn't been addressed yet. I am encountering the same issue, and here is my data to reproduce the error:

Feature 2.5% 97.5% Hazard Ratio P-Value
A -0.04648966464888837 0.0 -0.04648966464888837 0.3350452166432467
B -0.8005247375433439 0.5701691566719239 -0.38434257677120126 0.006641928833643199
C -0.33113731133310487 0.44139267172092117 -0.31872569342925067 2.190067566321477e-11
D -1.1880290522910695 0.0 -1.1880290522910695 0.1400575074820416
E -2.8947220058702707 0.0 -2.8947220058702707 9.727875422296087e-26
F 0.0 0.42644904860853605 0.42644904860853605 7.67960958911707e-12
G 0.0 0.5733555387058998 0.5733555387058998 0.05833119779119948
H -0.10147319767844853 0.4652267607167055 -0.1902549025737849 0.004463957869426125
I -0.2798907958523989 0.5057675784701245 -0.30153798443035834 0.005622582125245007
J -0.17460690918051475 0.04782450978582678 -0.04795539250903285 0.807628734304761
K -0.1476066210644793 0.02061662829224276 -0.04448952374821284 0.0095816270092731
L -0.0816839667613319 0.08091723921613089 0.03629314588938769 0.41419942550589406
M -0.0008517369643846185 0.0010696352038619054 -0.00048626534176460614 0.8575576462554562
N -0.06718350141640646 0.05908972206597604 -0.03010969140184373 0.24036296811563654
O -0.03992798162342058 0.06166542353256832 0.027742311864226682 0.3465652654453217
P -0.014570568896721085 0.011389074369654193 -0.007022462662996824 0.6138101825035815

Here is my code:

import forestplot as fp

# "forest" below is the above data frame.

fp.forestplot(
    forest,
    estimate="Hazard Ratio",
    ll="2.5%",
    hl="97.5%",
    varlabel="Feature",
    sort=True,
    pval="P-Value",
    annote=["est_ci"],
    annoteheaders=["Hazard Ratio (95% Conf. Int.)"],
    rightannote=["formatted_pval"],
    right_annoteheaders=["P-Value"],
    xlabel="Hazard Ratio",
    table=True,
)

Here is the error message:

ValueError: 'xerr' must not contain negative values

from forestplot.

LSYS avatar LSYS commented on August 11, 2024

@jdoiii good catch. @liberaliscomputing Please try that. I had a similar issue when the estimate was (erroneously) higher/lower than the upper/lower confidence limits.

from forestplot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.