Hi all,
I'm 99% sure this is a maxnet bug. A colleague and I noted it and didn't come up with a real solution. It occurs in maxnet when it computes mm %*% object$betas where object is the model and betas are the coefficients. The cause is that there are sometimes duplicate names in model$betas, and thus duplicate terms in the formula. And when the model matrix (mm) is computed using model.matrix() it seems to remove, or ignore, the duplicate term, so the dimensions of the model matrix, specifically the number of columns, is not equal to the length of object$betas, and the error occurs. I *think* there must be a a stochastic component to the optimization algorithm in maxnet because I use a catch (in R code, not Wallace) to note this issue and just try rerunning the model til it doesn't throw an error. And that seems to work. If you find that rerunning the model a few times reproduces the issue, I'd be interested to know.
Cory
Cory Merow
Ecology and Evolutionary Biology
University of Connecticut
skype: cory.merow
'Give me 4 parameters and I will draw you an elephant. Give me 5 and I will wag the trunk.'