0
votes

I am using randomForestSRC to estimate the variable importance of 34 potential predictors of survival. When all of potential predictor variables are numeric (or coded as numeric) the package runs without a problem. When I add in / appropriately code factor variables as factors, I get the following error:

Error in Math.factor(cens) : ‘floor’ not meaningful for factors.

I have tried using the package defaults to be sure that nothing I'm specifying is causing a problem. I've tried coding all of my variables as numeric - which is incorrect. That eliminates the problem. I do not know why rounding, floor, would be applied to factor variables. I have looked through the code running in the package and cannot identify where the problem is.

Read in data set in csv file exported from Stata

returners<-read.csv("2019April11_RSF.csv")

Grow random survival forest with 1000 trees, indicate time and outcome variables

rsfr.obj <- rfsrc(Surv(days_return_or_censor, returner_SC) ~ ., returners,
      ntree = 1000)

Print and plot the grow object

print(rsfr.obj)

I expect the error rates and variable importance estimates to print out. Instead I get the error:

Error in Math.factor(cens) : ‘floor’ not meaningful for factors

1
Have you tried contacting the package maintainer with a minimal reproducible example?IRTFM

1 Answers

0
votes

Your status indicator should be in numeric/dummy format (ie. 0=left-censored, 1=event) Hope that will help

MD