After plot with nomogram in R, the results are crowded together and the lines don't strehch

Viewed 57

I've finished the plot with the code below.

install.packages("rms")
library(survival)

library(rms)                 
riskFile="train.txt"      
risk2=read.table(riskFile, header=T, sep="\t", check.names=F, row.names=1)
dd <- datadist(risk2)
options(datadist="dd")
f2 <- lrm(VTE ~ age+duration+ALB+DD+R012, data=risk2, x=T,y=T)
nom <- nomogram(f2, fun=plogis, lp=F, funlabel = "Risk")  
plot(nom)
dput(nom)

and the result is ugly and strange as the pic shows. my pic

How could I draw a longer and better line?

Relly appreciates your help!

here print dput

structure(list(age = structure(list(age = c(25L, 30L, 35L, 40L, 
45L, 50L, 55L, 60L, 65L, 70L, 75L, 80L), Xbeta = c(`1` = 4.14584218573903, 
`2` = 4.97501062288683, `3` = 5.80417906003464, `4` = 6.63334749718244, 
`5` = 7.46251593433025, `6` = 8.29168437147805, `7` = 9.12085280862586, 
`8` = 9.95002124577366, `9` = 10.7791896829215, `10` = 11.6083581200693, 
`11` = 12.4375265572171, `12` = 13.2666949943649), points = c(`1` = 0, 
`2` = 9.09090909090909, `3` = 18.1818181818182, `4` = 27.2727272727273, 
`5` = 36.3636363636364, `6` = 45.4545454545455, `7` = 54.5454545454545, 
`8` = 63.6363636363636, `9` = 72.7272727272727, `10` = 81.8181818181818, 
`11` = 90.9090909090909, `12` = 100)), info = list(nfun = 1, 
    predictor = "age", effect.name = "age", type = "main")), 
    duration = structure(list(duration = 8:18, Xbeta = c(`13` = 4.86268437212434, 
    `14` = 5.47051991863988, `15` = 6.07835546515542, `16` = 6.68619101167096, 
    `17` = 7.2940265581865, `18` = 7.90186210470205, `19` = 8.50969765121759, 
    `20` = 9.11753319773313, `21` = 9.72536874424867, `22` = 10.3332042907642, 
    `23` = 10.9410398372798), points = c(`13` = 0, `14` = 6.66424027740798, 
    `15` = 13.328480554816, `16` = 19.992720832224, `17` = 26.6569611096319, 
    `18` = 33.3212013870399, `19` = 39.9854416644479, `20` = 46.6496819418559, 
    `21` = 53.3139222192639, `22` = 59.9781624966719, `23` = 66.6424027740799
    )), info = list(nfun = 1, predictor = "duration", effect.name = "duration", 
        type = "main")), ALB = structure(list(ALB = c(20L, 25L, 
    30L, 35L, 40L, 45L, 50L, 55L, 60L, 65L), Xbeta = c(`24` = -3.35961351152051, 
    `25` = -4.19951688940064, `26` = -5.03942026728077, `27` = -5.8793236451609, 
    `28` = -6.71922702304102, `29` = -7.55913040092115, `30` = -8.39903377880128, 
    `31` = -9.23893715668141, `32` = -10.0788405345615, `33` = -10.9187439124417
    ), points = c(`24` = 82.8774519173499, `25` = 73.6688461487554, 
    `26` = 64.460240380161, `27` = 55.2516346115666, `28` = 46.0430288429721, 
    `29` = 36.8344230743777, `30` = 27.6258173057833, `31` = 18.4172115371889, 
    `32` = 9.20860576859442, `33` = 0)), info = list(nfun = 1, 
        predictor = "ALB", effect.name = "ALB", type = "main")), 
    DD = structure(list(DD = c(0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 
    4), Xbeta = c(`34` = 0, `35` = 0.671520724233163, `36` = 1.34304144846633, 
    `37` = 2.01456217269949, `38` = 2.68608289693265, `39` = 3.35760362116581, 
    `40` = 4.02912434539898, `41` = 4.70064506963214, `42` = 5.3721657938653
    ), points = c(`34` = 0, `35` = 7.36247737270889, `36` = 14.7249547454178, 
    `37` = 22.0874321181267, `38` = 29.4499094908356, `39` = 36.8123868635445, 
    `40` = 44.1748642362534, `41` = 51.5373416089623, `42` = 58.8998189816712
    )), info = list(nfun = 1, predictor = "DD", effect.name = "DD", 
        type = "main")), R012 = structure(list(R012 = 0:1, Xbeta = c(`43` = 0, 
    `44` = 2.20394845438508), points = c(`43` = 0, `44` = 24.163841919483
    )), info = list(nfun = 1, predictor = "R012", effect.name = "R012", 
        type = "main")), total.points = list(x = c(0, 20, 40, 
    60, 80, 100, 120, 140, 160, 180, 200, 220, 240, 260, 280)), 
    Risk = list(x = c(153.468086161901, 162.359045411956, 168.268585249665, 
    173.112718166126, 177.558280786434, 182.003843406743, 186.847976323204, 
    192.757516160913, 201.648475410968), x.real = c(0.1, 0.2, 
    0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9), fat = c("0.1", "0.2", 
    "0.3", "0.4", "0.5", "0.6", "0.7", "0.8", "0.9"), which = c(FALSE, 
    TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE
    ))), info = list(fun = list(function (q, location = 0, scale = 1, 
    lower.tail = TRUE, log.p = FALSE) 
.Call(C_plogis, q, location, scale, lower.tail, log.p)), lp = FALSE, 
    lp.at = c(-10, -8, -6, -4, -2, 0, 2, 4, 6, 8), discrete = c(age = FALSE, 
    duration = FALSE, ALB = FALSE, DD = FALSE, R012 = TRUE), 
    funlabel = "Risk", fun.at = NULL, fun.lp.at = NULL, Abbrev = list(), 
    minlength = 4, conf.int = FALSE, R = structure(c(4.14584218573903, 
    13.2666949943649, 4.86268437212434, 10.9410398372798, -10.9187439124417, 
    -3.35961351152051, 0, 5.3721657938653, 0, 2.20394845438508
    ), dim = c(2L, 5L), dimnames = list(NULL, c("age", "duration", 
    "ALB", "DD", "R012"))), sc = 10.9638870507182, maxscale = 100, 
    Intercept = c(Intercept = -16.1948294400573), nint = 10, 
    space.used = c(main = 5, ia = 0)), class = "nomogram")

Have a nice day!

0 Answers
Related