harrelfe / rms

Regression Modeling Strategies
https://hbiostat.org/R/rms
Other
172 stars 48 forks source link

Error in X[, mmcolnames, drop = FALSE] : subscript out of bounds #71

Open xueyuancao opened 5 years ago

xueyuancao commented 5 years ago

Dear Professor Harrel:

It seems that an old issue of subscript out bounds errors occur again. Please see bold portion below. I include the sessionInfo() output to indicate the computing environment.

Thanks,

Xueyuan cao

sessionInfo() R version 3.5.3 (2019-03-11) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale: [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] dunn.test_1.3.5 AICcmodavg_2.2-1 rms_5.1-3 SparseM_1.77 Hmisc_4.2-0
[6] ggplot2_3.1.0 Formula_1.2-3 survival_2.43-3 lattice_0.20-38 dplyr_0.8.0.1
[11] tidyr_0.8.3

loaded via a namespace (and not attached): [1] Rcpp_1.0.1 mvtnorm_1.0-10 zoo_1.8-5 assertthat_0.2.1
[5] digest_0.6.18 unmarked_0.12-3 R6_2.4.0 plyr_1.8.4
[9] backports_1.1.3 acepack_1.4.1 MatrixModels_0.4-1 stats4_3.5.3
[13] pillar_1.3.1 rlang_0.3.2 lazyeval_0.2.2 multcomp_1.4-10
[17] rstudioapi_0.10 data.table_1.12.0 raster_2.8-19 rpart_4.1-13
[21] Matrix_1.2-15 checkmate_1.9.1 splines_3.5.3 stringr_1.4.0
[25] foreign_0.8-71 htmlwidgets_1.3 munsell_0.5.0 compiler_3.5.3
[29] xfun_0.5 pkgconfig_2.0.2 base64enc_0.1-3 htmltools_0.3.6
[33] nnet_7.3-12 tidyselect_0.2.5 tibble_2.1.1 gridExtra_2.3
[37] htmlTable_1.13.1 codetools_0.2-16 crayon_1.3.4 withr_2.1.2
[41] MASS_7.3-51.1 grid_3.5.3 xtable_1.8-3 nlme_3.1-137
[45] polspline_1.1.14 gtable_0.3.0 magrittr_1.5 scales_1.0.0
[49] stringi_1.4.3 reshape2_1.4.3 sp_1.3-1 latticeExtra_0.6-28 [53] sandwich_2.5-0 TH.data_1.0-10 RColorBrewer_1.1-2 tools_3.5.3
[57] glue_1.3.1 purrr_0.3.2 parallel_3.5.3 colorspace_1.4-1
[61] cluster_2.0.7-1 VGAM_1.1-1 knitr_1.22 quantreg_5.38

library(rms) tt<-rbinom(100, 1, 0.5) tt2<-c(rep('T1', 50), rep('T2', 50)) > lrm(tt ~ tt2) Error in X[, mmcolnames, drop = FALSE] : subscript out of bounds glm(tt ~ tt2, family = binomial(link='logit'))

Call: glm(formula = tt ~ tt2, family = binomial(link = "logit"))

Coefficients: (Intercept) tt2T1
0.2412 0.1643

Degrees of Freedom: 99 Total (i.e. Null); 98 Residual Null Deviance: 136.1 Residual Deviance: 135.9 AIC: 139.9