rms icon indicating copy to clipboard operation
rms copied to clipboard

"nomogram" function dosn't work

Open jijitoutou opened this issue 8 months ago • 1 comments

I use the example provided by this pacakge: `n <- 1000 # define sample size set.seed(17) # so can reproduce the results d <- data.frame(age = rnorm(n, 50, 10), blood.pressure = rnorm(n, 120, 15), cholesterol = rnorm(n, 200, 25), sex = factor(sample(c('female','male'), n,TRUE)))

Specify population model for log odds that Y=1

Simulate binary y to have Prob(y=1) = 1/[1+exp(-L)]

d <- upData(d, L = .4*(sex=='male') + .045*(age-50) + (log(cholesterol - 10)-5.2)(-2(sex=='female') + 2*(sex=='male')), y = ifelse(runif(n) < plogis(L), 1, 0))

ddist <- datadist(d); options(datadist='ddist')

f <- lrm(y ~ lsp(age,50) + sex * rcs(cholesterol, 4) + blood.pressure, data=d) nom <- nomogram(f, fun=function(x)1/(1+exp(-x)), # or fun=plogis fun.at=c(.001,.01,.05,seq(.1,.9,by=.1),.95,.99,.999), funlabel="Risk of Death")`

Error: Here is the translation:

Error in reformulate(attr(termobj, "term.labels")[-dropx], response = if (keep.response) termobj[[2L]], : 'termlabels' must be a byte vector of length at least one.

Could you update this package to solve this issue? Thank you!

jijitoutou avatar Jun 13 '24 08:06 jijitoutou