1

Good day I faced this problem when I tried to plot a nomogram using rms package in R. I transferred my data from SPSS in order to plot the nomogram and at the end, it gave me this message.

Error in nomogram(fit.reg22) : duplicated variable labels: 0 1 0 1

How can I solve this? Please help TT. Thank you

dd <- datadist(thickness_forR_1)
options(datadist = "dd")
boxcox((ALT.ave + 1) ~ age50+ BMI23+ genderRE, data= thickness_forR_1)
thickness_forR_1 <- thickness_forR_1 %>%
   mutate(ALT2 = log(ALT.ave + 1))
fit.reg22<-ols(ALT2 ~ age50 + BMI23 + genderRE, data=thickness_forR_1, x = TRUE, y = TRUE)
summary(fit.reg22)
             Effects              Response : ALT2 

 Factor   Low High Diff. Effect   S.E.     Lower 0.95 Upper 0.95
 age50    0   1    1     -0.35188 0.064244 -0.47855   -0.22522  
 BMI23    0   1    1      0.31013 0.048472  0.21456    0.40570  
 genderRE 0   1    1      0.55111 0.054465  0.44373    0.65850  

plot(nomogram(fit.reg22))

Error in nomogram(fit.reg22) : duplicated variable labels: 0 1 0 1

r_data_frame(
  n =216,
  thickness_forR_1)
  A tibble: 216 x 5
       age50     BMI23  genderRE ALT.ave  ALT2
   <dbl+lbl> <dbl+lbl> <dbl+lbl>   <dbl> <dbl>
 1  0 [<50]   1 [>=23]     0 [M]   10.3   2.43
 2  1 [>=50]  0 [<23]      0 [M]    4.00  1.61
 3  1 [>=50]  0 [<23]      1 [F]    5.92  1.93
 4  1 [>=50]  0 [<23]      0 [M]    3.85  1.58
 5  1 [>=50]  0 [<23]      0 [M]    4.66  1.73
 6  0 [<50]   1 [>=23]     0 [M]    6.21  1.98
 7  1 [>=50]  1 [>=23]     0 [M]    8.06  2.20
 8  1 [>=50]  1 [>=23]     1 [F]    6.3   1.99
 9  1 [>=50]  1 [>=23]     0 [M]    8.59  2.26
10  0 [<50]   0 [<23]      1 [F]   14.9   2.76
# ... with 206 more rows
  • 1
    Provide the `thickness_forR_1` data. Please visit [How to make a great R reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). – UseR10085 Nov 17 '21 at 06:02
  • i edited my question and added the thickness_forR_1 data above – Ramla Juma'a Nov 18 '21 at 05:12
  • While this is quite a bit down the road, I think when you were asked for the data, but @Bappa Das meant (and what it likely says in the link) is that you need to provide a reproducible question by providing the data. Generally, the best way to do that is something like `dput(head(dataObject, 20))` (providing the first 20 rows in a reproducible output. If you are still interested in getting an answer, let me know. – Kat Apr 05 '22 at 16:15

0 Answers0