« Return to Thread: corspatial

Re: corspatial

by Kingsford Jones :: Rate this Message:

Reply to Author | View in Thread

On Thu, Jul 9, 2009 at 6:12 PM, Kitty Lee<lee.kitty@...> wrote:

>
> Hi. I have a dataset of unique coordinates (no missing coordinates). When I did the following:
>
> lonlat<-mydata[, c("lon, "lat")]
> sp1<-corSpatial(1,form=~lon+lat,type="g")
> scor<-Initialize(sp1, lonlat , nugget=FALSE)
>
> I got a value for sp1 (2.67). But got an error message for scor--Error in getCovariate.corSpatial(object, data = data) :
>  Cannot have zero distances in "corSpatial"
>
> I find that puzzling since I have unique coordinates and there should not be any zero distances. Any idea?

The error does suggest the function thinks there are duplicates in
lonlat.  Have you tried, for example, sum(duplicated(lonlat))?  Or you
could add a small amount of random noise to one of the coordinates and
then see if Initialize will run...


hth,
Kingsford Jones

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

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

 « Return to Thread: corspatial