fitzLab-AL / gdm

R package for Generalized Dissimilarity Modeling
GNU General Public License v3.0
33 stars 11 forks source link

Non-default spline number breaks gdm.varImp() #15

Closed sponslerdb closed 2 years ago

sponslerdb commented 3 years ago

This works fine: gdm.varImp_WN <- gdm.varImp(sitepair_WN, geo = FALSE)

This breaks in a puzzling way. gdm.varImp_WN <- gdm.varImp(sitepair_WN, geo = FALSE, splines = c(6, 6, 6, 6, 6))

Error in gdm(currSitePair, geo = geo, splines = splines, knots = knots) : 
  Number of splines does not equal the number of predictors. 
              Splines argument has 6 items but needs 5 items.

One might think that shortening the splines argument by one item would satisfy it: gdm.varImp_WN <- gdm.varImp(sitepair_WN, geo = FALSE, splines = c(6, 6, 6, 6))

. . . but it is fickle. Now it wants the 5th item back.

Error in gdm(currSitePair, geo = geo, splines = splines, knots = knots) : 
  Number of splines does not equal the number of predictors. 
              Splines argument has 4 items but needs 5 items.
sponslerdb commented 3 years ago

An update: when I use the option fullModelOnly = TRUE, the command runs fine. So the problem must lie somewhere in the matrix permutation.

fitzLab-AL commented 2 years ago

Latest version of package fixes this issue while providing a much faster implementation of gdm.varImp.