[R-sig-eco] Using multiple species data for gam

Rajendra Mohan panda rmp.iit.kgp at gmail.com
Mon Feb 16 07:58:28 CET 2015


Dear Dr Greg Guerin

Lot many thanks for the advise. I have tried the code (not with 1000sp)
successfully but I find some warning messages which I need some help
regarding the same. Mentioned here for your kind advise:

 glmer(Response ~ Temp + Pptn + Moisture+Soil+Slope+Aspect+Altitude+(1 +
Temp + Pptn+
Moisture+Soil+Slope+Aspect+Altitude|Species),family=binomial(link="logit"),
data = SP)
Generalized linear mixed model fit by maximum likelihood (Laplace
Approximation) ['glmerMod']
 Family: binomial  ( logit )
Formula: Response ~ Temp + Pptn + Moisture + Soil + Slope + Aspect +
Altitude +
    (1 + Temp + Pptn + Moisture + Soil + Slope + Aspect + Altitude |
   Species)
   Data: SP
      AIC       BIC    logLik  deviance  df.resid
 470.1219  748.2537 -191.0610  382.1219      4066
Random effects:
 Groups  Name        Std.Dev. Corr
 Species (Intercept) 1.19992
         Temp        0.77083   0.27
         Pptn        0.07742  -0.91 -0.64
         Moisture    0.30603  -0.50 -0.91  0.79
         Soil        1.17142  -0.44 -0.93  0.75  0.99
         Slope       0.67329  -0.39 -0.53  0.56  0.32  0.31
         Aspect      0.21153  -0.90 -0.65  1.00  0.82  0.78  0.50
         Altitude    0.24942  -0.92 -0.63  1.00  0.78  0.74  0.55  1.00
Number of obs: 4110, groups:  Species, 5
Fixed Effects:
(Intercept)         Temp         Pptn     Moisture         Soil
 Slope       Aspect     Altitude
 -8.8215831    0.3879856    0.0002847   -0.0816050   -0.1431987
-0.6200528    0.0116070   -0.0003179
Warning messages:
1: Some predictor variables are on very different scales: consider
rescaling
2: In commonArgs(par, fn, control, environment()) :
  maxfun < 10 * length(par)^2 is not recommended.
3: In (function (fn, par, lower = rep.int(-Inf, n), upper = rep.int(Inf,  :
  failure to converge in 10000 evaluations
4: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,  :
  Model failed to converge with max|grad| = 37.0466 (tol = 0.001, component
1)
5: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,  :
  Model failed to converge: degenerate  Hessian with 7 negative eigenvalues

When I run nlmer, I find the following error message for which I also need
some help also because my data are mostly non-linear.

Your guidance will be highly appreciated



With Best Regards
Rajendra M Panda
SWR, IIT Kharagpur, India

On Thu, Feb 12, 2015 at 5:08 AM, Greg Guerin <greg.guerin at adelaide.edu.au>
wrote:

> Hello,
>
> not sure if you are looking to run the GLM/GAMs individually but in one
> run, or as a community composition type model to test main
> drivers/correlates of combined species occurrences. If the latter, another
> option is a GLMM with species having random slope to allow responses to
> differ. For this, you would need to stack the occurrence matrix into a
> Œlong¹ format (a row for the presence/absence of each species in each plot
> with corresponding predictor variables and a field for species).
>
> Response Species Temp Pptn
>
> 0       Sp1     30      1000
> 1       Sp2     30      1000
> 1       Sp3     30      1000
>
> In lme4, something like:
> lmer(Response ~ Temp + Pptn + (1 + Temp + Pptn|Species),
> family=binomial(link="logit"), data)
>
> An example with R code in the Appendix:
> http://dx.doi.org/10.1111/jvs.12111
>
> Greg
>
> --
> Dr Greg Guerin
> Postdoctoral Fellow
> School of Biological Sciences, Faculty of Science
> The University of Adelaide
>
> CRICOS Provider Number 00123M
> -----------------------------------------------------------
> IMPORTANT: This message may contain confidential or legally privileged
> information. If you think it was sent to
> you by mistake, please delete all copies and advise the sender. For the
> purposes
> of the SPAM Act 2003, this
> email is authorised by The University of Adelaide.
>
>
>
>
>
> >
> >----------------------------------------------------------------------
> >
> >Message: 1
> >Date: Tue, 10 Feb 2015 09:28:14 -0700
> >From: Tim Meehan <tmeeha at gmail.com>
> >To: Rajendra Mohan panda <rmp.iit.kgp at gmail.com>
> >Cc: "r-sig-ecology at r-project.org" <r-sig-ecology at r-project.org>
> >Subject: Re: [R-sig-eco] Using multiple species data for gam
> >Message-ID:
> >       <
> CAMTWOzpv58RRX2ocgTCpXh1EPAcxzkSCGKHvdUsaytGhCJH8MQ at mail.gmail.com>
> >Content-Type: text/plain; charset="UTF-8"
> >
> >If you want to do this in a glm framework, you might look into the mvabund
> >package:
> >
> >http://cran.r-project.org/web/packages/mvabund/mvabund.pdf
> >
> >I've never used it with anything approaching 1000 species, though.
> >
> >On Tue, Feb 10, 2015 at 2:41 AM, Rajendra Mohan panda
> ><rmp.iit.kgp at gmail.com
> >> wrote:
> >
> >> Dear All
> >>
> >> I have >1000 species with presence and absence (0 or 1) values and with
> >> seven corresponding predictor variables. If I can run gam/glm for the
> >>data
> >> using all species data simultaneously vs predictors. Data are arranged
> >>in
> >> columns against their GPS locations (see below). I know it is possible
> >>to
> >> do separately for each species.
> >>
> >> Your kind response is highly appreciated.
> >>
> >> Sites  Sp1  Sp2 Sp3 Alt Temp Pptn   Ft
> >> 1A         0      1    1     20   30     1000 Evergreen
> >>
> >> With Best Regards
> >> Rajendra M Panda
> >> School of Water Resources
> >> Indian Institute of Technology Kharagpur, India
> >>
> >>         [[alternative HTML version deleted]]
> >>
> >> _______________________________________________
> >> R-sig-ecology mailing list
> >> R-sig-ecology at r-project.org
> >> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
> >>
> >
> >       [[alternative HTML version deleted]]
> >
> >
>
> _______________________________________________
> R-sig-ecology mailing list
> R-sig-ecology at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>

	[[alternative HTML version deleted]]



More information about the R-sig-ecology mailing list