I'm trying to perform the LSCV.density function (which replaced the CV.sm function in the prior versions) as part of bivariate kernal density estimation in the sparr package.
own <- readOGR(".", "caseControlOWIN2") myWin <- owin(poly=list( x = rev(own@polygons[[1]]@Polygons[[1]]@coords[-1,1]), y = rev(own@polygons[[1]]@Polygons[[1]]@coords[-1,2]))) plot(myWin) data.sp <- spTransform(data.sp, CRS("+proj=lonlat +datum=WGS84") + point(data.sp) points(data.sp) coordinates(data.sp) data.sp$finalid == "STY" which( data.sp$finalid == "STY") length(which( data.sp$finalid == "STY")) plot(myWin) points(data.sp[data.sp$finalid == "STY",]) points(data.sp[data.sp$finalid == "NEG",]) plot(myWin) plot(myWin, main = "cases") axis(1) axis(2) n1 <- length(which( data.sp$finalid == "STY")) n2 <- length(which( data.sp$finalid == "NEG")) LSCV.density(data, hlim=NULL, res=128, edge=TRUE, WIN=myWIN, quick=FALSE, comment=TRUE) Initialising... Error in LSCV.density(data, hlim = NULL, res = 128, edge = TRUE, WIN = myWIN, : object 'myWIN' not found
So shouldn't it recognize myWin from what I typed in earlier? what am I doing wrong here?