Coder Social home page Coder Social logo

cph fails with boolean input about rms HOT 2 CLOSED

harrelfe avatar harrelfe commented on August 17, 2024
cph fails with boolean input

from rms.

Comments (2)

harrelfe avatar harrelfe commented on August 17, 2024

On 12/15/2015 03:03 PM, Max Gordon wrote:

It seems that |model.matrix()| returns TRUE together with the variable
name. Not sure when this happend, can't find any note of it
https://cran.r-project.org/src/base/NEWS but the following code used
to run fine:

set.seed(10)
n <- 500
ds <- data.frame(
ftime = rexp(n),
fstatus = sample(0:1,size = n,replace = TRUE),
x = factor(sample(LETTERS[1:4],size = n,replace = TRUE)),
boolean = sample(c(TRUE,FALSE),size = n,replace = TRUE),
subsetting = factor(sample(c(TRUE,FALSE),size = n,replace = TRUE)))

library(rms)
dd <<- datadist(ds)
options(datadist="dd")

fit <- cph(Surv(ftime,fstatus == 1)~ x + boolean,data=ds)

Now it throws an |Error in X[, mmcolnames, drop = FALSE] : subscript
out of bounds| as the mmcolnames has the name for the boolean variable
while the |X <- model.matrix(sformula, X)| returns the boolean column
with the name |booleanTRUE|.

Btw - congratulations on the second edition. Great to see that it has
finally arrived.

Thanks Max.

I hadn't tested recent changes with a logical variable. Will fix this
and will make a new release of rms soon as I've made other changes too.

Frank


Reply to this email directly or view it on GitHub
#15.


Frank E Harrell Jr Professor and Chairman School of Medicine

Department of *Biostatistics*   *Vanderbilt University*

from rms.

harrelfe avatar harrelfe commented on August 17, 2024

This has now been fixed and I just submitted a new version (with the fix) to CRAN.

from rms.

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.