[R] Incidence Function Model in R help

sjkimble sjkimble at gmail.com
Sun Jul 5 23:15:09 CEST 2009


R Help:

>
>When I look at the object S, I see about half of them are  
>zeroes.

I've address the object S being zero so often by changing the value of
alpha, which I'm allowed to do according to the author. All values of S are
non zero and should not give Inf.

>The "expectation" of a binomial model is for the LHS of the  
>formulat to be either a 1/0 vector or something of the form  
>cbind(events, non_events). You have satisfied that expectation with p  
>but there are only 2 such cases. It seems unreasonable to my thinking  
>to expect that a logistic regression model can deliver sensible output  
>from only 2 events. And that holds doubly (or perhaps infinitely?)   
>true when you are starting out with half of your covariates equal to  
>log(0) = -Inf.

Object p is presence (1) or absence (0) of a species on the 12 islands, and
some of them are rare so they are mostly zeros. Nevertheless I tried with a
more common species whose data are:

    x.crd   y.crd           A p
1  361763 1034071      94.169 1
2  370325 1027277     127.642 1
3  370416 1027166     127.961 1
4  370471 1027148    1804.846 1
5  369050 1031312    1790.493 1
6  370908 1026354     199.103 1
7  361562 1034311    2047.637 1
8  365437 1022188 1622678.961 1
9  347047 1025334      21.169 1
10 349186 1024441  408556.801 1
11 361762 1034052       3.414 0
12 370799 1026557     103.994 0

The code, plus error message:

> haliclona_reniera_manglaris<-read.table(file.choose(),header=T)
> attach(haliclona_reniera_manglaris)
> alphascan<-function(alpha,d,A,p){
+ edis<-as.matrix(exp(-alpha*d))
+ edis<-sweep(edis,2,A,"*")
+ S<-rowSums(edis[,p>0])
+ mod<-glm(p~offset(2*log(S))+log(A),family=binomial)
+ deviance(mod)
+ }
> (sol<-optimize(alphascan,c(0.001,10),d=d,A=A,p=p))
Error: NA/NaN/Inf in foreign function call (arg 4)


Details:
Reference: Incidence Function Model in R, J Oksanen, 2004, available  
at:
cc.oulu.fi/~jarioksa/opetus/openmeta/metafit.pdf
OS: Mac OS 10.5.7
R version: 2.9.0
GUI: 1.28 Tiger build 32-bit

Thanks,
Steve Kimble
Department of Forestry and Natural Resources
Purdue UniversityWest Lafayette, IN 47907

-- 
View this message in context: http://www.nabble.com/Incidence-Function-Model-in-R-help-tp24138251p24346992.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list