BlasBenito/spatialRF

Partial dependence plots not working properly

Opened this issue · 0 comments

Firstly thank you for your excellent package, Whenever I attempt to get the response curves i get hit with an error:
Error in UseMethod("predict") :
no applicable method for 'predict' applied to an object of class "ranger"

my code:

model.non.spatial <- spatialRF::rf(
  data = LAD1,
  dependent.variable.name = dependent.variable.name,
  predictor.variable.names = predictor.variable.names,
  distance.matrix = distance_matrix1,
  distance.thresholds = distance.thresholds,
  xy = xy, #not needed by rf, but other functions read it from the model
  seed = random.seed,
  verbose = FALSE,
  n.cores = parallel::detectCores() - 1 #is passed via pipe to the other functions,
  
)
spatialRF::plot_response_curves(
  model.non.spatial,
  quantiles = c(0.1, 0.5, 0.9),
  line.color = viridis::viridis(
    3, #same number of colors as quantiles
    option = "F", 
    end = 0.9
  ),
  ncol = 3,
  show.data = TRUE
)

Any help would be greatly appreciated!