[R-sig-eco] cozigam

Ben Bolker bbolker at gmail.com
Wed Jun 13 15:48:30 CEST 2012


On 12-06-13 08:27 AM, Mahnaz Rabbaniha wrote:
> thanks
> 
> in continue
> 
> your idea exactly correct, i study this lecture and i know for checking
> of model is necessary do diagnostic
> plots including the Q-Q normal score plot of the residuals and the plot
> of residuals vs. tted
> values , but do you introduce which code is usable?

  I don't know.  You can use the standard tools (qqnorm(), plot(),
etc.), use the predict() method to get predicted values of the mean and
zero-inflated part, and compute residuals from that.  I don't know
offhand how to fit the zero-inflation probability and the predicted mean
of the non-zero part together, but I imagine that the latter part (the
Gaussian part of the model) should be well-behaved for the non-zero
responses. (i.e., take the non-zero values of your response variable,
subtract the corresponding predictions to get residuals).

  Maybe look at the new Zuur et al. book on zero-inflated models for
guidance?

> 
> thanks
> 
> On Wed, Jun 13, 2012 at 4:10 PM, Ben Bolker <bbolker at gmail.com
> <mailto:bbolker at gmail.com>> wrote:
> 
>     [cc'ing back to r-ecology]
> 
> 
>     -------- Original Message --------
>     Subject:        Re: [R-sig-eco] cozigam
>     Date:   Wed, 13 Jun 2012 14:38:49 +0430
>     From:   Mahnaz Rabbaniha <rab.mahnaz at gmail.com
>     <mailto:rab.mahnaz at gmail.com>>
>     To:     Ben Bolker <bbolker at gmail.com <mailto:bbolker at gmail.com>>
> 
>     hi
> 
>     thanks for your answer
> 
>     for finding the relation  i have try glm,gam and gam with smooth
>     variable, but in all conditions the results shown unacceptable answer (
>     for example: R-sq.(adj) =    0.1    ,   Deviance explained = 18.9%)
> 
>     in base of contacts previous whit r - group and in base of zero in
>     data,i decided to use cozigam,My awareness is low about it but i try
>     different code in Liu,2010 .
> 
>     after the received mis mentioned above, i omitted depth and this
>     code used:
> 
>       res <- cozigam(Clupeidae~s(temperature,salinity), constraint =
>     "proportional", family = gaussian)
> 
>      result:
> 
>     [snip]
> 
>     > summary(res)
>     Family: gaussian
>     Parametric coefficients:
>                Estimate       Std. Error   t value Pr(>|t|)
>     (Intercept)   -20.665505  13.904231    -1.486   0.1401
>     alpha          -0.486186   0.207679    -2.341   0.0210 *
>     delta1          0.010161   0.004781     2.125   0.0358 *
> 
>     Approximate significance of smooth terms:
> 
>      Edf       Est.rank    F p-value
> 
>     s(temperature,salinity)                 20.81       29 8.77    
>      <2e-16 ***
>     ---
> 
>     Scale est. = 270.56    n = 132
> 
>     what do you think? is it adequate for analyses ? do you have any suggest
> 
> 
>       BMB> This is really too vague a question. You should do the usual
>     things that are done with the results of any analysis: figure out what
>     the parameters mean (e.g. by reading the JRSS COZIGAM paper:
>     http://www.jstatsoft.org/v35/i11/paper ), look at the parameter
>     estimates, their confidence intervals, predictions and see if they
>     make sense, residuals and see if there are obvious violations of
>     the statistical models (systematic patterns, variation in heterogeneity,
>     etc.)
> 
>     On Wed, Jun 13, 2012 at 1:03 PM, Ben Bolker <bbolker at gmail.com
>     <mailto:bbolker at gmail.com>
>     <mailto:bbolker at gmail.com <mailto:bbolker at gmail.com>>> wrote:
> 
>        Mahnaz Rabbaniha <rab.mahnaz at ...> writes:
> 
>        > i try to find regression between clupeidae,with
>        temperature,salinity and
>        > depth. the response variable is inclued many zero ( 86 from 133
>        observed)
>        >
>        > therefore i used this code :
>        >
>        >  res <- cozigam(Clupeidae~s(temperature,salinity)+s(depth),
>        constraint =
>        > "proportional", family = gaussian)
>        >
>        > the result:
>        > iteration = 2    norm = 1.001743
>        > iteration = 3    norm = 0.3377464
>        > iteration = 4    norm = 9.172232e-05
>        >
>        > ==========================================
>        > estimated alpha = -0.5337883 ( 0.1789113 )
>        > estimated delta = -0.0009891505 ( NaN )
>        > ==========================================
>        >
>        > Warning message:
>        >
>        > In sqrt(V.theta[2, 2]) : NaNs produced
>        >
>        > what is exactly meaning?
> 
> 
>         You're probably not getting answers to your repeated posts
>        because you're not providing a reproducible example
>        ( http://tinyurl.com/reproducible-000 ) and not giving very much
>        detail about your problem.
>         I strongly suspect that your model is too complex for your data:
>        a general rule of thumb is that you need about 10 observations
>        per parameter estimated. It's a bit hard to count in this case
>        for two reasons -- zeroes are relatively uninformative (so each
>        zero counts for less than one 'effective' observation), and it's
>        a little hard to count parameters for penalized smooth terms --
>        but I think you can't really expect to fit a two-way smooth term
>        on temperature and salinity *and* a smooth term on depth ... the
>        example in the COZIGAM JRSS paper (referenced in the help)
>        fits a model of about the same complexity to 274 data points with
>        84 zero catches -- somewhere between 3 and 4 times as much data
>        as you have.
>         Most narrowly, the program is trying to estimate the standard
>        error of the parameter by inverting the matrix of second derivatives,
>        and failing because the surface is too flat, or too strongly
>        correlated, or some similar problem.
> 
>        _______________________________________________
>        R-sig-ecology mailing list
>        R-sig-ecology at r-project.org <mailto:R-sig-ecology at r-project.org>
>     <mailto:R-sig-ecology at r-project.org
>     <mailto:R-sig-ecology at r-project.org>>
>        https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> -- 
> Mahnaz Rabbaniha
> Senior expert of marine ecology
> Iranian Fisheries Research Organization (IFRO)
> P.O.Box: 14155-6116 , P.Code: 1411816618*
> Tehran, IRAN
> Phone:   +98 21 44580953
> Fax:       +98 21 44580583
> Mobile:  +98 912 5790377
> 
> 
> 
> 
> 
r



More information about the R-sig-ecology mailing list