Thanks! I hadn't touched environment variables before, not knowing what they were. The G$X matrix indeed seems to get squared, giving appropriately nonsensical results. I can now go and code a (hopefully) sensible change to it. On 08/14/2013 10:32 PM, David Winsemius wrote: > environment(mod.gam) <- environment(gam)