Hi All,

I'm running into a problem with GAM (in the MGCV package).  When I try 
to estimate the model, I get the following error message:

    1> fit <-
    gam(ndvi~s(rain)+s(temp)+s(rainl1)+s(rainl2)+s(rainxY)+s(rainl1xY)+s(rainl2xY)+s(tempxY),
    data=dsub, weights=wvec)
    Error in while (mean(ldxx/(ldxx + ldss)) > 0.4) { :
       missing value where TRUE/FALSE needed

Using traceback, I get the following output (which I don't understand)

1> traceback()
7: initial.sp(w * X, S, off)
6: initial.spg(G$X, G$y, G$w, G$family, G$S, G$off, G$L, G$lsp0)
5: estimate.gam(G, method, optimizer, control, in.out, scale, gamma,
        ...)
4: gam(ndvi ~ s(rain) + s(temp) + s(rainl1) + s(rainl2) + s(rainxY) +
        s(rainl1xY) + s(rainl2xY) + s(tempxY), data = dsub, weights = wvec)
3: eval.with.vis(expr, envir, enclos)
2: eval.with.vis(ei, envir)
1: source("/tmp/RTmpFile-UYYVRr.r", echo = TRUE, print.eval = TRUE,
        max.deparse.length = 5e+05, local = TRUE)

I've got a ton of data, and I'm doing this all via ssh into a relatively 
fast server.
1> dim(dsub)
[1] 181705     42

By way of context, I'm using climate data to predict NDVI, and using the 
residuals of that prediction for a separate estimation.

I'd appreciate if someone could help me understand what is going on and 
how to fix it.  It seems like something is wrong with the optimizer, but 
I'm still learning the mechanics of these techniques and don't fully 
understand what is going wrong.

Thanks for any help.

Cheers,
Andrew

	[[alternative HTML version deleted]]

