Displaying 1 result from an estimated 1 matches for "makepred".
2013 Mar 21
1
[mgcv][gam] Odd error: Error in PredictMat(object$smooth[[k]], data) : , `by' variable must be same dimension as smooth arguments
...an't figure out where it comes
from. The setup is the following: I've got a fitted GAM object called
"MI", and a vector of "prediction data" (with default values for
predictors). I feed this into predict.gam(object, newdata = whatever)
via the following function:
makepred = function(varstochange,val){
for (i in 1:length(varstochange)){
if (varstochange[i] == "pot.trial"){j=1}
if (varstochange[i] == "year"){j=2}
if (varstochange[i] == "crop.legume"){j=3}
if (varstochange[i] == "crop.fruit&quo...