[R-sig-eco] Poisson regression

Gavin Simpson gavin.simpson at ucl.ac.uk
Thu May 24 13:16:01 CEST 2012


On Thu, 2012-05-24 at 11:41 +0430, Mahnaz Rabbaniha wrote:
> Dear all
> 
> 
> to find relation between non-normal response with independents variable i
> use this code:
> 
> model1<-gam(Clupeidae~s(depth)+s(temperature)+s(salinity),poisson)

I don't know if this is the problem or not, but you can't call the model
that way. if you don't name arguments then you must list them in the
order the function expects. You don;t say which `gam()` you use but
assuming it is `mgcv:::gam()` then the second argument is `data` and you
passed it a function `poisson`.

Does it work if you do:

model1<-gam(Clupeidae~s(depth)+s(temperature)+s(salinity),
            family = poisson)

?

Really though you should be passing it both a data and a family
argument. Assuming your data are in object named `mydata` then:

model1<-gam(Clupeidae~s(depth)+s(temperature)+s(salinity),
            data = mydata, family = poisson)

would be the correct way to work with the function.

G

> the result shown is:
> 
> There were 50 or more warnings (use warnings() to see the first 50)
> > warnings(model1)
> Warning messages:
> 1: In dpois(y, mu, log = TRUE) : non-integer x = 2.079542 Error in
> cat(list(...), file, sep, fill, labels, append) :
>   argument 2 (type 'list') cannot be handled by 'cat'
> 
> 
> what is meaning it?
> 
> do i allow use it for continue?
> 
> thanks

-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 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-sig-ecology mailing list