All:
Though I am fairly new to R, I am trying to work my way through J Oksanen's
"Incidence Function Model in R" and can't get past some error with my glm
arguments. I'm getting through

> attach(amphimedon_compressa)
>
plot(x.crd,y.crd,asp=1,xlab="Easting",ylab="Northing",pch=21,col=p+1,bg=5*p)
> d<-dist(cbind(x.crd,y.crd))
> alpha<-1
> edis<-as.matrix(exp(-alpha*d))
> diag(edis)<-0
> edis<-sweep(edis,2,A,"*")
> S<-rowSums(edis[,p>0])
> mod<-glm(p~offset(2*log(S))+log(A),family=binomial)

before I get the error message

Error: NA/NaN/Inf in foreign function call (arg 4)

which is an argument concerning weights, an optional vector, whose choices
are NULL or a numeric vector. When I define weights=1, I get

Error in model.frame.default(formula = p ~ offset(2 * log(S)) + log(A),  :
  variable lengths differ (found for '(weights)')

and when I define weights<=1, I get

Error in weights <= 1 :
  comparison (4) is possible only for atomic and list types

Any suggestions?

Thanks!
Steve

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to