[R] Incidence Function Model in R help
sjkimble
sjkimble at gmail.com
Sun Jul 5 00:15:41 CEST 2009
R Help:
Another question:
My data are:
x.crd y.crd A p
1 361762 1034052 3.414 0
2 361763 1034071 94.169 0
3 370325 1027277 127.642 1
4 370416 1027166 127.961 0
5 370471 1027148 1804.846 1
6 369050 1031312 1790.493 0
7 370799 1026557 103.994 0
8 370908 1026354 199.103 0
9 361562 1034311 2047.637 0
10 365437 1022188 1622678.961 0
11 347047 1025334 21.169 0
12 349186 1024441 408556.801 0
and the code, complete with error message, is:
> amphimedon_compressa<-read.table(file.choose(),header=T)
> attach(amphimedon_compressa)
> d<-dist(cbind(x.crd,y.crd))
> alpha<-1
> 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)
Error: NA/NaN/Inf in foreign function call (arg 4)
>
R Help tells me that argument 4 for glm is "weights an optional vector of
‘prior weights’ to be used in the fitting process. Should be NULL or a
numeric vector." I am unsure why this optional vector needs to employed and
how to correct the NA/NaN/Inf error if in fact it is necessary.
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
seesionInfo output:
Error in system.file(package = pkg, lib.loc = lib.loc) :
'package' must be of length 1
In addition: Warning messages:
1: In if (pkg == "base") pkgpath <- file.path(.Library, "base") else if
((envname <- paste("package:", :
the condition has length > 1 and only the first element will be used
2: In if ((envname <- paste("package:", pkg, sep = "")) %in% search()) { :
the condition has length > 1 and only the first element will be used
3: In if (file.access(file.path(lib, pkg), 5) == 0L) { :
the condition has length > 1 and only the first element will be used
Thanks,
Steve Kimble
Department of Forestry and Natural Resources
Purdue University
West Lafayette, IN 47907
______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
--
View this message in context: http://www.nabble.com/Incidence-Function-Model-in-R-help-tp24138251p24338511.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list