nspope / radish

Fast gradient-based optimization of resistance surfaces
BSD 3-Clause "New" or "Revised" License
12 stars 1 forks source link

Radish() error length(s$demes) == nrow(S) is not TRUE #8

Open j3ss42 opened 9 months ago

j3ss42 commented 9 months ago

Hi, I am trying to optimise a categorical resistance surface, which contains landcover data with pre-assigned resistance values from the literature. I would like to optimise this to identify which landcovers are important for gene flow in my study area.

I ratify the categorical variables following the tutorial, and make a conductance surface using the below code: surface_gsp <- conductance_surface(covariates = stack(Region_rat), coords = Coords, directions = 4)

I then make a Euclidean genetic distance matrix using dist() in adegenet between all samples.

I then try to fit mlpe using the below code: fit_mlpe_cat <- radish(Genetic_dist ~ Region_Mosaic, data = surface_gsp, conductance_model = radish::loglinear_conductance, measurement_model = radish::mlpe)

However I get the error code below almost immediately: Projected Newton-Raphson with Hager-Zhang line search Error in radish_algorithm(f = conductance_model, g = measurement_model, : length(s$demes) == nrow(S) is not TRUE

What is s$demes and nrow(S) referring to? I would greatly appreciate any guidance on how to get this to work.

Many thanks