Coder Social home page Coder Social logo

Comments (4)

hofnerb avatar hofnerb commented on August 18, 2024

First of all sorry that I didn't reply earlier. I didn't receive any notification.

Unfortunatley, I cannot check your example as there is no (reproducible) code. Could you please provide a minimal working example which displays the behavior? Thx.

from paper.

likelet avatar likelet commented on August 18, 2024
       # Load data set ovarian
        data(ovarian, package = "survival")

        ## fit a Cox model
        mod5 <- coxph(Surv(futime, fustat) ~ age, data=ovarian)
        summary(mod5)
        ## Make pretty summary
        prettify(summary(mod5),digit=3)
          coef    Hazard Ratio CI (lower) CI (upper) se(coef)    z Pr(>|z|)    
1 age 0.162         1.18         1.07        **1.3**   0.0497 3.25    0.001  **

you can find CI(upper) has less digits

from paper.

hofnerb avatar hofnerb commented on August 18, 2024

There is some strange behavior of format, which is (at least part of) the underlying problem.

Using

format(exp(confint(mod5)), digits = 3)

returns the correct results:

##     2.5 %  97.5 %
## age "1.07" "1.30"

Yet, if one runs

debugonce("prettifyPValue")
prettify(summary(mod5), digits=3)
format(object, digits = 3)

one gets

       coef Hazard Ratio CI (lower) CI (upper) se(coef)    z Pr(>|z|)
1 age 0.162         1.18       1.07        1.3   0.0497 3.25  0.00116

i.e. the 0 is again removed in CI (upper).

The reason is that format.data.frame applies format by columns. I need to check how to fix this.

from paper.

hofnerb avatar hofnerb commented on August 18, 2024

So in short, the real issue is that trailing zeros are droped despite not requested to do this:

format(1.299, digits = 3, drop0trailing = FALSE)

The option is simply ignored.

from paper.

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.