[R] gam and ordination (vegan and labdsv surf and ordisurf)
ssefick at gmail.com
Thu Nov 20 15:45:04 CET 2008
#for instance this
This is mod1? I am new to gam models, and will buy Simon's book when
I have the funds.
thanks for being patient
(I will send you data off list if you wish with reproduvible code, but
I believe that it is too large for posting to the list.)
On Thu, Nov 20, 2008 at 8:52 AM, Gavin Simpson <gavin.simpson at ucl.ac.uk> wrote:
> [Have CC'd Jari here as lead author and maintainer of vegan]
> Hi Stephen,
> On Thu, 2008-11-20 at 07:41 -0500, stephen sefick wrote:
>> I have a general question about using thin plate splines in the surf
>> and ordisurf routines. My rudimentary knowledge of a gam is that with
>> each predictive variable there is a different smooth for each one and
>> then they are added together with no real interaction term (because
>> they don't handle this well?).
> If this is really about ordisurf then what you write is not really
> accurate. The model ordisurf fits is not additive, given the defaults.
> By default ordisurf fits a smooth of Ax1 and Ax2 together, not separate
> smooths of Ax1 and Ax2 which then sum up to predict the response (plus
> the intercept of course, if one is included in the model).
> In mgcv::gam the default model fitted by ordisurf is of the form
> mod1 <- gam(y ~ s(Ax1, Ax2), data = X, ...)
> whilst you seem to be describing the following additive model
> mod2 <- gam(y ~ s(Ax1) + s(Ax2), data = X, ...)
> Simon Wood's GAM book goes on to explain that given the thinplate
> regression spline bases used in this example, mod2 is not actually
> nested in mod1. To compare nested models then we need to replace mod1 by
> mod3 <- gam(y ~ s(Ax1) + s(Ax2) + s(Ax1, Ax2), data = X, ...)
> In the case or ordisurf, to my mind mod1 is the correct model to fit as
> one is often interested in the configuration (i.e. the two axes
> together) and not the individual axes per se.
> The smooths in mod1 are isotropic and useful when Var1 and Var2 (in
> s(Var1, Var2) ) are on the same scale and we expect the same degree of
> smoothness to apply to both covariates. mgcv provides tensor product
> terms via te() (instead of s() ) for situations where isotropy is not
> appropriate, but these are not available in ordisurf.
> You can get mod2 in ordisurf by specifying 'thinplate = FALSE'. Looking
> at ordisurf now, I'm not sure thinplate is the correct name for this -
> whether thinplate is FALSE or TRUE, thinplate regression splines are
> used in the model fit, all thinplate controls is whether a model of the
> form mod1 or mod2 is computed.
>> Now, If I have two variables that
>> have a high D^2 score and a low GCV score (I am thinking of this as a
>> goodness of fit which may be wrong) I would like to add these together
>> to produce one surface fitted to the ordination. Is this possible?
>> Am I going down the right track? Any help is greatly appreciated.
> It isn't clear what you want to do (to me at least). ordisurf certainly
> doesn't do this as you provide the response (argument 'y') and an
> ordination (plus which axes to use) and fits a model like mod1. So you
> provide only the *univariate* response.
> So what do you mean by "two variables"? Have you used ordisurf on your
> var1 and your var2 separately and now want to combine them? If so, that
> doesn't make sense (with ordisurf at least) as your "two variables" are
> responses. The only predictor variables ordisurf knows about are
> ordination axes.
> If you want to fit a multivariate response with smooth functions of the
> predictors, take a look at Thomas Yee's VGAM package - coincidentally
> there is a nice article by Thomas in the current R News on VGAM.
> If this is not what you meant, perhaps an example might help elucidate
> things? At least up to the part you want help with.
> 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
Southeastern Natural Sciences Academy
Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is puff us up and
make us feel like gods. We are mammals, and have not exhausted the
annoying little problems of being mammals.
More information about the R-help