[R] Strange error returned or bug in gam in mgcv????

Gavin Simpson gavin.simpson at ucl.ac.uk
Tue Sep 1 19:43:24 CEST 2009


On Tue, 2009-09-01 at 17:55 +0100, Corrado wrote:
> Dear Simon,
> 
> I have stored all information at the link:
> 
> http://scsys.co.uk:8002/33309?hl=on&submit=Format+it!

You could have included that in your mail to the list - it is just plain
text after all.

> 
> I have the same problem if I do 
> s(PC1)  + ..... + s(PC10) or 
> s(Pc1,PC2,PC3,PC4,PC5)+s(PC6,PC7,PC8,PC9,PC10) or
> s(PC1,PC2,PC3,PC6,PC7,PC8) .....
> 
> I have renamed PC1.1,PC2.1,PC3.1,PC4.1,PC5.1 to PC6,PC7,PC8,PC9,PC10 for 
> simplicity.

What does

str(dist_scot24_vector_with_climate)

show? I seem to recall getting similar errors when I'd done something
silly in a data prep routine and had data in a data frame that wasn't
numeric but looked like it was - a factor for example.

If you can't do some quite simple things like the first of your three
alternatives above, that suggests something amiss with the data. That'd
be the first thing to check.

HTH

G

> 
> Regards
> 
> On Tuesday 01 September 2009 17:31:04 Simon Wood wrote:
> > The basic problem is that you have requested a 10 dimensional thin plate
> > spline, with a basis dimension of 196830. In reality it will not be
> > possible to compute this, even if you have more than 196830 data. In any
> > case it would be unlikely to provide a very useful model --- the "simplest"
> > function that it can theoretically represent will have 3003 degrees of
> > freedom.
> >
> > That said the error message is obviously rather unhelpful... Can you tell
> > me how many data you are actually trying to fit, and I'll try and track
> > down exactly where it's failing, and put in a more informative message.
> >
> > best,
> > Simon
> >
> > On Tuesday 01 September 2009 14:51, Corrado wrote:
> > > Dear friends,
> > >
> > > what is this error message in gam???? I cannot understand what it means
> > > .... is it a bug?
> > >
> > > gam_bray_scot24_pc_0505<gam(bray~s(PC1,PC2,PC3,PC4,PC5,
> > > PC1.1,PC2.1,PC3.1,PC4.1,PC5.1),data=dist_scot24_vector_with_climate)
> > >
> > > Error in if (length(data) != vl) { :
> > >   missing value where TRUE/FALSE needed
> > > Calls: gam ... smooth.construct -> smooth.construct.tp.smooth.spec ->
> > > array In addition: Warning message:
> > > In array(0, n * k) : NAs introduced by coercion
> > > Execution halted
> > >
> > > Thanks in advance,
> > >
> > > Best regards
> 
> 
> 
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson             [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,          [f] +44 (0)20 7679 0565
 Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT.                 [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%




More information about the R-help mailing list