[R-sig-Geo] covariates and quadrature points

Alok K. Bohara, PhD bohara at unm.edu
Mon Jan 5 02:22:07 CET 2009


Hi all:

I am trying to use spatstat ppm command to estimate a poisson model with 
a covariate. It gives me an error: (I am new to R)

Error in mpl.get.covariates(covariates, P, Pname) :
Number of rows in ‘covariates’ does not equal the number of quadrature 
points

1. I have created a point pattern dataset ppp with a polygon as window 
(using NC as a state, for example).

x1 <- rawdata$NWBIR74
U <- cbind(x,y,x1)
U <- as.data.frame(U)
Q <- quadscheme(X, dummy=list(x=U$x, y=U$y))
#where X is created using a ppp command with NC polygon as an window "owin"
# gave me many errors saying that I have duplicates...
## So I used this to extract unique elements as suggested somewhere
xu2 <- X[!duplicated(X)]
Q <- quadscheme(xu2, dummy=list(x=U$x, y=U$y))
## I also tried this:
#xu2 <- x[!duplicated(x, fromLast = TRUE)]

df <- data.frame(x11=c(x1, U$x11))
#For some reason df is a vector and NOT a matrix (I don;t know if this 
is what it needs to be??)
ppm(Q, ~ x11, Poisson(), covariates=df)
Error in mpl.get.covariates(covariates, P, Pname) :
Number of rows in ‘covariates’ does not equal the number of quadrature 
points

Thanks

Alok Bohara
Professor
UNM



-- 
Alok K. Bohara, Ph.D.
Professor
Department of Economics
University of New Mexico
Albuquerque, NM 87131,USA
Ph: 505-277-5903/5304(w)
Fax:505-277-9445
email: bohara at unm.edu
http://www.unm.edu/~econ/faculty/professors.html
Nepal Study Center: http://nepalstudycenter.unm.edu




More information about the R-sig-Geo mailing list