0

I am trying to get the concordance for my testing dataset using the following code:

    library(survival)
    s=1116
    set.seed(s)
    train = sample.int(N, trainsize, replace = F)
    traindata = mor_survey_com3[train, ]
    test = mor_survey_com3[-train, ]
    fit_test_w = coxph(as.formula(Surv(permth_exm, other_Death) ~ BMI_c + BMI_c_2 + 
                                 as.factor(smoke) + lspline(Hgb,14)),data=traindata) 
    concordance(object = fit_test_w, newdata = test)

However, I got the following error:

Error in (function (y, x, strata, weights, ymin = NULL, ymax = NULL, timewt = c("n", : x and y are not the same length

Does anyone know what is going on here?

xilliam
  • 2,074
  • 2
  • 15
  • 27
  • Hi, Welcome to SO!. You'll usually get better help on SO if you provide sample data that makes your question reproducible. Here are some [guidelines](https://stackoverflow.com/help/how-to-ask) – xilliam Oct 16 '21 at 13:51
  • And here's R-specific advice: https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example?r=SearchResults&s=1|1432.9785, but the lack of any substantive response to the earlier identification of lack of [MCVE] means we now need to start considering closing the question for lack of sufficient infor to assist in the debugging process. – IRTFM Oct 17 '21 at 21:55

0 Answers0